Azure DevOps: using DefaultAzureCredential in an Azure Pipeline with AzureCLI@2
I frequently build scripts that work against Azure resources using the Azure SDK for JavaScript. I use the DefaultAzureCredential
to authenticate against Azure resources - this is also available in other platforms such as .NET.
The DefaultAzureCredential
is a great way to authenticate locally; I can az login
and then run my script, safe in the knowledge that the DefaultAzureCredential
will authenticate successfully. However, how can I use the DefaultAzureCredential
in an Azure DevOps pipeline?
This post will show you how to use the DefaultAzureCredential
in an Azure DevOps pipeline, specifically by using the AzureCLI@2
task.