Prompt Detail:
If you want to use service principal credentials to authenticate in your Azure Pipelines YAML file, you can use the Azure CLI task to run a script that authenticates with the service principal.
Here's an example YAML pipeline that demonstrates how to use the Azure CLI task to authenticate with a service principal:
yamltrigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureCLI@2
inputs:
azureSubscription: '<your-subscription-name>'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az login --service-principal -u "<your-application-id>" -p "<your-client-secret>" --tenant "<your-tenant-id>"
In this example, the Azure CLI task is used to run a Bash script that logs in to Azure
Add a comment