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

backend/azure doesn't find access tokens from az cli when AZURE_CONFIG_DIR is set #25416

Closed
gjtaylor opened this issue Jun 26, 2020 · 2 comments
Milestone

Comments

@gjtaylor
Copy link

Terraform Version

$ terraform version
Terraform v0.12.28
...

Terraform Configuration Files

terraform {
  backend "azurerm" {
    resource_group_name  = "StorageAccount-ResourceGroup"
    storage_account_name = "abcd1234"
    container_name       = "tfstate"
    key                  = "prod.terraform.tfstate"
  }
}

(the resources don't actually need to exist to demonstrate this issue)

Debug Output

https://gist.github.com/gjtaylor/3aa7bad9b7b2961e98214d1bcfd681eb

Crash Output

Expected Behavior

terraform should have used the access token from the az login to authenticate to the remote backend.

Actual Behavior

Error: Error building ARM Config: Error populating Client ID from the Azure CLI: No Authorization Tokens were found - please ensure the Azure CLI is installed and then log-in with 'az login'.

Steps to Reproduce

$ export AZURE_CONFIG_DIR=[not $HOME/.azure]
$ az login
You have logged in. Now let us find all the subscriptions to which you have access...
...
$ terraform init

Additional Context

References

Similar problem in hashicorp/terraform-provider-azurerm#5891

gjtaylor added a commit to gjtaylor/terraform that referenced this issue Jun 26, 2020
New version honours AZURE_CONFIG_DIR environment variable when looking for
access tokens.

Fixes hashicorp#25416
gjtaylor added a commit to gjtaylor/terraform that referenced this issue Jun 26, 2020
New version honours AZURE_CONFIG_DIR environment variable when looking for
access tokens.

Fixes hashicorp#25416
gjtaylor added a commit to gjtaylor/terraform that referenced this issue Jun 26, 2020
New version honours AZURE_CONFIG_DIR environment variable when looking for
access tokens.

Fixes hashicorp#25416
@tombuildsstuff
Copy link
Contributor

Closing since this has instead been fixed via #26721

@tombuildsstuff tombuildsstuff added this to the v0.15.0 milestone Feb 17, 2021
@ghost
Copy link

ghost commented Mar 20, 2021

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants