Receiving "Login failed with Error: Using auth-type: SERVICE_PRINCIPAL" When running GitHub Workflow

AJ 20 Reputation points
2024-05-23T03:29:52.2433333+00:00

Hello,

I'm following this MS Learn Exercise and running into a login issue.

Error: Login failed with Error: Using auth-type: SERVICE_PRINCIPAL. Not all values are present. Ensure 'client-id' and 'tenant-id' are supplied.. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.

I'm unsure why I'm running into this issue. I confirmed the client-id and tenant-id are stored in Github Secrets. Any help or guidance would greatly be appreciated.

Here is the workflow file.

name: Deploy ARM Template
on:
  push:
    branches:
      - main
env:
  AZURE_SUBSCRIPTION_ID: '[REDACTED]'  # set this to your Azure Subscription Id
  AZURE_RESOURCE_GROUP: GitHubActionExercise-rg   # set this to your target resource group
jobs:
  deploy-virtual-network-template:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source code
        uses: actions/checkout@main
      - name: Login to Azure
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}
      - name: Deploy ARM Template
        uses: azure/arm-deploy@v1
        with:
          scope: resourcegroup
          subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }}
          resourceGroupName: ${{ env.AZURE_RESOURCE_GROUP }}
          template: ./azuredeploy.json

GitHub Secrets AZURE_CREDENTIALS Contents:

{
  "clientId": "[REDACTED]",
  "clientSecret": "[REDACTED]",
  "subscriptionId": "[REDACTED]",
  "tenantId": "[REDACTED]",
  "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
  "resourceManagerEndpointUrl": "https://management.azure.com/",
  "activeDirectoryGraphResourceId": "https://graph.windows.net/",
  "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
  "galleryEndpointUrl": "https://gallery.azure.com/",
  "managementEndpointUrl": "https://management.core.windows.net/"
}

Any help would greatly be appreciated.

Thanks!

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,168 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rakesh Gurram 4,805 Reputation points Microsoft Vendor
    2024-05-24T09:58:56.12+00:00

    Hi AJ,

    Thank you for your patience.

    We have successfully replicated the steps within the module. Please ensure that your assigned role is 'Contributor.' If it is not, assign yourself the 'Contributor' role and avoid using restricted Azure directories. Additionally, verify that the client secrets in both the CLI and GitHub secrets are correct and save them under Action secrets.

    User's image

    p5

    This has been created resource within the given resource group. Resource Group>>Settings>>Deployments>>Created Resource (VNet) as shown:

    User's image

    Please don't hesitate to reach out to us if you have any other queries with screenshots of the error (after concealing your PII).

    If the information is helpful, please Accept Answer & Upvote so that it would be helpful to other community members.

    Thank you.