Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Error: Managed Identity: DefaultAzureCredential authentication failed

Open
#248 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
azure, github-actions, sql

Research direction

Read the workflow YAML and the azure/sql-action@v2.3 invocation, then reproduce the shown sqlcmd command with the ActiveDirectoryDefault authentication path. Done means the GitHub Actions job authenticates through the configured federated Managed Identity and executes ./.github/sql/users.sql without the DefaultAzureCredential error.

Written by the indexing model from the issue text.

Description

Hello,

I'm encountering an issue when trying to use a Managed Identity with a Federated Credential in GitHub Actions to run azure/sql-action@v2.3. The Managed Identity has been configured with a Federated Credential for GitHub (environment).

I added my Managed Identity to the database as db_owner, with the following query:

DROP USER IF EXISTS [ManagedIdentity-Dev];
CREATE USER [ManagedIdentity-Dev] FROM EXTERNAL PROVIDER WITH DEFAULT_SCHEMA=[dbo];
ALTER ROLE db_owner ADD MEMBER [ManagedIdentity-Dev];

Here is my GitHub Actions workflow (.yml file):

    create-sql-users:
      runs-on:
        group: github-runner-Dev
      environment: ${{ inputs.environment }}
      steps:
        - uses: actions/checkout@main
        - uses: azure/login@v2
          with:
            client-id: ${{ vars.AZURE_CLIENT_ID }} # The Managed Identity with Federated Credential
            tenant-id: ${{ vars.AZURE_TENANT_ID }}
            subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
        - uses: azure/sql-action@v2.3
          with:
            connection-string: ${{ secrets.AZURE_SQL_CONNECTION_STRING }}
            path: './.github/sql/users.sql'
            skip-firewall-check: true

Issue:

When the workflow runs, I receive the following error message:

sqlcmd -S mydatabase-dev.database.windows.net,1433 -d mydatabase-dev --authentication-method=ActiveDirectoryDefault -i ./.github/sql/users.sql
DefaultAzureCredential authentication failed
GET http://localhost:42356/msi/token
--------------------------------------------------------------------------------
RESPONSE 400 Bad Request
--------------------------------------------------------------------------------
{
  "statusCode": 400,
  "message": "No User Assigned or Delegated Managed Identity found for specified ClientId/ResourceId/PrincipalId.",
  "correlationId": "86d82795-065e-4a71-a11c-12a10e7879d0"
}

Am I missing something?

Dominant language
TypeScript
Stars
142
Forks
73
Avg merge
9d 18h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/sql-action

All issues in Azure/sql-action

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.