Closed Chocrates closed 3 years ago
Looks like Remove cmdlet was supplied with incorrect parameters
HTTP Method:
DELETE
Absolute Uri:
https://management.azure.com/subscriptions/<snip>/resourceGroups/@{$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0;
parameters=}.parameters.hubPeeringResourceGroup/providers/Microsoft.Network/virtualNetworks/@{$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0;
parameters=}.parameters.hubVNETName/virtualNetworkPeerings/<snip>?api-version=2019-02-01
From this URI it looks like ResourceGroupName was supplied as @{$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0; parameters=}.parameters.hubPeeringResourceGroup
and VirtualNetworkName as @{$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0; parameters=}.parameters.hubVNETName
. Seems like instead of passing value from hashtable the whole code is passed as a string.
Could you please double-check how Remove cmdlet is invoked?
Can reproduce with ARMClient
PS C:\Users\v-anevse> ARMClient.exe delete "https://management.azure.com/subscriptions/947d47b4-7883-4bb9-9d85-c5e8e2f572ce/resourceGroups/@{`$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0;parameters=}.parameters.hubPeeringResourceGroup/providers/Microsoft.Network/virtualNetworks/@{`$schema=https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json%23; contentVersion=1.0.0.0;parameters=}.parameters.hubVNETName/virtualNetworkPeerings/test-peering?api-version=2019-02-01"
{
"error": {
"code": "InvalidApiVersionParameter",
"message": "The api-version '2019-02-01' is invalid. The supported versions are '2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."
}
}
Close this issue that the latest version is using API 2020-07-01.
Description
Running Remove-AzVirtualNetworkPeering Results in this error:
With $DebugPreference="Continue" We can see that the REST Url ends with
?api-version=2019-02-01
Steps to reproduce
Create Two Vnets with distinct IP ranges. Peer them together
Environment data
Module versions
Debug output