# Login to Azure subscription
name: 'Azure Login'
description: 'Authenticate to Azure and run your Azure CLI or Azure PowerShell based actions or scripts.'
inputs:
  creds:
    description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS'
    required: false
  client-id:
    description: 'ClientId of the Azure Service principal created.'
    required: false
  tenant-id:
    description: 'TenantId of the Azure Service principal created.'
    required: false
  subscription-id:
    description: 'Azure subscriptionId'
    required: false
  enable-AzPSSession:
    description: 'Set this value to true to enable Azure PowerShell Login in addition to Azure CLI login'
    required: false
    default: false
  environment:
    description: 'Name of the environment. Supported values are azurecloud, azurestack, azureusgovernment, azurechinacloud, azuregermancloud. Default being azurecloud'
    required: false
    default: azurecloud
  allow-no-subscriptions:
    description: 'Set this value to true to enable support for accessing tenants without subscriptions'
    required: false
    default: false
  audience:
    description: 'Provide audience field for access-token. Default value is api://AzureADTokenExchange'
    required: false
    default: 'api://AzureADTokenExchange'
  auth-type:
    description: 'The type of authentication. Supported values are SERVICE_PRINCIPAL, IDENTITY. Default value is SERVICE_PRINCIPAL'
    required: false
    default: 'SERVICE_PRINCIPAL'
  max-context-population:
    description: 'Only 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.'
    required: false
  mask-client-id:
    description: 'Set this value to false to stop registering the client-id as a secret, so it is not masked in workflow logs'
    required: false
    default: true
branding:
  icon: 'login.svg'
  color: 'blue'
runs:
  using: 'node24'
  main: 'lib/main/index.js'
  post-if: (!env.AZURE_LOGIN_POST_CLEANUP || env.AZURE_LOGIN_POST_CLEANUP != 'false')
  post: 'lib/cleanup/index.js'
