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

New auth method: Federated Workload Identity (a.k.a OIDC) #438

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Jul 25, 2023

This PR add supports for auth method Federated Workload Identity. In order to use this auth method for github, users need to follow up the https:registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_oidc to setup the SP and also the necessary env var. Then launch the command with option: --use-oidc-cred.

A example workflow can be found at: https:github.com/magodo/aztfy-oidc-test/blob/2eaad2c1f47cf369955fb7a1f715a05488faa48f/.github/workflows/test.yaml. Basically, following settings are required:

permissions:
  id-token: write
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
      #...
      - name: Export the demo rg using oidc
        run:
          aztfexport rg -n -f -use-oidc-cred --plain-ui my-rg
        env:
          ARM_USE_OIDC: true
          ARM_TENANT_ID: ${{ secrets. ARM_TENANT_ID }}
          ARM_SUBSCRIPTION_ID: ${{ secrets. ARM_SUBSCRIPTION_ID }}
          ARM_CLIENT_ID: ${{ secrets. ARM_CLIENT_ID }}

Note that the ARM_USE_OIDC env var is necessary to be used for the AzureRM provider.

Fix #436.

@magodo magodo added the enhancement New feature or request label Jul 25, 2023
@magodo magodo requested a review from ms-henglu July 25, 2023 08:16
@magodo magodo requested a review from stemaMSFT July 25, 2023 08:52
Copy link
Member

@stemaMSFT stemaMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@magodo magodo merged commit 6b91f93 into Azure:main Jul 26, 2023
@ctahok
Copy link

ctahok commented Nov 30, 2023

There is a typo Federated not Fedorated

@magodo magodo changed the title New auth method: Fedorated Workload Identity (a.k.a OIDC) New auth method: Federated Workload Identity (a.k.a OIDC) Dec 1, 2023
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

Successfully merging this pull request may close these issues.

AZTFEXPORT and openID
4 participants