question

JordanMarr-4269 avatar image
0 Votes"
JordanMarr-4269 asked ryanchill commented

azure cli - error swapping slots with publish profile

I am trying to create an automated deployment for my web app service via Azure DevOps using the "Azure CLI" task with the following script:

az webapp deployment slot auto-swap --name samplesite-web --resource-group samplesite-rg --slot staging

I get the following error: "Auth Scheme PublishProfile is not supported" In a previous step, I successfully deployed my site to the "staging" slot using a publish profile. So why doesn't this work? I am able to swap from Azure Portal without an error.

Btw, the same CLI script works when run from my local pc.

azure-webapps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JordanMarr-4269 - Updated the tag to reflect azure webapps . Respective SME's will review and share there pointers on this.

However if the issue is related to ADO , currently ADO is not supported on Q&A and Azure DevOps team and community are active and answering questions on https://developercommunity.visualstudio.com/spaces/21/index.html can you please post your question there instead? Thank you

0 Votes 0 ·
JordanMarr-4269 avatar image
0 Votes"
JordanMarr-4269 answered

The error message appears to be caused due to the fact that I was using an arm task with the following Service Connector type:
```
Azure Resource Manager
using publish profile based authentication
```

Unfortunately, I do not have "create application" access at the tenant, so none of the other available options will work for me to finish my deployment pipeline.
So I will just have to use the publish profile and then manually swap slots via the Azure CLI.

Thank you for the help.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ryanchill avatar image
0 Votes"
ryanchill answered ryanchill commented

Hi @JordanMarr-4269, I would advise using AzureWebApp@ and AzureAppServiceManage@ tasks to perform you swap, see https://docs.microsoft.com/en-us/azure/devops/pipelines/targets/webapp?view=azure-devops&tabs=yaml#deploy-to-a-slot.

 - task: AzureWebApp@1
   inputs:
     azureSubscription: '<Azure service connection>'
     appName: '<name of web app>'
     slotName: staging
    
 - task: AzureAppServiceManage@0
   inputs:
     azureSubscription: '<Azure service connection>'
     WebAppName: '<name of web app>'
     ResourceGroupName: '<name of resource group>'
     SourceSlot: staging

I can't speak to what caused the Auth Scheme PublishProfile, especially since you said a CLI script worked in the prior step. You can use the --debug switch to get more verbose logging to see where about the failure is thrown and create a new issue on the Azure CLI repo.

Regards,
Ryan


· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Unfortunately, I was using the Azure CLI task because the AppServiceManage task (which was my first choice) gave the same publish profile error.

0 Votes 0 ·

Another factor is that the web app is hosted in the customer's Azure tenant ("Tenant B"), while the source code lives in my company's DevOps tenant ("Tenant A").
However, I did create a managed connection under "Azure Resource Manager connection". Are there known issues with hosting in Tenant A but publishing to Tenant B?

0 Votes 0 ·

I wouldn't think there would be issue since that like works locally and task prior containing works.

if your turn on verbose logging for the task and/or add --debug to the CLI command and compare to running locally, do you see any permission errors or missing REST API calls?

Furthermore, does swapping work if you deploy to an app hosted in Tenant A?

0 Votes 0 ·
Show more comments

Actually, the error I get when using the AzureAppServiceManage task is slightly different:
Error: Invalid Action selected to use with publish profile endpoint!. Supported actions are 'Start/Stop all continuous webjobs' & 'Install Extensions'

This is what my task looks like:

steps:
- task: AzureAppServiceManage@0
  displayName: 'Swap Slots: staging to prod'
  inputs:
    azureSubscription: 'samplesite-web (<guid>)'
    WebAppName: 'samplesite-web'
    ResourceGroupName: 'samplesite-web-rg'
    SourceSlot: staging
0 Votes 0 ·