Kenny_I
Kenny_I

Reputation: 2503

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://learn.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'

Upvotes: 1

Views: 13164

Answers (2)

ccoutinho
ccoutinho

Reputation: 4556

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)

Upvotes: 2

Krzysztof Madej
Krzysztof Madej

Reputation: 40603

You need to define a service connection. Pleae take a look here and then use name of this connection in this task.

Instead of

azureResourceManagerConnection: 'AzureRmPipeline-conn'
subscriptionId: '1111753a-501e-4e46-9aff-6120ed56333'

you should use:

ConnectedServiceName: 'AzureRmPipeline-conn'
subscriptionName: '1111753a-501e-4e46-9aff-6120ed56333'

I'm not sure if values gievn in your example are correct.

Upvotes: 3

Related Questions