'Azure DevOps for ARM: Task failed while initializing. Error: Input required: ConnectedServiceName"

I'm trying to deploy simple ARM, but failing. What could be wrong?

I created "AzureRmPipeline-conn" from "ARM template deployment" feature.

I get error: "##[error]Error: Task failed while initializing. Error: Input required: ConnectedServiceName"

//Example //https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-tutorial- pipeline

//YML
- task: AzureResourceGroupDeployment@2
  inputs:
    deploymentScope: 'Resource Group'
    azureResourceManagerConnection: 'AzureRmPipeline-conn'
    subscriptionId: '1111753a-501e-4e46-9aff-6120ed56333'
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'KensTestRG'
    location: 'North Europe'
    templateLocation: 'Linked artifact'
    csmFile: '\ARMTemplates\CreateSQLServerARM\azuredeploy.json'
    deploymentMode: 'Incremental'


Solution 1:[1]

I was having this issue because I was passing the service connection name as a pipeline variable, named azureSubscription, but keeping its value secret. It started working when I stopped hiding it. The code I am using for the deployment of an Azure Web App is the following:

- task: AzureResourceGroupDeployment@2
  inputs:
    azureSubscription: $(azureSubscription)
    action: 'Create Or Update Resource Group'
    resourceGroupName: $(resourceGroupName)
    location: $(location)
    templateLocation: 'Linked artifact'
    csmFile: 'ARM\Templates\webapp.template.json'
    csmParametersFile: 'ARM\parameters\webapp.parameters.json'
    deploymentMode: $(deploymentMode)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ccoutinho