Error message

There was a resource authorization issue: “The pipeline is not valid. Job Job: Step AzureWebApp input azureSubscription references service connection Azure-Sub which could not be found. The service connection does not exist, has been disabled or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."

We can retrieve a few details from the error message:

  • The task is named AzureWebApp
  • The field name is azureSubscription
  • The name of the Azure subscription is Azure-Sub

Possible causes

There are a few possible causes: A. The subscription has been disabled or does not exist B. The subscription has not been connected to the pipeline

This article focuses on outlining a solution for the second case, B.

Solution: connect the pipeline to the subscription

Steps:

  1. Navigate to the pipeline on Azure Devops
  2. Go to Project Settings
  3. Select Service connections (see screenshot below) screenshot
  4. Create a new service connection
  5. Specify Azure Resource Manager
  6. Follow the instructions to connect the subscription. This may require logging into Azure.
  7. If the service connection was given a name, ensure this is the same name specified in the azure-pipelines.yml e.g if the connection is named Random-Sub, then the pipelines yaml should look like this:
- task: AzureWebApp@1
    inputs:
      azureSubscription: 'Random-Sub'