microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
372 stars 260 forks source link

Use PAT Lifecyle Management APIs to generate dynamic/ephemeral PAT token for provider #943

Open robertscully-wpp opened 6 months ago

robertscully-wpp commented 6 months ago

Community Note

Description

I have been making use of Federated Credentials for app registration to create dynamic tokens for Terraform executions using the Azure provider.

I would like to make use of the features of the PAT lifecycle API, as documented here, to generate an ephemeral PAT for managing Azure Devops using an Entra App Registration.

In this scenario, when an App Registration is configured to have Azure Devops API access with the user_impersonisation delegated permission, is it possible to use the same OIDC mechanism that the Azure provider uses to:

  1. authenticate to Entra
  2. generate an ephemeral token for the app registration
  3. use this to generate the ephemeral PAT using the AzureDevops PAT lifecycle management API?
  4. use the ephemeral PAT for the azuredevops provider

New or Affected Resource(s)

Potential Terraform Configuration

References

jubr commented 3 months ago

@robertscully-wpp you might not have to given #747 is released in v1.0.0

Also, a workaround was mentioned in the comments at https://github.com/microsoft/terraform-provider-azuredevops/pull/747#discussion_r1420241486

robertscully-wpp commented 3 months ago

@jubr thanks for the feedback on here, will have a read through the comments and release notes.