1

I have a ServiceBuswithQueue ARM template that has the output section like this below:

  "outputs": {
    "serviceBusNamespaceName": {
      "type": "string",
      "value": "[parameters('serviceBusNamespaceName')]"
    },
    "namespaceConnectionString": {
      "type": "string",
      "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]"
    },
    "sharedAccessPolicyPrimaryKey": {
      "type": "string",
      "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryKey]"
    },
    "serviceBusQueueName": {
      "type": "string",
      "value": "[parameters('serviceBusQueueName')]"
    }
  }

For that I Created the Continuous Integration (CI) and Continuous Deployment (CD) in VSTS, In CD I have used the PowerShell task to deploy the above ARM template. But I want to pass the output of this ARM template like "$(serviceBusQueueName)" to input parameter of the next ARM template in Continuous Deployment.

In know the above scenario can achieved using ARM outputs in between the two ARM task in Continuous Deployment. But I don’t want it because currently I am using the PowerShell task to deploy the ARM template.

Before posting this question, I was researched and find the following links but those are not helpful to resolve my issue.

Azure ARM templates - using the output of other deployments

How do I use ARM 'outputs' values another release task?

Can anyone please suggest me how to resolve the above issue?

Pradeep
  • 5,101
  • 14
  • 68
  • 140

2 Answers2

1

You can override parameters by specifying corresponding parameters.

Override template parameter in the script

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
1
# Start the deployment
Write-Host "Starting deployment...";
$outputs = New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Mode Incremental -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;

foreach ($key in $outputs.Outputs.Keys){
    $type = $outputs.Outputs.Item($key).Type
    $value = $outputs.Outputs.Item($key).Value
    Write-Host "##vso[task.setvariable variable=$key;]$value"
}

You can display all the environment variables in a subsequent script:

Write-Host "Environment variables:"
gci env:* | sort-object name
Gokhan
  • 51
  • 5