user12585721
user12585721

Reputation:

Trying to deploy to Azure using GitHub actions

I'm using the following YAML to deploy to an Azure App Service:

- name: dotnet publish
  run: dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' 

# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using publish profile credentials'
  uses: azure/webapps-deploy@v2
  with: 
    app-name: ${{ env.AZURE_WEBAPP_NAME }} 
    publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE  }} 
    package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
      

To add the AZURE_WEBAPP_PUBLISH_PROFILE I created a secret and pasted the publish profile that I downloaded from:

App Service -> Get Publish Profile

Which gave me a file named myapp.PublishSettings, and is an XML file.

When I try to run this, I get the error:

Error: Deployment Failed with Error: Error: Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app.

What am I doing wrong or missing?

Upvotes: 6

Views: 8446

Answers (2)

U.Shaba
U.Shaba

Reputation: 622

In addition to the answer before this one, AZURE_WEBAPP_NAME specified on your workflow must be same as the name given to App Service

Upvotes: 3

Doris Lv
Doris Lv

Reputation: 3398

It's obviously that the value of AZURE_WEBAPP_PUBLISH_PROFILE in your GitHub repository is not correct. Here is the official document you could follow with: Deploy to App Service using GitHub Actions

There are two things you should check:

1. Make sure you copy the whole content of publish profile. Do not change anything.

2. Check if the publish profile is downloaded from your AZURE_WEBAPP_NAME.

Upvotes: 4

Related Questions