-
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
Subscription ID of a resource from azurerm provider is replaced by local az cli account id #23068
Comments
This is a frustrating issue, and a regression as well. Currently, azurerm does not pass subscription id to cli authorizer, nor to any of the other authorizers it supports. So this has to be fixed first in |
To add some context to this. In my case, we have multiple user accounts per tenant, and account user have access to different subscriptions. If you work with multiple configurations, one per subscription, you would have to constantly do For this to be fixed, subscription id would have to be passed from azurerm to go-azure-sdk and there it needs to be added to |
We are closing in on a year for this quite important bug to be closed. Pretty please, someone?
|
If anyone comes here with the same issue, I found that the following config DOES WORK in current versions: provider "azurerm" { Key is the tenant id. Without that the subscription id is simply not working. |
This comment was marked as spam.
This comment was marked as spam.
Thanks all for the feedback on this issue. I recognise this is an issue with certain configurations, but I would like to clarify the multi-subscription and/or multi-tenant scenarios which have a recommend configuration and those which currently do not work as expected.
In the latter scenario, it's not currently possible to apply a configuration that uses both subscriptions, and when working with a single subscription, you must use I am looking into ways to potentially resolve this - I do recognise that earlier versions passed the subscription ID to az-cli to serve as an indicator of which "account" (in az-cli terms) to use when acquiring a token; we may revert to this behavior or we may try a different approach. In the next major release (v4.0) or the provider, we will most likely be making |
#26282 will be included in this week's release and restores the earlier behavior of passing the subscription ID to Azure CLI when acquiring an access token. This should resolve the reported issue and enable authentication scenarios involving multiple user accounts and subscriptions in the same tenant. |
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. |
Is there an existing issue for this?
Community Note
Terraform Version
0.15.5
AzureRM Provider Version
3.52.0
Affected Resource(s)/Data Source(s)
azurerm_resource_group
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The subscription id for the resource group should be the subscription id set in the azurerm provider block,
SUBSCRIPTION_ID X
, and the plan should execute successfully.Actual Behaviour
The subscription id for the resource group is replaced with the local az cli account subscription id,
SUBSCRIPTION_ID Y
(which needs to be set to the subscription of where the tf state file is stored) meaning the scope that is trying to be fetched is invalid.az account set via:
az account set -s <SUBSCRIPTION_ID Y>
Steps to Reproduce
terraform plan
Important Factoids
No response
References
#14516
The text was updated successfully, but these errors were encountered: