For compliance reasons we have to turn off Basic Authentication on our Azure Web Apps.
We are using a service principal in our Azure Devops Pipeline but it fails without Basic Authentication. I think it may be downloading the publish profile using the service principal. Is there any way to not use Basic Authentication with the following deploy step:
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: '<service principal name>'
appType: 'webApp'
WebAppName: '<webapp name>'
packageForLinux: '$(Build.ArtifactStagingDirectory)/**/DeployApp.zip'
2
Answers
I created one Azure DevOps service connection like below:-
The Service Principal I used for creating the Service connection has Owner role at the Subscription Level, To deploy Web app or any azure resource. Make sure you atleast have Contributor or Owner role assigned to the Service principal you’re using for Web app deployment like below:-
Now, I used the same service principal in my Web app Build and Deployment task like below:-
My yaml pipeline script:-
Build Job and Deployment Job got succeeded like below:-
Does it also work if the service principal has contributor role in the resource group where app service is deployed?