You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is currently not possible to assign a version set to an existing API using PowerShell. You can create or import new APIs using PowerShell and assign the version set at creation time which works as expected. However, if you try to assign a version set to an existing API using Set-AzApiManagementApi, the JSON payload of the REST call does not include the apiVersionSetId property and the version set does not get updated.
Steps to reproduce
#Import the Module
Import-Module Az
#Connect to Azure
Connect-AzAccount
#Create the context
$context = New-AzApiManagementContext -ResourceGroupName "APIM-RESOURCES" -ServiceName "tehnoonr-APIM"
#Version sets
#Create a new version set and assign to an existing API
$versionSet = New-AzApiManagementApiVersionSet -Context $context -Name "Echo API Version Set" -Scheme Segment -Description "version set sample"
$api = Get-AzApiManagementApi -Context $context -ApiId "echo-api"
$api.ApiVersionSetId = $versionSet.ApiVersionSetId
$api.ApiVersion = "v1"
$api.ApiVersionSetDescription = $versionSet.Description
$api | Set-AzApiManagementApi -Context $context
Description
It is currently not possible to assign a version set to an existing API using PowerShell. You can create or import new APIs using PowerShell and assign the version set at creation time which works as expected. However, if you try to assign a version set to an existing API using Set-AzApiManagementApi, the JSON payload of the REST call does not include the apiVersionSetId property and the version set does not get updated.
Steps to reproduce
#Import the Module
Import-Module Az
#Connect to Azure
Connect-AzAccount
#Create the context
$context = New-AzApiManagementContext -ResourceGroupName "APIM-RESOURCES" -ServiceName "tehnoonr-APIM"
#Version sets
#Create a new version set and assign to an existing API
$versionSet = New-AzApiManagementApiVersionSet -Context $context -Name "Echo API Version Set" -Scheme Segment -Description "version set sample"
$api = Get-AzApiManagementApi -Context $context -ApiId "echo-api"
$api.ApiVersionSetId = $versionSet.ApiVersionSetId
$api.ApiVersion = "v1"
$api.ApiVersionSetDescription = $versionSet.Description
$api | Set-AzApiManagementApi -Context $context
Environment data
Module versions
Debug output
Error output
The text was updated successfully, but these errors were encountered: