Share via

AzureCLI task in deployment pipeline: Azure login failed

Richard Barraclough 21 Reputation points
2026-04-30T16:21:47.52+00:00

I have an Azure release pipeline that's been working for a while but suddenly the AzureCLI task fails saying Azure login failed.

Here is the task.

User's image

Clicking on Manage I get through to Azure that shows a warning about an expired 'secret'.
It will produce a new secret, but what do I do with it? I can't find the old one anwhere.

Azure DevOps
0 comments No comments

2 answers

Sort by: Most helpful
  1. Richard Barraclough 21 Reputation points
    2026-05-05T08:25:42.19+00:00

    How do I

    save new secret in service connection

    ?

    User's image

    0 comments No comments

  2. Rakesh Mishra 8,420 Reputation points Microsoft External Staff Moderator
    2026-04-30T16:57:40.5466667+00:00

    Hey Richard, it looks like your AzureCLI task is failing because the underlying Service Principal’s client secret has expired. When you hit “Manage” in your classic pipeline and see that warning, it’s telling you exactly that – the secret used by your Azure Resource Manager service connection is no longer valid, so az login blows up.

    Here’s how to fix it:

    Click on Rotate secret if it is visible to auto rotate.

    Or

    1. Click on Manage App registration as in screenshot below. OR In the Azure Portal, go to Azure Active Directory (Microsoft Entra Id) → App registrations → find the app/service principal that backs your DevOps service connection by matching the Id mentioned below service connection name.
    2. Under “Certificates & secrets,” click New client secret, give it a name and expiry, hit Add, and copy the Value immediately (you won’t be able to retrieve it again).
    3. Switch over to Azure DevOps:
      • Navigate to Project settingsService connections.
      • Find your “Azure Subscription (xxx-… )” connection, click the … and choose Edit.
      • Under Authentication method, paste in the new secret Value you just created, click Verify (or Save), and confirm the connection succeeds.
    4. Re-run your pipeline. The AzureCLI task should now authenticate successfully.

    User's image

    If you can’t find the original service connection or want a fresh start, you can also create a brand-new ARM service connection in DevOps and point your task to that.

    Hope that helps—once the secret’s updated, your inline PowerShell or CLI steps will be able to az login again without errors!

    Reference docs for more details:

    Note: This content was drafted with the help of an AI system.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.