TFE 0.12.2
AzureRM : 1.41.0
Vault : 2.7.1
Terraform Authentication
I use a VAULT provider (via a module) to get the temp credentials for a service principal in Azure, per the debug logs these are being returned successfully. Then the provider block executes and fails to log in with those credentials. Manually looking in AzureAD App Registrations shows the given client_id DOES exist.
provider "azurerm" {
subscription_id = "${var.subscription_id}"
client_id = "${module.vaultprovider.client_id}"
client_secret = "${module.vaultprovider.client_secret}"
tenant_id = "${var.tenant_id}"
}
Error building account: Error getting authenticated object ID: Error listing Service Principals: autorest.DetailedError{Original:adal.tokenRefreshError{message:"adal: Refresh request failed. Status Code = '400'. Response body: {\"error\":\"unauthorized_client\"
Authentication to Azure was successful, given valid credentials.
Error building account: Error getting authenticated object ID: Error listing Service Principals: autorest.DetailedError{Original:adal.tokenRefreshError{message:"adal: Refresh request failed. Status Code = '400'. Response body: {\"error\":\"unauthorized_client\"
Using Terraform Enterprise:
call vault to get temp creds
use returned creds to auth to azure via azurerm provider block
Note: using the az cli works because there is enough time between service principal creds being created and making the cli call for the creds to propagate.
This works, sometimes... about 1 in 20 runs is good. The rest all fail with this error and so I know it works but it is a timing issue between the temporary creds getting created and the provider block using them.
I'm also experiencing this issue as of AzureRM 1.38, prior versions work fine.
hi @jmyers82 @ryanps1
Thanks for opening this issue.
Since this access token's being generated from Vault it appears this token isn't fully provisioned before being returned - as such this appears to be something that Vault is doing prior to returning the token.
Due to this unfortunately this bug would need to be fixed within Vault rather than the Azure Provider - and as such I'm going to close this issue for the moment; but would you mind reopening this issue on the Vault repository where someone should be able to take a look?
Thanks!
hi @jmyers82 @ryanps1
Thanks for opening this issue.
Since this access token's being generated from Vault it appears this token isn't fully provisioned before being returned - as such this appears to be something that Vault is doing prior to returning the token.
Due to this unfortunately this bug would need to be fixed within Vault rather than the Azure Provider - and as such I'm going to close this issue for the moment; but would you mind reopening this issue on the Vault repository where someone should be able to take a look?
Thanks!
Hi Tom,
I'm actually not using Vault for these at all, I'm logging in with a service principal through environment variables. Admittedly these values are being populated from an Azure KeyVault as part of an Azure DevOps pipeline, but it doesn't seem as though it's specific to just Hashicorp Vault.
Cheers
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!