Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to assign version set to an existing API using Set-AzApiManagementApi #10068

Closed
tehnoonr opened this issue Sep 19, 2019 · 1 comment
Closed
Assignees

Comments

@tehnoonr
Copy link

tehnoonr commented Sep 19, 2019

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


Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
PSVersion                      5.1.17763.592                                                                                                                                                                                                                     
PSEdition                      Desktop                                                                                                                                                                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                           
BuildVersion                   10.0.17763.592                                                                                                                                                                                                                    
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                   
WSManStackVersion              3.0                                                                                                                                                                                                                               
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                               
SerializationVersion           1.1.0.1             

Module versions

cript     1.1.0      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer...}                                                                  
Script     1.3.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup...}                                                                     
Script     1.2.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup...}                                                                     
Script     1.1.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup...}                                                                     
Script     1.0.0      Az.ApiManagement                    {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementCustomHostnameConfiguration, New-AzApiManagementSystemCertificate...}  

Debug output


Error output


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants