-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
CLI auth does not work with Key Vaults secrets #656
Comments
@tombuildsstuff any idea when this will get fixed? |
this is not limited to just secrets in a key vault I am also hitting this same error when managing certificates in a key vault |
is there currently a workaround? |
just got slapped by this issue :( |
Ran into the same issue while debugging locally. My workaround was using a service principal locally instead of
One other thing I missed is creating an access policy for the SP within the keyvault otherwise it won't be able to manage secrets. Seems to be common KeyVault behavior but I initially thought any IAM contributor can also manage secrets 🙄 If you deploy the keyvault itself via TF make sure the access policy is set automatically. |
Thanks @anoff 👍 will give your workaround a try |
Same issue with the keys, any update on this? |
@tombuildsstuff is there any reason to make this check only for
If that's important does it make sense to create a list of allowed domains for now and the future platform features? |
Please keep in mind that there are multiple vault domains (like *.vault.microsoftazure.de for azure germany). |
@DonEstefan indeed - rather than hard-coding domain name suffixes we use the values from the Azure Environment (which contains, amongst other things - the API Base URI's & Domain Suffixes). To give an update here: we're intending on getting to this - but I can't give an timeframe for fixing this at this point. I took a quick look into this recently and the complexity comes with testing this (since CloudShell, the Azure CLI v1 [Node.JS] and the Azure CLI v2 [Python]) all return the same configuration file with a different schema, such that we need to manually test this in each environment (since the format can [and has in the past] changed). In the interim the workaround is to use a Service Principal, which whilst I realise isn't ideal - does provide a workaround for this issue for the moment. Regarding prioritising this - if you'd like to see this implemented, we'd really appreciate a 👍 on the first post here - which we use to influence what we're working on (we tend to sort issues by the most 👍 when determining what should be prioritised). Thanks. |
I hit this issue today whilst working with |
Just ran into this issue. Looks like a fix was pushed? I'm on terraform v0.11.7 with Azure provider v1.8.0. Not clear if issues is fixed or if I'm doing something wrong. Working with secrets using "azurerm_key_vault_secret" Thanks. |
hi @mattops @steve-hawkins @kcighon @hafizullah @anoff @marrik96 @MarkWme @DonEstefan @andrey-moor Just to let you know that is now available in [v1.10 of the AzureRM Provider(https://github.com/terraform-providers/terraform-provider-azurerm/blob/v1.10.0/CHANGELOG.md#1100-july-21-2018) - which you can update to this version by specifying it in the Provider block, like so:
Thanks again @sophos-jeff :) Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Whilst trying to manage key vault secrets, using CLI auth, getting:
* module.my_mod_instance.azurerm_key_vault_secret.my_secret_name: azurerm_key_vault_secret.my_secret_name: Error making Read request on Azure KeyVault Secret my_secret_name: keyvault.ManagementClient#GetSecret: Failure responding to request: StatusCode=401 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF
getting this in the DEBUG logs:
e.g.
TF_LOG=DEBUG terraform apply
2018-01-02T14:11:47.804Z [DEBUG] plugin.terraform-provider-azurerm_v1.0.0_x4: 2018/01/02 14:11:47 [DEBUG] Resource "https://vault.azure.net" isn't a management domain
This is related to this line of code:
https://github.com/terraform-providers/terraform-provider-azurerm/blob/1005762a37e67f93aa340b40d1682f70523da61a/azurerm/helpers/authentication/access_token.go#L37
When managing azure key vaults, Azure needs the correct bearer token for the specific "Azure resource endpoints" - in this case it should be "https://vault.azure.net".
When managing secrets via the az cli - this is done transparently, but is effectively similar to:
az account get-access-token --resource https://vault.azure.net
This token then then permits access.
The text was updated successfully, but these errors were encountered: