I created VSTS Task Group with Azure Powershell Task Inline Script with Four Parameters. I have added this Task Group to Release Definition and configured parameters. When i try to release it failed with following error
2018-03-23T10:28:42.2811600Z ##[error]At C:\Users\buildguest\AppData\Local\Temp\6e927620-8956-47d6-b926-00d9177a4c26.ps1:2 char:9 + [String] Container-Service, + ~ Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
At C:\Users\buildguest\AppData\Local\Temp\6e927620-8956-47d6-b926-00d9177a4c26.ps1:2 char:9 + [String] Container-Service, + ~ Missing ')' in function parameter list.
Here is Azure Powershell Script
Param(
[String] $(apiManagementRg),
[String] $(apiManagementName),
[String] $(swaggerUrl),
[String] $(basePath),
[String] $(apiId)
)
$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName $(apiManagementRg) -ServiceName $(apiManagementName)
Import-AzureRmApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationUrl $(swaggerUrl) -Path $(basePath) -ApiId $(apiId)
Release Definition Screenshot Release Definition
It's mainly caused by the PowerShell script syntax errors.
Based on your script, it seems
$(apiManagementRg)
,$(apiManagementName)
,$(swaggerUrl)
,$(basePath)
and$(apiId)
are variables defined in your release definition.To use the user defined variables from the release definition into Powershell script parameters, you should specify the user defined variables in Script Arguments to pass the values into your PowerShell parameters.
Detail steps as below:
Re-create task group with Azure PowerShell Task as below:
Inline Script:
Script Arguments: