Reputation: 21
I'm trying to build and deploy a project to an Azure Web App. I've already setup the Azure Web App. For the build pipeline I've taken the following build YAML template from Microsoft:
I don't know what {{ azureRmConnection.Id }}
in the variables
section of the YAML template refers to or how to use it.
The double-brace ({{ }}
) syntax is used to evaluate expressions, whereas pipeline variables are referenced with dollar ($()
) syntax. So I think azureRmConnection
is something the build should already have access to rather than requiring a pipeline variable to be set.
Searched Microsoft's docs, Google and StackOverflow.
Looked on my Azure Web App to try to find anything obvious.
Added the Web App's subscription Id as a variable reference to the pipeline with the name azureRmConnection.Id
.
Referenced Ansible YAML Syntax docs regarding the double-brace syntax: https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: '{{ azureRmConnection.Id }}'
I expect the build to have a valid azureRmConnection.Id
and therefore not fail due to it being missing or invalid.
The build is failing with the following error:
There was a resource authorization issue: "The pipeline is not valid. Job Deploy: Step input azureSubscription references service connection {{ azureRmConnection.Id }} which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
Upvotes: 0
Views: 632
Reputation: 21
I tried creating a new pipeline using the 'Node.js React Web App to Linux on Azure' wizard. I did think I'd tried that already but I must have used a different one previously. This had several more stages in it.
The wizard allowed me to choose my Azure Web App and Azure Subscription from dropdown menus.
The variables look like this in the YAML now:
variables:
azureSubscription: '1234xx56-xx7x-[...]'
webAppName: 'my-azure-web-app-name'
environmentName: 'my-azure-web-app-name'
azureSubscription
is my Azure Subscription ID.
webAppName
is the name of my Azure Web App that I had previously setup on the Azure Portal.
The build has now run successfully.
Upvotes: 0
Reputation: 72211
what you need to do is follow this link and create an AzureRm service connection and use its name in place of that placeholder:
azureSubscription: 'my-azurerm-connection-name-goes-here'
Upvotes: 1