azure/login@v3

Authenticate to Azure and run your Azure CLI or Azure PowerShell based actions or scripts.

At a glance

Latest major
v3
Repository
azure/login
Inputs
11 (0 required)
Outputs
0
Runs using
node24
License
MIT
Last checked

Inputs and outputs come straight from the action's official action.yml. See our editorial standards.

Usage

- uses: azure/login@v3

Inputs

NameRequiredDefaultDescription
credsNononePaste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS
client-idNononeClientId of the Azure Service principal created.
tenant-idNononeTenantId of the Azure Service principal created.
subscription-idNononeAzure subscriptionId
enable-AzPSSessionNofalseSet this value to true to enable Azure PowerShell Login in addition to Azure CLI login
environmentNoazurecloudName of the environment. Supported values are azurecloud, azurestack, azureusgovernment, azurechinacloud, azuregermancloud. Default being azurecloud
allow-no-subscriptionsNofalseSet this value to true to enable support for accessing tenants without subscriptions
audienceNoapi://AzureADTokenExchangeProvide audience field for access-token. Default value is api://AzureADTokenExchange
auth-typeNoSERVICE_PRINCIPALThe type of authentication. Supported values are SERVICE_PRINCIPAL, IDENTITY. Default value is SERVICE_PRINCIPAL
max-context-populationNononeOnly used when enable-AzPSSession is true. Overrides the Azure PowerShell MaxContextPopulation used by Connect-AzAccount (the number of subscription contexts loaded). Set to -1 to load all subscriptions, or a positive integer. When unset, the Azure PowerShell default of 25 applies.
mask-client-idNotrueSet this value to false to stop registering the client-id as a secret, so it is not masked in workflow logs

Outputs

This action declares no outputs in its action.yml.

Examples

Sign in with federated credentials

OIDC login with an app registration; no client secret is stored.

name: Example
on:
  push:
    branches: [main]

permissions:
  id-token: write
  contents: read

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - name: Azure Login
        uses: azure/login@v3
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      - run: az account show

Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.

Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.