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

Allow for authenticating to Azure using the Azure CLI #414

Open
marcin478 opened this issue Feb 13, 2024 · 3 comments
Open

Allow for authenticating to Azure using the Azure CLI #414

marcin478 opened this issue Feb 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@marcin478
Copy link

This is already supported by the azurerm and azuread providers.
It's required to solve the problem with the 10 minutes idToken validity limitation when using Workload Identity to Federation for Azure DevOps Service Connection.

@ms-henglu ms-henglu added the enhancement New feature or request label Feb 18, 2024
@ms-henglu
Copy link
Collaborator

Hi @marcin478 ,

Thank you for taking time to report this issue and apologize for late response.

The azapi provider does support this feature, more details could be found here: https://registry.terraform.io/providers/Azure/azapi/latest/docs/guides/azure_cli

@srvmsr
Copy link

srvmsr commented Apr 29, 2024

We are facing the same issue , azure cli auth works well when auzure cli is authenticated via Service principal client secret, however we get below error when we use Workload Identity to Federation for Azure DevOps Service Connection.

"Error: reading "Resource: (ResourceId "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" / Api Version "2022-09-01")": ChainedTokenCredential authentication failed
│ GET http://169.254.169.254/metadata/identity/oauth2/token
│ --------------------------------------------------------------------------------
│ RESPONSE 400 Bad Request
│ --------------------------------------------------------------------------------
│ {
│ "error": "invalid_request",
│ "error_description": "Identity not found"
│ }

At the same config , azurerm provider works well.
Provider config as below:

`terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "> 3.63.0"
}
azapi = {
source = "Azure/azapi"
version = "
> 1.8.0"
}
}
backend "azurerm" {
}
}

provider "azapi" {
use_cli = true
}

provider "azurerm" {
skip_provider_registration = true
features {}
}
`

@sikksakk
Copy link

sikksakk commented May 7, 2024

+1 to @srvmsr
Using Workload Identity is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants