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

data.azurerm_client_config.current.object_id return "" empty when upgrading az cli to 2.37.0 #16982

Closed
1 task done
LaurentLesle opened this issue May 27, 2022 · 5 comments
Closed
1 task done

Comments

@LaurentLesle
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.2.1

AzureRM Provider Version

3.7.0 or 2.88.1

Affected Resource(s)/Data Source(s)

data.azurerm_client_config.current.object_id

Terraform Configuration Files

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {}

output "object_id" {
  value = data.azurerm_client_config.current.object_id
}

Debug Output/Panic Output

data.azurerm_client_config.current: Reading...
data.azurerm_client_config.current: Read complete after 0s [id=2022-05-27 01:16:03.753374069 +0000 UTC]

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:
object_id = ""

Expected Behaviour

object_id = "object id of the logged in user"

Actual Behaviour

When upgrading the azure cli to version 2.37.0

Steps to Reproduce

Upgrading the azure cli to version 2.37.0
Login to azure with a user
terraform apply the code above

Note:
az ad signed-in-user show
was returning objectId with previous versions
now return "id" for the user object_id

Important Factoids

No response

References

No response

@pauldotyu
Copy link

Switching to using the azuread provider is a workaround for now.

@geekzter
Copy link

This also works:

data external account_info {
  program                      = [
                                 "az",
                                 "ad",
                                 "signed-in-user",
                                 "show",
                                 "--query",
                                 "{object_id:id}",
                                 "-o",
                                 "json",
                                 ]
}

output user_object_id {
    value = data.external.account_info.result.object_id
}

geekzter added a commit to geekzter/azure-devenv that referenced this issue May 28, 2022
geekzter added a commit to geekzter/azure-aks that referenced this issue May 28, 2022
* Terraform 1.2.1

* Update providers

* Switch to azuread_client_config, mitigating hashicorp/terraform-provider-azurerm#16982
@tombuildsstuff tombuildsstuff added this to the v3.9.0 milestone Jun 2, 2022
@tombuildsstuff
Copy link
Contributor

Fixed via #17074

@github-actions
Copy link

github-actions bot commented Jun 3, 2022

This functionality has been released in v3.9.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

hknutsen added a commit to equinor/terraform-azurerm-storage that referenced this issue Jun 20, 2022
Remove version constraints for fxture to always use latest version of providers when running tests. This prevents issues caused by breaking changes in the Azure CLI, e.g. hashicorp/terraform-provider-azurerm#16982.

Closes #16
@github-actions
Copy link

github-actions bot commented Jul 4, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants