Azure / Azure/azure-powershell

Set-AzApiManagement fails on APIM StandardV2 with Unrecognized Sku 'StandardV2'

Open
#29,797 2 comments 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
bug customer-reported Similar-Issue
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I'm experiencing an issue when updating an existing Azure API Management instance using the PowerShell Az module.
I have developed a PowerShell automation script that forces a refresh/update of a Key Vault certificate reference used by a custom domain configured on an APIM instance. The specific scenario involves custom domain certificates, but the issue appears to be unrelated to certificates themselves and instead occurs during the APIM update operation (Set-AzApiManagement).
The script works successfully against APIM v1 SKUs (Consumption and Developer) using the exact same logic and PowerShell commands.
However, when targeting an APIM instance running the StandardV2 SKU, the update operation fails with the following error:

`Unrecognized Sku 'StandardV2'`

The error is returned when executing:
```
$apim = Get-AzApiManagement -ResourceGroupName $ResourceGroupName -Name $ApiManagementName -ErrorAction Stop
$hostnameConfigParams = @{.....} # This is an example
$newTargetProxyConfig = New-AzApiManagementCustomHostnameConfiguration @hostnameConfigParams -ErrorAction Stop
$apim.ProxyCustomHostnameConfiguration = $newProxyConfigs
Set-AzApiManagement -InputObject $apim -ErrorAction Stop

### Issue script & Debug output

```PowerShell
PSMessageDetails :
Exception : System.ArgumentException: Unrecognized Sku 'StandardV2'
at Microsoft.Azure.Commands.ApiManagement.Helpers.Mappers.MapSku(String sku)
at Microsoft.Azure.Commands.ApiManagement.Helpers.Mappers.MapPsApiManagement(PsApiManagement apiManagement)
at Microsoft.Azure.Commands.ApiManagement.ApiManagementClient.SetApiManagementService(PsApiManagement apiManagement, Boolean createSystemResourceIdentity, String[] userAssignedIdentity)
at Microsoft.Azure.Commands.ApiManagement.Commands.SetAzureApiManagement.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.b__3_0(T c)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
TargetObject :
CategoryInfo : CloseError: (:) [Set-AzApiManagement], ArgumentException
FullyQualifiedErrorId : Microsoft.Azure.Commands.ApiManagement.Commands.SetAzureApiManagement
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 562
PipelineIterationInfo : {}
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.2.0
PSEdition Core
GitCommitId 7.2.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Binary 1.0 Automation.Sandbox.AssetManagement… Desk {Get-AutomationVariable, Set-AutomationV…

Script 16.0.0 Az Core,Desk

Script 5.5.0 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzCon…

Script 0.6.0 Az.Communication Core,Desk {Get-AzCommunicationService, Get-AzCommu…

Script 6.5.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Add-AzKeyVau…

Script 1.3.0 Az.ResourceGraph Core,Desk {Search-AzGraph, Get-AzResourceGraphQuer…

Binary 2.2.0 Microsoft.PowerShell.ThreadJob Desk Start-ThreadJob

Directory: C:\AzAt\Modules\11.2.0

ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 11.2.0 Az Core,Desk

Script 2.15.0 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzCon…

Script 2.0.0 Az.Advisor Core,Desk {Disable-AzAdvisorRecommendation, Enable…

Script 6.0.0 Az.Aks Core,Desk {Get-AzAksCluster, New-AzAksCluster, Rem…

Script 1.1.4 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspen…

Script 4.0.2 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToGateway, Add-Az…

Script 1.0.0 Az.App Core,Desk {Disable-AzContainerAppRevision, Enable-…

Script 1.3.0 Az.AppConfiguration Core,Desk {Get-AzAppConfigurationStore, Get-AzAppC…

Script 2.2.3 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, Get-AzApplic…

Script 1.0.0 Az.ArcResourceBridge Core,Desk {Get-AzArcResourceBridge, Get-AzArcResou…

Script 2.0.0 Az.Attestation Core,Desk {Get-AzAttestationPolicy, Set-AzAttestat…

Script 1.0.0 Az.Automanage Core,Desk {Get-AzAutomanageBestPractice, Get-AzAut…

Script 1.10.0 Az.Automation Core,Desk {Export-AzAutomationDscConfiguration, Ex…

Script 3.5.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccou…

Script 2.0.3 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeri…

Script 3.1.1 Az.Cdn Core,Desk {Clear-AzCdnEndpointContent, Clear-AzFro…

Script 2.0.0 Az.CloudService Core,Desk {Get-AzCloudService, Get-AzCloudServiceI…

Script 1.14.1 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzC…

Script 7.1.1 Az.Compute Core,Desk {Add-AzImageDataDisk, Add-AzVhd, Add-AzV…

Script 1.0.0 Az.ConfidentialLedger Core,Desk {Get-AzConfidentialLedger, New-AzConfide…

Script 4.0.0 Az.ContainerInstance Core,Desk {Add-AzContainerInstanceOutput, Get-AzCo…

Script 4.1.3 Az.ContainerRegistry Core,Desk {Connect-AzContainerRegistry, Get-AzCont…

Script 1.14.0 Az.CosmosDB Core,Desk {Get-AzCosmosDBAccount, Get-AzCosmosDBAc…

Script 1.1.0 Az.DataBoxEdge Core,Desk {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdge…

Script 1.7.1 Az.Databricks Core,Desk {Get-AzDatabricksAccessConnector, Get-Az…

Script 1.18.0 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFacto…

Script 1.0.3 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-…

Script 1.3.0 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, R…

Script 2.2.0 Az.DataProtection Core,Desk {Backup-AzDataProtectionBackupInstanceAd…

Script 1.0.1 Az.DataShare Core,Desk {New-AzDataShareAccount, Get-AzDataShare…

Script 1.1.0 Az.DeploymentManager Core,Desk {Get-AzDeploymentManagerArtifactSource, …

Script 4.3.0 Az.DesktopVirtualization Core,Desk {Disconnect-AzWvdUserSession, Expand-AzW…

Script 1.1.0 Az.DevCenter Core,Desk {Deploy-AzDevCenterUserEnvironment, Get-…

Script 1.0.2 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDt…

Script 1.2.0 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConf…

Script 1.6.0 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTo…

Script 4.2.0 Az.EventHub Core,Desk {New-AzEventHubAuthorizationRuleSASToken…

Script 1.10.0 Az.FrontDoor Core,Desk {New-AzFrontDoor, Get-AzFrontDoor, Set-A…

Script 4.0.7 Az.Functions Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAva…

Script 6.1.0 Az.HDInsight Core,Desk {Add-AzHDInsightClusterIdentity, Add-AzH…

Script 2.0.0 Az.HealthcareApis Core,Desk {Get-AzHealthcareApisService, Get-AzHeal…

Script 2.7.5 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubCo…

Script 5.1.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Add-AzKeyVau…

Script 2.3.0 Az.Kusto Core,Desk {Add-AzKustoClusterLanguageExtension, Ad…

Script 1.0.0 Az.LoadTesting Core,Desk {Get-AzLoad, New-AzLoad, Remove-AzLoad, …

Script 1.5.0 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-…

Script 1.1.3 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzM…

Script 1.0.0 Az.MachineLearningServices Core,Desk {Get-AzMLServiceQuota, Get-AzMLServiceUs…

Script 1.4.1 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationA…

Script 1.2.0 Az.ManagedServiceIdentity Core,Desk {Get-AzSystemAssignedIdentity, Get-AzUse…

Script 3.0.0 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, Get-Az…

Script 2.0.0 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Invoke-AzMarket…

Script 1.1.2 Az.Media Core,Desk {Sync-AzMediaServiceStorageKey, Set-AzMe…

Script 2.2.0 Az.Migrate Core,Desk {Get-AzMigrateDiscoveredServer, Get-AzMi…

Script 5.0.0 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, R…

Script 1.1.1 Az.MySql Core,Desk {Get-AzMySqlConfiguration, Get-AzMySqlCo…

Script 7.3.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationC…

Script 1.0.0 Az.NetworkCloud Core,Desk {Deploy-AzNetworkCloudCluster, Disable-A…

Script 1.1.2 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificati…

Script 3.2.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityL…

Script 1.6.4 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, G…

Script 1.1.0 Az.PostgreSql Core,Desk {Get-AzPostgreSqlConfiguration, Get-AzPo…

Script 2.0.0 Az.PowerBIEmbedded Core,Desk {Resume-AzPowerBIEmbeddedCapacity, Suspe…

Script 1.0.4 Az.PrivateDns Core,Desk {Get-AzPrivateDnsZone, Remove-AzPrivateD…

Script 6.7.0 Az.RecoveryServices Core,Desk {Add-AzRecoveryServicesAsrReplicationPro…

Script 1.8.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-A…

Script 1.2.0 Az.RedisEnterpriseCache Core,Desk {Export-AzRedisEnterpriseCache, Get-AzRe…

Script 2.0.0 Az.Relay Core,Desk {Get-AzRelayAuthorizationRule, Get-AzRel…

Script 1.2.0 Az.ResourceMover Core,Desk {Add-AzResourceMoverMoveResource, Get-Az…

Script 6.13.0 Az.Resources Core,Desk {Export-AzResourceGroup, Export-AzTempla…

Script 1.5.1 Az.Security Core,Desk {Get-AzSecuritySolution, Get-AzSecurityS…

Script 3.1.1 Az.SecurityInsights Core,Desk {Get-AzSentinelAlertRule, Get-AzSentinel…

Script 3.0.0 Az.ServiceBus Core,Desk {New-AzServiceBusAuthorizationRuleSASTok…

Script 3.3.2 Az.ServiceFabric Core,Desk {Add-AzServiceFabricClientCertificate, A…

Script 2.0.0 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSig…

Script 4.13.0 Az.Sql Core,Desk {Add-AzSqlDatabaseToFailoverGroup, Add-A…

Script 2.1.0 Az.SqlVirtualMachine Core,Desk {Get-AzAvailabilityGroupListener, Get-Az…

Script 2.2.3 Az.StackHCI Core,Desk {Add-AzStackHCIVMAttestation, Disable-Az…

Script 6.1.0 Az.Storage Core,Desk {Add-AzRmStorageContainerLegalHold, Add-…

Script 1.3.0 Az.StorageMover Core,Desk {Get-AzStorageMover, Get-AzStorageMoverA…

Script 2.1.1 Az.StorageSync Core,Desk {Get-AzStorageSyncCloudEndpoint, Get-AzS…

Script 2.0.0 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsCluster, Get-AzStr…

Script 1.0.0 Az.Support Core,Desk {Get-AzSupportService, Get-AzSupportProb…

Script 3.0.5 Az.Synapse Core,Desk {Add-AzSynapseDataFlowDebugSessionPackag…

Script 1.2.2 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpo…

Script 3.1.2 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServiceP…

Directory: C:\app\runtimes\win\lib\net6.0\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Manifest 7.0.0.0 CimCmdlets Core {Get-CimAssociatedInstance, Get-CimClass…

Manifest 7.0.0.0 Microsoft.PowerShell.Diagnostics Core {Get-WinEvent, New-WinEvent, Get-Counter}

Manifest 7.0.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}

Manifest 7.0.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Get-Clipboa…

Manifest 7.0.0.0 Microsoft.PowerShell.Security Core {Get-Acl, Set-Acl, Get-PfxCertificate, G…

Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core {Export-Alias, Get-Alias, Import-Alias, …

Manifest 7.0.0.0 Microsoft.WSMan.Management Core {Disable-WSManCredSSP, Enable-WSManCredS…

Script 7.0.0.0 PSDiagnostics Core {Disable-PSTrace, Disable-PSWSManCombine…

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.0.1 Microsoft.PowerShell.Operation.Val… Desk {Get-OperationValidation, Invoke-Operati…

Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-PackageP…

Script 3.4.0 Pester Desk {Describe, Context, It, Should…}

Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Modul…

Script 2.0.0 beta2 PSReadline Desk {Get-PSReadLineKeyHandler, Set-PSReadLin…

Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Manifest 2.0.1.0 Appx Core,Desk {Add-AppxPackage, Get-AppxPackage, Get-A…

Manifest 1.0.0.0 BranchCache Core,Desk {Add-BCDataCacheExtension, Clear-BCCache…

Manifest 1.0.0.0 DirectAccessClientComponents Core,Desk {Disable-DAManualEntryPointSelection, En…

Manifest 1.0.0.0 DnsClient Core,Desk {Resolve-DnsName, Clear-DnsClientCache, …

Manifest 1.0.0.0 EventTracingManagement Core,Desk {Start-EtwTraceSession, New-EtwTraceSess…

Script 1.0.0.0 LAPS Core,Desk {Find-LapsADExtendedRights, Get-LapsADPa…

Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics Core,Desk {Get-WinEvent, Get-Counter, Import-Count…

Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts Core,Desk {Add-LocalGroupMember, Disable-LocalUser…

Manifest 3.1.0.0 Microsoft.PowerShell.Management Core,Desk {Add-Content, Clear-Content, Clear-ItemP…

Manifest 1.0 MMAgent Core,Desk {Disable-MMAgent, Enable-MMAgent, Set-MM…

Manifest 2.0.0.0 NetAdapter Core,Desk {Disable-NetAdapter, Disable-NetAdapterB…

Manifest 1.0.0.0 NetConnection Core,Desk {Get-NetConnectionProfile, Set-NetConnec…

Manifest 1.0.0.0 NetEventPacketCapture Core,Desk {New-NetEventSession, Remove-NetEventSes…

Manifest 2.0.0.0 NetLbfo Core,Desk {Add-NetLbfoTeamMember, Add-NetLbfoTeamN…

Manifest 1.0.0.0 NetNat Core,Desk {Get-NetNat, Get-NetNatExternalAddress, …

Manifest 2.0.0.0 NetQos Core,Desk {Get-NetQosPolicy, Set-NetQosPolicy, Rem…

Manifest 2.0.0.0 NetSecurity Core,Desk {Get-DAPolicyChange, New-NetIPsecAuthPro…

Manifest 1.0.0.0 NetSwitchTeam Core,Desk {New-NetSwitchTeam, Remove-NetSwitchTeam…

Manifest 1.0.0.0 NetTCPIP Core,Desk {Get-NetIPAddress, Get-NetIPInterface, G…

Manifest 1.0.0.0 NetworkConnectivityStatus Core,Desk {Get-DAConnectionStatus, Get-NCSIPolicyC…

Manifest 1.0.0.0 NetworkTransition Core,Desk {Add-NetIPHttpsCertBinding, Disable-NetD…

Manifest 1.0 NFS Core,Desk {Get-NfsMappedIdentity, Get-NfsNetgroup,…

Manifest 1.0.0.0 PcsvDevice Core,Desk {Get-PcsvDevice, Start-PcsvDevice, Stop-…

Manifest 1.0.0.0 PnpDevice Core,Desk {Get-PnpDevice, Get-PnpDeviceProperty, E…

Manifest 1.0.0.0 ScheduledTasks Core,Desk {Get-ScheduledTask, Set-ScheduledTask, R…

Manifest 2.0.0.0 SecureBoot Core,Desk {Confirm-SecureBootUEFI, Set-SecureBootU…

Manifest 2.0.0.0 SmbShare Core,Desk {Get-SmbShare, Remove-SmbShare, Set-SmbS…

Manifest 2.0.0.0 SmbWitness Core,Desk {Get-SmbWitnessClient, Move-SmbWitnessCl…

Manifest 2.0.0.0 SoftwareInventoryLogging Core,Desk {Get-SilComputer, Get-SilComputerIdentit…

Manifest 2.0.0.0 Storage Core,Desk {Add-InitiatorIdToMaskingSet, Add-Partit…

Manifest 1.0.0.0 Wdac Core,Desk {Get-OdbcDriver, Set-OdbcDriver, Get-Odb…

Script 1.0 WindowsErrorReporting Core,Desk {Enable-WindowsErrorReporting, Disable-W…

Manifest 1.0.0.0 WindowsUpdate Core,Desk Get-WindowsUpdateLog

Manifest 1.0.0.2 WindowsUpdateProvider Core,Desk {Get-WUAVersion, Get-WULastInstallationD…
```

### Error output

```PowerShell
Unrecognized Sku 'StandardV2'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.