Reputation: 1779
I am new to Azure and I running problems after problems, but still I think I have come far. I created the credentials using this command:
az ad sp create-for-rbac --name "myApp" --role contributor --scopes /subscriptions/{sub-id}/resourceGroups/{SomeRes} --sdk-auth
Copied and pasted at the secrets on github.
And then the previous tasks run well, but it fails at this task: Run Azure webapp deploy action using azure credentials
# Run dotnet build and publish
- name: dotnet build and publish
working-directory: ./myDemoApp
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release -o '/someDemoApp'
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using azure credentials'
uses: azure/webapps-deploy@v2
with:
app-name: SomeDemoApp
package: './myDemoApp/someDemoApp'
- name: logout
run: |
az logout
And it returns this error:
Error: Deployment Failed with Error: Error: Resource SomeDemoApp doesn't exist.
How can I configure it so that I can deploy this?
UPDATE:
Fixed the first error by creating the app, but now it fails to find the package and returns this error:
Error: Deployment Failed with Error: Error: No package found with specified pattern: ./myDemoApp/someDemoApp
Where can I find this package location, or to which of my configuration is related?
Upvotes: 1
Views: 6751
Reputation: 1394
This error simply means that you are trying to deploy your code to a web app, but haven't created a web app in Azure (Why it doesn't exist).
You can follow this tutorial from Microsoft to deploy your web app manually. (Make sure the web app name is exactly the same as what you have in your yaml) : https://learn.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=netcore31&pivots=platform-linux
Running your pipeline after deploying the web app should then work.
Once you become more comfortable with this approach, you can add Infrastructure as code to your yaml pipeline to automatically spin up you web up if it does not exist using ARM templates and the AzureResourceManagerTemplateDeployment@3 task in your pipeline.
Upvotes: 1