Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMSS Azure Auth error #21

Closed
grahamsk opened this issue May 26, 2019 · 4 comments
Closed

VMSS Azure Auth error #21

grahamsk opened this issue May 26, 2019 · 4 comments

Comments

@grahamsk
Copy link

grahamsk commented May 26, 2019

Hi,

I'm trying to use the Azure auth backend in conjunction with a VMSS + user assigned managed service identity. Here's what I get when trying:

vault write auth/azure/login role="my-role" \
jwt="$(curl -s 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' -H Metadata:true | jq -r '.access_token')" \
subscription_id=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2018-10-01" | jq -r '.compute | .subscriptionId') \
resource_group_name=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2017-10-01" | jq -r '.compute | .resourceGroupName') \
vmss_name=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2018-10-01" | jq -r '.compute | .vmScaleSetName')


Error writing data to auth/azure/login: Error making API request.

URL: PUT https://vault.redacted.com:8200/v1/auth/azure/login
Code: 500. Errors:

* vmss principal id is empty

Could you please help me to get to the bottom of this?

@pyncc
Copy link

pyncc commented Sep 5, 2019

Also having this issue though with a single vm (a set of vms sharing the same user-assigned managed service identity).

Comes down to this from what I can tell:

https://github.com/hashicorp/vault-plugin-auth-azure/blob/master/path_login.go#L215

Where this is what that struct looks like:

https://github.com/hashicorp/vault-plugin-auth-azure/blob/master/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute/models.go#L3610

Which mentions that this is only set by the system.

Not going to propose solutions but may come up with a PR soon.

@grahamsk
Copy link
Author

grahamsk commented Nov 5, 2019

Just as an update - I have reverted back to using a System Assigned MSI until User Assigned MSI's work.

@KealanM
Copy link

KealanM commented Nov 26, 2019

I started hitting this one as well, do we have any more info on this or possible workarounds? Going by @pyncc comment the Principal ID check is not valid for User assigned MI's.

@ungureanuvladvictor
Copy link
Contributor

Hey folks I think #29 solves this.

@kalafut kalafut closed this as completed Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants