azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Set-AzVirtualNetwork does not work while VNet Peers exist

Open trindels opened this issue 6 years ago • 19 comments

Description

Set-AzVirtualNetwork produces error when VNet Peering exists with another VNet. VNet Peering is Cross-Subscription, within same Tenant. User running Set-AzVirtualNetwork does not have access to peered VNet. VNet Peering settings are not being changed.

Steps to reproduce

$vnetName = "VnetName"
$rgName = "RgName"
$subnetName = "SubnetName"
$subnetPrefix = "10.10.10.0/24"

$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgName
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix $subnetPrefix -VirtualNetwork $vnet
$vnet | Set-AzVirtualNetwork

Environment data

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

Module versions

Script     2.2.1      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     1.1.1      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendati...
Script     2.0.1      Az.Aks                              {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, ...
Script     0.2.0      Az.AlertsManagement                 {Get-AzAlert, Get-AzAlertObjectHistory, Update-AzAlertStat...
Script     1.1.4      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServic...
Script     2.1.0      Az.ApiManagement                    {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiTo...
Script     1.0.0      Az.AppConfiguration                 {Get-AzAppConfigurationStore, Get-AzAppConfigurationStoreK...
Script     1.1.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Rem...
Script     0.1.8      Az.Attestation                      {New-AzAttestation, Get-AzAttestation, Remove-AzAttestatio...
Script     1.4.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHyb...
Script     3.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAcc...
Script     2.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollme...
Script     0.2.0      Az.Blockchain                       {Get-AzBlockchainConsortium, Get-AzBlockchainMember, Get-A...
Script     0.2.13     Az.Blueprint                        {Get-AzBlueprint, Get-AzBlueprintAssignment, New-AzBluepri...
Script     1.6.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfil...
Script     1.6        Az.CloneVirtualMachine              New-AzVMClone
Script     1.8.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc...
Script     4.6.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAv...
Script     0.7.0      Az.Compute.ManagedService           ConvertTo-AzVhd
Script     0.1.0      Az.ConnectedKubernetes              {Get-AzConnectedKubernetes, New-AzConnectedKubernetes, Rem...
Script     0.2.0      Az.ConnectedMachine                 {Connect-AzConnectedMachine, Get-AzConnectedMachine, Get-A...
Script     0.7.0      Az.Consumption                      {Get-AzConsumptionBudget, Get-AzConsumptionMarketplace, Ge...
Script     1.0.3      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzCont...
Script     2.0.0      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-...
Script     0.2.0      Az.CosmosDB                         {Get-AzCosmosDBSqlContainer, Get-AzCosmosDBSqlContainerThr...
Script     0.1.0      Az.CustomProviders                  {Get-AzCustomProvider, Get-AzCustomProviderAssociation, Ne...
Script     0.1.1      Az.DataBox                          {Get-AzDataBoxJob, Get-AzDataBoxCredential, Stop-AzDataBox...
Script     1.1.0      Az.DataBoxEdge                      {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzD...
Script     1.0.1      Az.Databricks                       {Get-AzDatabricksVNetPeering, Get-AzDatabricksWorkspace, N...
Script     1.11.1     Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFa...
Script     1.0.2      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalytic...
Script     1.3.0      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeSt...
Script     0.7.4      Az.DataMigration                    {New-AzDataMigrationDatabaseInfo, New-AzDataMigrationConne...
Script     1.0.0      Az.DataShare                        {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-Az...
Script     0.1.0      Az.DedicatedHsm                     {Get-AzDedicatedHsm, New-AzDedicatedHsm, Remove-AzDedicate...
Script     1.1.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentMa...
Script     2.0.1      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-A...
Script     0.9.0      Az.DeviceProvisioningServices       {New-AzIoTDeviceProvisioningService, Get-AzIoTDeviceProvis...
Script     0.7.3      Az.DevSpaces                        {Get-AzDevSpacesController, New-AzDevSpacesController, Rem...
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic...
Script     0.1.0      Az.DigitalTwins                     {Get-AzDigitalTwinsEndpoint, Get-AzDigitalTwinsInstance, N...
Script     1.1.2      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRe...
Script     1.3.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGr...
Script     1.7.1      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzE...
Script     1.6.1      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove...
Script     2.0.0      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Ge...
Script     0.10.8     Az.GuestConfiguration               {Get-AzVMGuestPolicyStatus, Get-AzVMGuestPolicyStatusHistory}
Script     0.2.0      Az.HanaOnAzure                      {Get-AzSapMonitor, Get-AzSapMonitorProviderInstance, New-A...
Script     4.1.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wa...
Script     1.1.0      Az.HealthcareApis                   {New-AzHealthcareApisService, Remove-AzHealthcareApisServi...
Script     0.1.1      Az.HPCCache                         {Get-AzHpcCacheSku, Get-AzHpcCacheUsageModel, Get-AzHpcCac...
Script     0.1.2      Az.ImageBuilder                     {Get-AzImageBuilderRunOutput, Get-AzImageBuilderTemplate, ...
Script     1.0.0.1    Az.ImageBuilder.Tools               {Get-AIBBuildStatus, Initialize-AzureImageBuilder, Invoke-...
Script     0.1.0      Az.ImportExport                     {Get-AzImportExport, Get-AzImportExportBitLockerKey, Get-A...
Script     0.7.0      Az.Insights                         {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.8.0      Az.IotCentral                       {New-AzIotCentralApp, Get-AzIotCentralApp, Set-AzIotCentra...
Script     2.7.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-A...
Script     3.1.0      Az.KeyVault                         {Add-AzManagedHsmKey, Get-AzManagedHsmKey, Remove-AzManage...
Script     0.1.0      Az.KubernetesConfiguration          {Get-AzKubernetesConfiguration, New-AzKubernetesConfigurat...
Script     1.0.0      Az.Kusto                            {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabaseP...
Script     1.4.0      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccou...
Script     1.1.3      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssocia...
Script     0.7.0      Az.MachineLearningCompute           {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-AzMlOpClust...
Script     1.1.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzM...
Script     0.7.3      Az.ManagedServiceIdentity           {New-AzUserAssignedIdentity, Get-AzUserAssignedIdentity, R...
Script     2.0.0      Az.ManagedServices                  {Get-AzManagedServicesAssignment, New-AzManagedServicesAss...
Script     0.7.2      Az.ManagementPartner                {Get-AzManagementPartner, New-AzManagementPartner, Update-...
Script     0.7.3      Az.Maps                             {Get-AzMapsAccount, New-AzMapsAccount, Remove-AzMapsAccoun...
Script     0.2.0      Az.MariaDb                          {Get-AzMariaDbConfiguration, Get-AzMariaDbConnectionString...
Script     0.2.0      Az.Marketplace                      {Get-AzMarketplacePrivateStore, Get-AzMarketplacePrivateSt...
Script     1.0.2      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.1.1      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get...
Script     0.1.0      Az.Migrate                          {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMi...
Script     0.1.4      Az.MixedReality                     {Get-AzSpatialAnchorsAccount, Get-AzSpatialAnchorsAccountK...
Script     2.2.0      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.1.0      Az.MonitoringSolutions              {Get-AzMonitorLogAnalyticsSolution, New-AzMonitorLogAnalyt...
Script     0.2.0      Az.MySql                            {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Ge...
Script     0.2.0      Az.NetAppFiles                      {Get-AzNetAppFilesAccount, New-AzNetAppFilesAccount, Remov...
Script     4.3.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-Az...
Script     1.1.1      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorization...
Script     2.3.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-...
Script     0.2.0      Az.Peering                          {Get-AzPeering, Get-AzPeerAsn, New-AzPeerAsn, New-AzPeerin...
Script     1.3.1      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSu...
Script     0.1.0      Az.Portal                           {Get-AzPortalDashboard, New-AzPortalDashboard, Remove-AzPo...
Script     0.2.0      Az.PostgreSql                       {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnection...
Script     1.1.2      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa...
Script     1.0.3      Az.PrivateDns                       {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPriv...
Script     0.7.0      Az.Profile                          {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     3.0.1      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServi...
Script     1.4.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheSchedul...
Script     1.0.3      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNa...
Script     0.9.0      Az.Reservations                     {Get-AzReservationOrder, Get-AzReservation, Get-AzReservat...
Script     0.7.7      Az.ResourceGraph                    Search-AzGraph
Script     0.1.0      Az.ResourceMover                    {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveC...
Script     3.0.1      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR...
Script     0.7.4      Az.Search                           {New-AzSearchService, Get-AzSearchService, Set-AzSearchSer...
Script     0.8.0      Az.Security                         {Get-AzSecurityAlert, Set-AzSecurityAlert, Get-AzSecurityA...
Script     1.4.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set...
Script     2.2.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzServiceFabric...
Script     1.2.0      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSig...
Script     0.2.0      Az.SpringCloud                      {Deploy-AzSpringCloudApp, Get-AzSpringCloud, Get-AzSpringC...
Script     2.12.0     Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlData...
Script     1.1.0      Az.SqlVirtualMachine                {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM...}
Script     0.1.0      Az.StackEdge                        {Get-AzStackEdgeJob, Get-AzStackEdgeDevice, Invoke-AzStack...
Script     0.4.0      Az.StackHCI                         {Register-AzStackHCI, Unregister-AzStackHCI, Test-AzStackH...
Script     3.0.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor...
Script     1.3.0      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSync...
Manifest   1.0.7      Az.StorageTable                     {Add-AzStorageTableRow, Get-AzStorageTableRowAll, Get-AzSt...
Script     1.0.1      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefau...
Script     0.8.0      Az.Subscription                     {Update-AzSubscription, New-AzSubscriptionAlias, Get-AzSub...
Script     1.0.0      Az.Support                          {Get-AzSupportService, Get-AzSupportProblemClassification,...
Script     0.4.0      Az.Synapse                          {Get-AzSynapseSparkJob, Stop-AzSynapseSparkJob, Submit-AzS...
Script     0.7.0      Az.Tags                             {Remove-AzTag, Get-AzTag, New-AzTag}
Script     0.2.0      Az.TimeSeriesInsights               {Get-AzTimeSeriesInsightsAccessPolicy, Get-AzTimeSeriesIns...
Script     0.1.1      Az.Tools.Installer                  {Install-AzModule, Uninstall-AzModule, Update-AzModule}
Script     0.1.0      Az.Tools.Migration                  {Disable-AzUpgradeDataCollection, Enable-AzUpgradeDataColl...
Script     1.0.4      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTraf...
Script     0.7.0      Az.UsageAggregates                  Get-UsageAggregates
Script     0.1.0      Az.VMWare                           {Get-AzVMWareAuthorization, Get-AzVMWareCluster, Get-AzVMW...
Script     2.1.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServ...

Debug output


DEBUG: 6:26:46 PM - SetAzureVirtualNetworkCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 6:26:46 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant:
 'f65d02be-9231-4769-9120-8d7f799652db'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'f65d02be-9231-4769-9120-8d7f799652db',
UserId: '[email protected]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : b115b9ce-b165-4b59-b46a-70ca93250c82
accept-language               : en-US

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-request-id               : fa70dd8c-7ab9-4661-a230-034ea8f66f01
x-ms-correlation-request-id   : 8bb9bc0f-80ff-4316-bc34-bd6a2439198d
x-ms-arm-service-request-id   : 570c5dbf-f307-401d-9b5d-0c7c05a667dd
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
ETag                          : W/"d051b686-b68a-4387-b8fa-a440211f4bad"
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:8bb9bc0f-80ff-4316-bc34-bd6a2439198d
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:45 GMT

Body:
{
  "name": "MBSO-Vnet-Prod-Ext-WestUS2",
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
  "type": "Microsoft.Network/virtualNetworks",
  "location": "westus2",
  "tags": {
    "BULC": "MBSO",
    "Cost Center": "MBSO-xx-xxxx",
    "Customer Billable": "\"Yes / No\"",
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\""
  },
  "properties": {
    "provisioningState": "Succeeded",
    "resourceGuid": "dec34053-b7bd-4495-ba62-5548338c33fb",
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [],
    "virtualNetworkPeerings": [
      {
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
        "properties": {
          "provisioningState": "Succeeded",
          "resourceGuid": "e1150a1a-f596-028c-34c8-e3cf45ab0296",
          "peeringState": "Connected",
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "doNotVerifyRemoteGateways": false,
          "remoteGateways": [
            {
              "id":
"/subscriptions/--redacted#2--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworkGateways/CP14-VNGateway-Prod-WestUS2-Expressroute"
            }
          ],
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "routeServiceVips": {}
        },
        "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
      }
    ],
    "enableDdosProtection": false,
    "enableVmProtection": false
  }
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : 370c69de-c61c-415f-8e72-0f9dabcf07d5
accept-language               : en-US

Body:
{
  "properties": {
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [
      {
        "properties": {
          "addressPrefix": "10.173.16.0/25",
          "addressPrefixes": [],
          "serviceEndpoints": [],
          "serviceEndpointPolicies": [],
          "ipAllocations": [],
          "delegations": [],
          "privateEndpointNetworkPolicies": "Enabled",
          "privateLinkServiceNetworkPolicies": "Enabled"
        },
        "name": "TestSubnet"
      }
    ],
    "virtualNetworkPeerings": [
      {
        "properties": {
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "remoteVirtualNetworkAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "peeringState": "Connected"
        },
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2"
      }
    ],
    "enableDdosProtection": false,
    "ipAllocations": []
  },
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "location": "westus2",
  "tags": {
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\"",
    "BULC": "MBSO",
    "Customer Billable": "\"Yes / No\"",
    "Cost Center": "MBSO-xx-xxxx"
  }
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-request-id               : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id   : 6b23eae6-d857-4f4a-8790-801084b4b7d4
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:6b23eae6-d857-4f4a-8790-801084b4b7d4
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:46 GMT

Body:
{
  "error": {
    "code": "InvalidRequestFormat",
    "message": "Cannot parse the request.",
    "details": [
      {
        "code": "InvalidJson",
        "message": "Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45."
      }
    ]
  }
}
Set-AzVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
At line:1 char:9
+ $vnet | Set-AzVirtualNetwork
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand
DEBUG: AzureQoSEvent: CommandName - Set-AzVirtualNetwork; IsSuccess - False; Duration - 00:00:01.0637675;; Exception -
Microsoft.Azure.Commands.Network.Common.NetworkCloudException: Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
ErrorMessage: Cannot parse the request.
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4 ---> Microsoft.Rest.Azure.CloudException: Cannot parse the request.
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__14.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<CreateOrUpdateWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.<CreateOrUpdateAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.CreateOrUpdate(IVirtualNetworksOperations
operations, String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters)
   at Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand.Execute()
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 6:26:48 PM - SetAzureVirtualNetworkCommand end processing.

Error output

DEBUG: 6:32:02 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 6:32:02 PM - using account id '[email protected]'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use
`Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other
information on breaking changes in Azure PowerShell.


   HistoryId: 10


RequestId      :
Message        : Cannot parse the request.
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 ErrorCode: InvalidRequestFormat
                 ErrorMessage: Cannot parse the request.
                 Additional details:
                     Code: InvalidJson
                     Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
                 'VirtualNetworkPeeringProperties'. Path
                 'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position
                 45.
                 OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Set-AzVirtualNetwork}
Line           : $vnet | Set-AzVirtualNetwork
Position       : At line:1 char:9
                 + $vnet | Set-AzVirtualNetwork
                 +         ~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 10


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0677493;
DEBUG: Finish sending metric.
DEBUG: 6:32:03 PM - ResolveError end processing.

trindels avatar Nov 19 '20 00:11 trindels

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms

ghost avatar Nov 19 '20 00:11 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @vnetsuppgithub.

Issue Details

Description

Set-AzVirtualNetwork produces error when VNet Peering exists with another VNet. VNet Peering is Cross-Subscription, within same Tenant. User running Set-AzVirtualNetwork does not have access to peered VNet. VNet Peering settings are not being changed.

Steps to reproduce

$vnetName = "VnetName"
$rgName = "RgName"
$subnetName = "SubnetName"
$subnetPrefix = "10.10.10.0/24"

$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgName
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix $subnetPrefix -VirtualNetwork $vnet
$vnet | Set-AzVirtualNetwork

Environment data

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

Module versions

Script     2.2.1      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     1.1.1      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendati...
Script     2.0.1      Az.Aks                              {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, ...
Script     0.2.0      Az.AlertsManagement                 {Get-AzAlert, Get-AzAlertObjectHistory, Update-AzAlertStat...
Script     1.1.4      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServic...
Script     2.1.0      Az.ApiManagement                    {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiTo...
Script     1.0.0      Az.AppConfiguration                 {Get-AzAppConfigurationStore, Get-AzAppConfigurationStoreK...
Script     1.1.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Rem...
Script     0.1.8      Az.Attestation                      {New-AzAttestation, Get-AzAttestation, Remove-AzAttestatio...
Script     1.4.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHyb...
Script     3.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAcc...
Script     2.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollme...
Script     0.2.0      Az.Blockchain                       {Get-AzBlockchainConsortium, Get-AzBlockchainMember, Get-A...
Script     0.2.13     Az.Blueprint                        {Get-AzBlueprint, Get-AzBlueprintAssignment, New-AzBluepri...
Script     1.6.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfil...
Script     1.6        Az.CloneVirtualMachine              New-AzVMClone
Script     1.8.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc...
Script     4.6.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAv...
Script     0.7.0      Az.Compute.ManagedService           ConvertTo-AzVhd
Script     0.1.0      Az.ConnectedKubernetes              {Get-AzConnectedKubernetes, New-AzConnectedKubernetes, Rem...
Script     0.2.0      Az.ConnectedMachine                 {Connect-AzConnectedMachine, Get-AzConnectedMachine, Get-A...
Script     0.7.0      Az.Consumption                      {Get-AzConsumptionBudget, Get-AzConsumptionMarketplace, Ge...
Script     1.0.3      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzCont...
Script     2.0.0      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-...
Script     0.2.0      Az.CosmosDB                         {Get-AzCosmosDBSqlContainer, Get-AzCosmosDBSqlContainerThr...
Script     0.1.0      Az.CustomProviders                  {Get-AzCustomProvider, Get-AzCustomProviderAssociation, Ne...
Script     0.1.1      Az.DataBox                          {Get-AzDataBoxJob, Get-AzDataBoxCredential, Stop-AzDataBox...
Script     1.1.0      Az.DataBoxEdge                      {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzD...
Script     1.0.1      Az.Databricks                       {Get-AzDatabricksVNetPeering, Get-AzDatabricksWorkspace, N...
Script     1.11.1     Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFa...
Script     1.0.2      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalytic...
Script     1.3.0      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeSt...
Script     0.7.4      Az.DataMigration                    {New-AzDataMigrationDatabaseInfo, New-AzDataMigrationConne...
Script     1.0.0      Az.DataShare                        {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-Az...
Script     0.1.0      Az.DedicatedHsm                     {Get-AzDedicatedHsm, New-AzDedicatedHsm, Remove-AzDedicate...
Script     1.1.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentMa...
Script     2.0.1      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-A...
Script     0.9.0      Az.DeviceProvisioningServices       {New-AzIoTDeviceProvisioningService, Get-AzIoTDeviceProvis...
Script     0.7.3      Az.DevSpaces                        {Get-AzDevSpacesController, New-AzDevSpacesController, Rem...
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic...
Script     0.1.0      Az.DigitalTwins                     {Get-AzDigitalTwinsEndpoint, Get-AzDigitalTwinsInstance, N...
Script     1.1.2      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRe...
Script     1.3.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGr...
Script     1.7.1      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzE...
Script     1.6.1      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove...
Script     2.0.0      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Ge...
Script     0.10.8     Az.GuestConfiguration               {Get-AzVMGuestPolicyStatus, Get-AzVMGuestPolicyStatusHistory}
Script     0.2.0      Az.HanaOnAzure                      {Get-AzSapMonitor, Get-AzSapMonitorProviderInstance, New-A...
Script     4.1.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wa...
Script     1.1.0      Az.HealthcareApis                   {New-AzHealthcareApisService, Remove-AzHealthcareApisServi...
Script     0.1.1      Az.HPCCache                         {Get-AzHpcCacheSku, Get-AzHpcCacheUsageModel, Get-AzHpcCac...
Script     0.1.2      Az.ImageBuilder                     {Get-AzImageBuilderRunOutput, Get-AzImageBuilderTemplate, ...
Script     1.0.0.1    Az.ImageBuilder.Tools               {Get-AIBBuildStatus, Initialize-AzureImageBuilder, Invoke-...
Script     0.1.0      Az.ImportExport                     {Get-AzImportExport, Get-AzImportExportBitLockerKey, Get-A...
Script     0.7.0      Az.Insights                         {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.8.0      Az.IotCentral                       {New-AzIotCentralApp, Get-AzIotCentralApp, Set-AzIotCentra...
Script     2.7.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-A...
Script     3.1.0      Az.KeyVault                         {Add-AzManagedHsmKey, Get-AzManagedHsmKey, Remove-AzManage...
Script     0.1.0      Az.KubernetesConfiguration          {Get-AzKubernetesConfiguration, New-AzKubernetesConfigurat...
Script     1.0.0      Az.Kusto                            {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabaseP...
Script     1.4.0      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccou...
Script     1.1.3      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssocia...
Script     0.7.0      Az.MachineLearningCompute           {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-AzMlOpClust...
Script     1.1.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzM...
Script     0.7.3      Az.ManagedServiceIdentity           {New-AzUserAssignedIdentity, Get-AzUserAssignedIdentity, R...
Script     2.0.0      Az.ManagedServices                  {Get-AzManagedServicesAssignment, New-AzManagedServicesAss...
Script     0.7.2      Az.ManagementPartner                {Get-AzManagementPartner, New-AzManagementPartner, Update-...
Script     0.7.3      Az.Maps                             {Get-AzMapsAccount, New-AzMapsAccount, Remove-AzMapsAccoun...
Script     0.2.0      Az.MariaDb                          {Get-AzMariaDbConfiguration, Get-AzMariaDbConnectionString...
Script     0.2.0      Az.Marketplace                      {Get-AzMarketplacePrivateStore, Get-AzMarketplacePrivateSt...
Script     1.0.2      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.1.1      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get...
Script     0.1.0      Az.Migrate                          {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMi...
Script     0.1.4      Az.MixedReality                     {Get-AzSpatialAnchorsAccount, Get-AzSpatialAnchorsAccountK...
Script     2.2.0      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.1.0      Az.MonitoringSolutions              {Get-AzMonitorLogAnalyticsSolution, New-AzMonitorLogAnalyt...
Script     0.2.0      Az.MySql                            {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Ge...
Script     0.2.0      Az.NetAppFiles                      {Get-AzNetAppFilesAccount, New-AzNetAppFilesAccount, Remov...
Script     4.3.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-Az...
Script     1.1.1      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorization...
Script     2.3.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-...
Script     0.2.0      Az.Peering                          {Get-AzPeering, Get-AzPeerAsn, New-AzPeerAsn, New-AzPeerin...
Script     1.3.1      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSu...
Script     0.1.0      Az.Portal                           {Get-AzPortalDashboard, New-AzPortalDashboard, Remove-AzPo...
Script     0.2.0      Az.PostgreSql                       {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnection...
Script     1.1.2      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa...
Script     1.0.3      Az.PrivateDns                       {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPriv...
Script     0.7.0      Az.Profile                          {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     3.0.1      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServi...
Script     1.4.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheSchedul...
Script     1.0.3      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNa...
Script     0.9.0      Az.Reservations                     {Get-AzReservationOrder, Get-AzReservation, Get-AzReservat...
Script     0.7.7      Az.ResourceGraph                    Search-AzGraph
Script     0.1.0      Az.ResourceMover                    {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveC...
Script     3.0.1      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR...
Script     0.7.4      Az.Search                           {New-AzSearchService, Get-AzSearchService, Set-AzSearchSer...
Script     0.8.0      Az.Security                         {Get-AzSecurityAlert, Set-AzSecurityAlert, Get-AzSecurityA...
Script     1.4.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set...
Script     2.2.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzServiceFabric...
Script     1.2.0      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSig...
Script     0.2.0      Az.SpringCloud                      {Deploy-AzSpringCloudApp, Get-AzSpringCloud, Get-AzSpringC...
Script     2.12.0     Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlData...
Script     1.1.0      Az.SqlVirtualMachine                {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM...}
Script     0.1.0      Az.StackEdge                        {Get-AzStackEdgeJob, Get-AzStackEdgeDevice, Invoke-AzStack...
Script     0.4.0      Az.StackHCI                         {Register-AzStackHCI, Unregister-AzStackHCI, Test-AzStackH...
Script     3.0.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor...
Script     1.3.0      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSync...
Manifest   1.0.7      Az.StorageTable                     {Add-AzStorageTableRow, Get-AzStorageTableRowAll, Get-AzSt...
Script     1.0.1      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefau...
Script     0.8.0      Az.Subscription                     {Update-AzSubscription, New-AzSubscriptionAlias, Get-AzSub...
Script     1.0.0      Az.Support                          {Get-AzSupportService, Get-AzSupportProblemClassification,...
Script     0.4.0      Az.Synapse                          {Get-AzSynapseSparkJob, Stop-AzSynapseSparkJob, Submit-AzS...
Script     0.7.0      Az.Tags                             {Remove-AzTag, Get-AzTag, New-AzTag}
Script     0.2.0      Az.TimeSeriesInsights               {Get-AzTimeSeriesInsightsAccessPolicy, Get-AzTimeSeriesIns...
Script     0.1.1      Az.Tools.Installer                  {Install-AzModule, Uninstall-AzModule, Update-AzModule}
Script     0.1.0      Az.Tools.Migration                  {Disable-AzUpgradeDataCollection, Enable-AzUpgradeDataColl...
Script     1.0.4      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTraf...
Script     0.7.0      Az.UsageAggregates                  Get-UsageAggregates
Script     0.1.0      Az.VMWare                           {Get-AzVMWareAuthorization, Get-AzVMWareCluster, Get-AzVMW...
Script     2.1.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServ...

Debug output


DEBUG: 6:26:46 PM - SetAzureVirtualNetworkCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 6:26:46 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant:
 'f65d02be-9231-4769-9120-8d7f799652db'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'f65d02be-9231-4769-9120-8d7f799652db',
UserId: '[email protected]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : b115b9ce-b165-4b59-b46a-70ca93250c82
accept-language               : en-US

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-request-id               : fa70dd8c-7ab9-4661-a230-034ea8f66f01
x-ms-correlation-request-id   : 8bb9bc0f-80ff-4316-bc34-bd6a2439198d
x-ms-arm-service-request-id   : 570c5dbf-f307-401d-9b5d-0c7c05a667dd
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
ETag                          : W/"d051b686-b68a-4387-b8fa-a440211f4bad"
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:8bb9bc0f-80ff-4316-bc34-bd6a2439198d
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:45 GMT

Body:
{
  "name": "MBSO-Vnet-Prod-Ext-WestUS2",
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
  "type": "Microsoft.Network/virtualNetworks",
  "location": "westus2",
  "tags": {
    "BULC": "MBSO",
    "Cost Center": "MBSO-xx-xxxx",
    "Customer Billable": "\"Yes / No\"",
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\""
  },
  "properties": {
    "provisioningState": "Succeeded",
    "resourceGuid": "dec34053-b7bd-4495-ba62-5548338c33fb",
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [],
    "virtualNetworkPeerings": [
      {
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
        "properties": {
          "provisioningState": "Succeeded",
          "resourceGuid": "e1150a1a-f596-028c-34c8-e3cf45ab0296",
          "peeringState": "Connected",
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "doNotVerifyRemoteGateways": false,
          "remoteGateways": [
            {
              "id":
"/subscriptions/--redacted#2--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworkGateways/CP14-VNGateway-Prod-WestUS2-Expressroute"
            }
          ],
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "routeServiceVips": {}
        },
        "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
      }
    ],
    "enableDdosProtection": false,
    "enableVmProtection": false
  }
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : 370c69de-c61c-415f-8e72-0f9dabcf07d5
accept-language               : en-US

Body:
{
  "properties": {
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [
      {
        "properties": {
          "addressPrefix": "10.173.16.0/25",
          "addressPrefixes": [],
          "serviceEndpoints": [],
          "serviceEndpointPolicies": [],
          "ipAllocations": [],
          "delegations": [],
          "privateEndpointNetworkPolicies": "Enabled",
          "privateLinkServiceNetworkPolicies": "Enabled"
        },
        "name": "TestSubnet"
      }
    ],
    "virtualNetworkPeerings": [
      {
        "properties": {
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "remoteVirtualNetworkAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "peeringState": "Connected"
        },
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2"
      }
    ],
    "enableDdosProtection": false,
    "ipAllocations": []
  },
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "location": "westus2",
  "tags": {
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\"",
    "BULC": "MBSO",
    "Customer Billable": "\"Yes / No\"",
    "Cost Center": "MBSO-xx-xxxx"
  }
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-request-id               : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id   : 6b23eae6-d857-4f4a-8790-801084b4b7d4
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:6b23eae6-d857-4f4a-8790-801084b4b7d4
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:46 GMT

Body:
{
  "error": {
    "code": "InvalidRequestFormat",
    "message": "Cannot parse the request.",
    "details": [
      {
        "code": "InvalidJson",
        "message": "Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45."
      }
    ]
  }
}
Set-AzVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
At line:1 char:9
+ $vnet | Set-AzVirtualNetwork
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand
DEBUG: AzureQoSEvent: CommandName - Set-AzVirtualNetwork; IsSuccess - False; Duration - 00:00:01.0637675;; Exception -
Microsoft.Azure.Commands.Network.Common.NetworkCloudException: Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
ErrorMessage: Cannot parse the request.
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4 ---> Microsoft.Rest.Azure.CloudException: Cannot parse the request.
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__14.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<CreateOrUpdateWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.<CreateOrUpdateAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.CreateOrUpdate(IVirtualNetworksOperations
operations, String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters)
   at Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand.Execute()
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 6:26:48 PM - SetAzureVirtualNetworkCommand end processing.

Error output

DEBUG: 6:32:02 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 6:32:02 PM - using account id '[email protected]'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use
`Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other
information on breaking changes in Azure PowerShell.


   HistoryId: 10


RequestId      :
Message        : Cannot parse the request.
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 ErrorCode: InvalidRequestFormat
                 ErrorMessage: Cannot parse the request.
                 Additional details:
                     Code: InvalidJson
                     Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
                 'VirtualNetworkPeeringProperties'. Path
                 'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position
                 45.
                 OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Set-AzVirtualNetwork}
Line           : $vnet | Set-AzVirtualNetwork
Position       : At line:1 char:9
                 + $vnet | Set-AzVirtualNetwork
                 +         ~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 10


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0677493;
DEBUG: Finish sending metric.
DEBUG: 6:32:03 PM - ResolveError end processing.

Author: trindels
Assignees: -
Labels:

Network - Virtual Network, Service Attention, customer-reported, needs-triage, question

Milestone: -

ghost avatar Nov 19 '20 01:11 ghost

Network team, please help to look into this question.

dingmeng-xue avatar Nov 19 '20 01:11 dingmeng-xue

@altambaw can you help investigate? Thanks!

allegradomel avatar Nov 19 '20 21:11 allegradomel

I'm facing the same issue. Is there a workaround for this?

dragonfly91 avatar Nov 24 '20 05:11 dragonfly91

I was able to work around the issue by dropping back to az.network module 4.1 (I (re)moved the 4.3 folder found in C:\Program Files\WindowsPowerShell\Modules\Az.Network which forced 4.1 to be used). I'd love to know if there was an easier way to force a module version to be used, but this got me past the immediate issue.

DDexheimer avatar Nov 24 '20 06:11 DDexheimer

I am also encountering this same issue when running cloud powershell tasks in an Azure DevOps release pipeline. I am unable to downgrade the modules to use the workaround previously mentioned.

joshfranzen avatar Dec 11 '20 20:12 joshfranzen

I have the same issue. If I remove the Peerings, everything works well.

alphasteff avatar Dec 14 '20 14:12 alphasteff

I was able to work around the issue by dropping back to az.network module 4.1 (I (re)moved the 4.3 folder found in C:\Program Files\WindowsPowerShell\Modules\Az.Network which forced 4.1 to be used). I'd love to know if there was an easier way to force a module version to be used, but this got me past the immediate issue.

yep worked for me too....

frehnejc avatar Dec 16 '20 08:12 frehnejc

I tried version 4.2 and it doesn't work either. I will now continue testing with version 4.1.

alphasteff avatar Dec 23 '20 08:12 alphasteff

After downgrading to version 4.1, everything works again. It is a pity that even after a month, there is still no official answer.

alphasteff avatar Dec 23 '20 11:12 alphasteff

Yeah, have the same Problem. Does not work on 4.3. Downgrading to 4.1 does the job. Hopefully this will get fixed

gasserp avatar Dec 23 '20 15:12 gasserp

Also version 4.4 does not work. When will it be fixed?

madeck avatar Jan 07 '21 15:01 madeck

In my case, I was attempting to associate an NSG to to a subnet that was part of a peered virtual network in the same subscription, and still encountered the same error.

I'm using Windows PowerShell 5.1 and the latest Az.Network module.

PS: 01/07/2021 15:37:29>Get-Command -Name Set-AzVirtualNetwork CommandType Name Version Source


Cmdlet Set-AzVirtualNetwork 4.4.0 Az.Network

Possible root cause: It seems that the Set-AzVirtualNetwork cmdlet is expecting a slightly different property spelling than what the JSON output generates.

Here is the output and my finding at the end about the mismatched property name.

PS: 01/07/2021 15:01:46>$vnetResource = Get-AzVirtualNetwork -ResourceGroupName rg00 -Name vnt-01

PS: 01/07/2021 15:11:31>$nsgResource = Get-AzNetworkSecurityGroup -ResourceGroupName rg00 -Name nsg-sub-01

PS: 01/07/2021 15:12:15>Set-AzVirtualNetworkSubnetConfig -Name sub-01 -VirtualNetwork $vnetResource -AddressPrefix '192.168.10.0/29' -NetworkSecurityGroup $nsgResource -Verbose

WARNING: Upcoming breaking changes in the cmdlet 'Set-AzVirtualNetworkSubnetConfig' : Update Property Name Cmdlet invocation changes : Old Way : -ResourceId New Way : -NatGatewayId Update Property Name Cmdlet invocation changes : Old Way : -InputObject New Way : -NatGateway Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

Name : vnt-01 ResourceGroupName : rg00 Location : eastus2 Id : /subscriptions//resourceGroups/rg00/providers/Microsoft.Network/virtualNetworks/vnt-01 Etag : W/"" ResourceGuid : ProvisioningState : Succeeded Tags : Name Value ===== ===== AppId 0001

AddressSpace : { "AddressPrefixes": [ "192.168.10.0/27" ] } DhcpOptions : { "DnsServers": [] } Subnets : [ { "Delegations": [], "Name": "sub-02", "Etag": "W/""", "Id": "/subscriptions//resourceGroups/rg00/providers/Microsoft.Network/virtualNetworks/vnt-01/subnets/sub-02", "AddressPrefix": [ "192.168.10.8/29" ], "IpConfigurations": [], "ServiceAssociationLinks": [], "ResourceNavigationLinks": [], "ServiceEndpoints": [], "ServiceEndpointPolicies": [], "PrivateEndpoints": [], "ProvisioningState": "Succeeded", "PrivateEndpointNetworkPolicies": "Enabled", "PrivateLinkServiceNetworkPolicies": "Enabled", "IpAllocations": [] }, { "Name": "sub-01", "Etag": "W/""", "Id": "/subscriptions//resourceGroups/rg00/providers/Microsoft.Network/virtualNetworks/vnt-01/subnets/sub-01", "AddressPrefix": [ "192.168.10.0/29" ], "IpConfigurations": [], "ServiceAssociationLinks": [], "ResourceNavigationLinks": [], "NetworkSecurityGroup": { "Id": "/subscriptions//resourceGroups/rg00/providers/Microsoft.Network/networkSecurityGroups/nsg-sub-01" }, "PrivateEndpoints": [], "ProvisioningState": "Succeeded", "PrivateEndpointNetworkPolicies": "Enabled", "PrivateLinkServiceNetworkPolicies": "Enabled", "IpAllocations": [] } ] VirtualNetworkPeerings : [ { "Name": "01to02-pln-01", "Etag": "W/""", "Id": "/subscriptions//resourceGroups/rg00/providers/Microsoft.Network/virtualNetworks/vnt-01/virtualNetworkPeerings/01to02-pln-01", "PeeringState": "Connected", "AllowVirtualNetworkAccess": true, "AllowForwardedTraffic": true, "AllowGatewayTransit": false, "UseRemoteGateways": false, "RemoteVirtualNetwork": { "Id": "/subscriptions//resourceGroups/rg00/providers/Microsoft.Network/virtualNetworks/vnt-02" }, "RemoteVirtualNetworkAddressSpace": { "AddressPrefixes": [ "10.0.0.0/16", "172.16.10.0/27" ] }, "ProvisioningState": "Succeeded" } ] EnableDdosProtection : false DdosProtectionPlan : null

PS: 01/07/2021 15:14:11>$vnetResource | Set-AzVirtualNetwork -Verbose

Set-AzVirtualNetwork : Cannot parse the request. StatusCode: 400 ReasonPhrase: Bad Request ErrorCode: InvalidRequestFormat ErrorMessage: Cannot parse the request. Additional details: Code: InvalidJson Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type 'VirtualNetworkPeeringProperties'. Path 'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 64, position 45. OperationID : At line:1 char:17

  • $vnetResource | Set-AzVirtualNetwork -Verbose
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
    • FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand

Notice that the error message indicates: "Could not find member 'remoteVirtualNetworkAddressSpace' which begins with a lower-case 'r'. Whereas the actual property 'RemoteVirtualNetworkAddressSpace' from the JSON output above for the VirtualNetworkPeerings array actually begins with an upper-case 'R'. So it appears that the Set-AzVirtualNetwork cmdlet is expecting a differently spelled property that is available from the JSON output.

autocloudarc avatar Jan 07 '21 20:01 autocloudarc

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

Issue Details

Description

Set-AzVirtualNetwork produces error when VNet Peering exists with another VNet. VNet Peering is Cross-Subscription, within same Tenant. User running Set-AzVirtualNetwork does not have access to peered VNet. VNet Peering settings are not being changed.

Steps to reproduce

$vnetName = "VnetName"
$rgName = "RgName"
$subnetName = "SubnetName"
$subnetPrefix = "10.10.10.0/24"

$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgName
Add-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix $subnetPrefix -VirtualNetwork $vnet
$vnet | Set-AzVirtualNetwork

Environment data

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

Module versions

Script     2.2.1      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     1.1.1      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendati...
Script     2.0.1      Az.Aks                              {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, ...
Script     0.2.0      Az.AlertsManagement                 {Get-AzAlert, Get-AzAlertObjectHistory, Update-AzAlertStat...
Script     1.1.4      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServic...
Script     2.1.0      Az.ApiManagement                    {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiTo...
Script     1.0.0      Az.AppConfiguration                 {Get-AzAppConfigurationStore, Get-AzAppConfigurationStoreK...
Script     1.1.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Rem...
Script     0.1.8      Az.Attestation                      {New-AzAttestation, Get-AzAttestation, Remove-AzAttestatio...
Script     1.4.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHyb...
Script     3.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAcc...
Script     2.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollme...
Script     0.2.0      Az.Blockchain                       {Get-AzBlockchainConsortium, Get-AzBlockchainMember, Get-A...
Script     0.2.13     Az.Blueprint                        {Get-AzBlueprint, Get-AzBlueprintAssignment, New-AzBluepri...
Script     1.6.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfil...
Script     1.6        Az.CloneVirtualMachine              New-AzVMClone
Script     1.8.0      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc...
Script     4.6.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAv...
Script     0.7.0      Az.Compute.ManagedService           ConvertTo-AzVhd
Script     0.1.0      Az.ConnectedKubernetes              {Get-AzConnectedKubernetes, New-AzConnectedKubernetes, Rem...
Script     0.2.0      Az.ConnectedMachine                 {Connect-AzConnectedMachine, Get-AzConnectedMachine, Get-A...
Script     0.7.0      Az.Consumption                      {Get-AzConsumptionBudget, Get-AzConsumptionMarketplace, Ge...
Script     1.0.3      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzCont...
Script     2.0.0      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-...
Script     0.2.0      Az.CosmosDB                         {Get-AzCosmosDBSqlContainer, Get-AzCosmosDBSqlContainerThr...
Script     0.1.0      Az.CustomProviders                  {Get-AzCustomProvider, Get-AzCustomProviderAssociation, Ne...
Script     0.1.1      Az.DataBox                          {Get-AzDataBoxJob, Get-AzDataBoxCredential, Stop-AzDataBox...
Script     1.1.0      Az.DataBoxEdge                      {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzD...
Script     1.0.1      Az.Databricks                       {Get-AzDatabricksVNetPeering, Get-AzDatabricksWorkspace, N...
Script     1.11.1     Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFa...
Script     1.0.2      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalytic...
Script     1.3.0      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeSt...
Script     0.7.4      Az.DataMigration                    {New-AzDataMigrationDatabaseInfo, New-AzDataMigrationConne...
Script     1.0.0      Az.DataShare                        {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-Az...
Script     0.1.0      Az.DedicatedHsm                     {Get-AzDedicatedHsm, New-AzDedicatedHsm, Remove-AzDedicate...
Script     1.1.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentMa...
Script     2.0.1      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-A...
Script     0.9.0      Az.DeviceProvisioningServices       {New-AzIoTDeviceProvisioningService, Get-AzIoTDeviceProvis...
Script     0.7.3      Az.DevSpaces                        {Get-AzDevSpacesController, New-AzDevSpacesController, Rem...
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic...
Script     0.1.0      Az.DigitalTwins                     {Get-AzDigitalTwinsEndpoint, Get-AzDigitalTwinsInstance, N...
Script     1.1.2      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRe...
Script     1.3.0      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGr...
Script     1.7.1      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzE...
Script     1.6.1      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove...
Script     2.0.0      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Ge...
Script     0.10.8     Az.GuestConfiguration               {Get-AzVMGuestPolicyStatus, Get-AzVMGuestPolicyStatusHistory}
Script     0.2.0      Az.HanaOnAzure                      {Get-AzSapMonitor, Get-AzSapMonitorProviderInstance, New-A...
Script     4.1.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wa...
Script     1.1.0      Az.HealthcareApis                   {New-AzHealthcareApisService, Remove-AzHealthcareApisServi...
Script     0.1.1      Az.HPCCache                         {Get-AzHpcCacheSku, Get-AzHpcCacheUsageModel, Get-AzHpcCac...
Script     0.1.2      Az.ImageBuilder                     {Get-AzImageBuilderRunOutput, Get-AzImageBuilderTemplate, ...
Script     1.0.0.1    Az.ImageBuilder.Tools               {Get-AIBBuildStatus, Initialize-AzureImageBuilder, Invoke-...
Script     0.1.0      Az.ImportExport                     {Get-AzImportExport, Get-AzImportExportBitLockerKey, Get-A...
Script     0.7.0      Az.Insights                         {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.8.0      Az.IotCentral                       {New-AzIotCentralApp, Get-AzIotCentralApp, Set-AzIotCentra...
Script     2.7.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-A...
Script     3.1.0      Az.KeyVault                         {Add-AzManagedHsmKey, Get-AzManagedHsmKey, Remove-AzManage...
Script     0.1.0      Az.KubernetesConfiguration          {Get-AzKubernetesConfiguration, New-AzKubernetesConfigurat...
Script     1.0.0      Az.Kusto                            {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabaseP...
Script     1.4.0      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccou...
Script     1.1.3      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssocia...
Script     0.7.0      Az.MachineLearningCompute           {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-AzMlOpClust...
Script     1.1.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzM...
Script     0.7.3      Az.ManagedServiceIdentity           {New-AzUserAssignedIdentity, Get-AzUserAssignedIdentity, R...
Script     2.0.0      Az.ManagedServices                  {Get-AzManagedServicesAssignment, New-AzManagedServicesAss...
Script     0.7.2      Az.ManagementPartner                {Get-AzManagementPartner, New-AzManagementPartner, Update-...
Script     0.7.3      Az.Maps                             {Get-AzMapsAccount, New-AzMapsAccount, Remove-AzMapsAccoun...
Script     0.2.0      Az.MariaDb                          {Get-AzMariaDbConfiguration, Get-AzMariaDbConnectionString...
Script     0.2.0      Az.Marketplace                      {Get-AzMarketplacePrivateStore, Get-AzMarketplacePrivateSt...
Script     1.0.2      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.1.1      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get...
Script     0.1.0      Az.Migrate                          {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMi...
Script     0.1.4      Az.MixedReality                     {Get-AzSpatialAnchorsAccount, Get-AzSpatialAnchorsAccountK...
Script     2.2.0      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile...
Script     0.1.0      Az.MonitoringSolutions              {Get-AzMonitorLogAnalyticsSolution, New-AzMonitorLogAnalyt...
Script     0.2.0      Az.MySql                            {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Ge...
Script     0.2.0      Az.NetAppFiles                      {Get-AzNetAppFilesAccount, New-AzNetAppFilesAccount, Remov...
Script     4.3.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-Az...
Script     1.1.1      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorization...
Script     2.3.0      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-...
Script     0.2.0      Az.Peering                          {Get-AzPeering, Get-AzPeerAsn, New-AzPeerAsn, New-AzPeerin...
Script     1.3.1      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSu...
Script     0.1.0      Az.Portal                           {Get-AzPortalDashboard, New-AzPortalDashboard, Remove-AzPo...
Script     0.2.0      Az.PostgreSql                       {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnection...
Script     1.1.2      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa...
Script     1.0.3      Az.PrivateDns                       {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPriv...
Script     0.7.0      Az.Profile                          {Disable-AzDataCollection, Disable-AzContextAutosave, Enab...
Script     3.0.1      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServi...
Script     1.4.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheSchedul...
Script     1.0.3      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNa...
Script     0.9.0      Az.Reservations                     {Get-AzReservationOrder, Get-AzReservation, Get-AzReservat...
Script     0.7.7      Az.ResourceGraph                    Search-AzGraph
Script     0.1.0      Az.ResourceMover                    {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveC...
Script     3.0.1      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR...
Script     0.7.4      Az.Search                           {New-AzSearchService, Get-AzSearchService, Set-AzSearchSer...
Script     0.8.0      Az.Security                         {Get-AzSecurityAlert, Set-AzSecurityAlert, Get-AzSecurityA...
Script     1.4.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set...
Script     2.2.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzServiceFabric...
Script     1.2.0      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSig...
Script     0.2.0      Az.SpringCloud                      {Deploy-AzSpringCloudApp, Get-AzSpringCloud, Get-AzSpringC...
Script     2.12.0     Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlData...
Script     1.1.0      Az.SqlVirtualMachine                {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM...}
Script     0.1.0      Az.StackEdge                        {Get-AzStackEdgeJob, Get-AzStackEdgeDevice, Invoke-AzStack...
Script     0.4.0      Az.StackHCI                         {Register-AzStackHCI, Unregister-AzStackHCI, Test-AzStackH...
Script     3.0.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor...
Script     1.3.0      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSync...
Manifest   1.0.7      Az.StorageTable                     {Add-AzStorageTableRow, Get-AzStorageTableRowAll, Get-AzSt...
Script     1.0.1      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefau...
Script     0.8.0      Az.Subscription                     {Update-AzSubscription, New-AzSubscriptionAlias, Get-AzSub...
Script     1.0.0      Az.Support                          {Get-AzSupportService, Get-AzSupportProblemClassification,...
Script     0.4.0      Az.Synapse                          {Get-AzSynapseSparkJob, Stop-AzSynapseSparkJob, Submit-AzS...
Script     0.7.0      Az.Tags                             {Remove-AzTag, Get-AzTag, New-AzTag}
Script     0.2.0      Az.TimeSeriesInsights               {Get-AzTimeSeriesInsightsAccessPolicy, Get-AzTimeSeriesIns...
Script     0.1.1      Az.Tools.Installer                  {Install-AzModule, Uninstall-AzModule, Update-AzModule}
Script     0.1.0      Az.Tools.Migration                  {Disable-AzUpgradeDataCollection, Enable-AzUpgradeDataColl...
Script     1.0.4      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTraf...
Script     0.7.0      Az.UsageAggregates                  Get-UsageAggregates
Script     0.1.0      Az.VMWare                           {Get-AzVMWareAuthorization, Get-AzVMWareCluster, Get-AzVMW...
Script     2.1.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServ...

Debug output


DEBUG: 6:26:46 PM - SetAzureVirtualNetworkCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 6:26:46 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant:
 'f65d02be-9231-4769-9120-8d7f799652db'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2020-11-19T00:39:41.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'f65d02be-9231-4769-9120-8d7f799652db',
UserId: '[email protected]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : b115b9ce-b165-4b59-b46a-70ca93250c82
accept-language               : en-US

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-request-id               : fa70dd8c-7ab9-4661-a230-034ea8f66f01
x-ms-correlation-request-id   : 8bb9bc0f-80ff-4316-bc34-bd6a2439198d
x-ms-arm-service-request-id   : 570c5dbf-f307-401d-9b5d-0c7c05a667dd
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
ETag                          : W/"d051b686-b68a-4387-b8fa-a440211f4bad"
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:8bb9bc0f-80ff-4316-bc34-bd6a2439198d
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:45 GMT

Body:
{
  "name": "MBSO-Vnet-Prod-Ext-WestUS2",
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
  "type": "Microsoft.Network/virtualNetworks",
  "location": "westus2",
  "tags": {
    "BULC": "MBSO",
    "Cost Center": "MBSO-xx-xxxx",
    "Customer Billable": "\"Yes / No\"",
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\""
  },
  "properties": {
    "provisioningState": "Succeeded",
    "resourceGuid": "dec34053-b7bd-4495-ba62-5548338c33fb",
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [],
    "virtualNetworkPeerings": [
      {
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "etag": "W/\"d051b686-b68a-4387-b8fa-a440211f4bad\"",
        "properties": {
          "provisioningState": "Succeeded",
          "resourceGuid": "e1150a1a-f596-028c-34c8-e3cf45ab0296",
          "peeringState": "Connected",
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "doNotVerifyRemoteGateways": false,
          "remoteGateways": [
            {
              "id":
"/subscriptions/--redacted#2--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworkGateways/CP14-VNGateway-Prod-WestUS2-Expressroute"
            }
          ],
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "routeServiceVips": {}
        },
        "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
      }
    ],
    "enableDdosProtection": false,
    "enableVmProtection": false
  }
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network
-WestUS2/providers/Microsoft.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2?api-version=2020-07-01

Headers:
x-ms-client-request-id        : 370c69de-c61c-415f-8e72-0f9dabcf07d5
accept-language               : en-US

Body:
{
  "properties": {
    "addressSpace": {
      "addressPrefixes": [
        "10.173.16.0/24",
        "10.173.17.0/24",
        "10.173.18.0/24"
      ]
    },
    "dhcpOptions": {
      "dnsServers": [
        "10.0.52.84",
        "10.0.51.84",
        "10.0.17.1"
      ]
    },
    "subnets": [
      {
        "properties": {
          "addressPrefix": "10.173.16.0/25",
          "addressPrefixes": [],
          "serviceEndpoints": [],
          "serviceEndpointPolicies": [],
          "ipAllocations": [],
          "delegations": [],
          "privateEndpointNetworkPolicies": "Enabled",
          "privateLinkServiceNetworkPolicies": "Enabled"
        },
        "name": "TestSubnet"
      }
    ],
    "virtualNetworkPeerings": [
      {
        "properties": {
          "allowVirtualNetworkAccess": true,
          "allowForwardedTraffic": true,
          "allowGatewayTransit": false,
          "useRemoteGateways": true,
          "remoteVirtualNetwork": {
            "id":
"/subscriptions/--redacted--/resourceGroups/CP14-RG-Prod-Int-WestUS2-Transit/providers/Microsof
t.Network/virtualNetworks/CP14-VNet-Prod-Int-WestUS2-Transit-1"
          },
          "remoteAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "remoteVirtualNetworkAddressSpace": {
            "addressPrefixes": [
              "10.0.52.0/24"
            ]
          },
          "peeringState": "Connected"
        },
        "name": "MBSO-Prod-Ext-Peer-CP14-WestUS2",
        "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2/virtualNetworkPeerings/MBSO-Prod-Ext-Peer-CP14-WestUS2"
      }
    ],
    "enableDdosProtection": false,
    "ipAllocations": []
  },
  "id":
"/subscriptions/--redacted--/resourceGroups/MBSO-RG-Prod-Ext-Network-WestUS2/providers/Microsof
t.Network/virtualNetworks/MBSO-Vnet-Prod-Ext-WestUS2",
  "location": "westus2",
  "tags": {
    "Customer": "“If Applicable”",
    "Product": "\"Change Me\"",
    "BULC": "MBSO",
    "Customer Billable": "\"Yes / No\"",
    "Cost Center": "MBSO-xx-xxxx"
  }
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
x-ms-request-id               : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id   : 6b23eae6-d857-4f4a-8790-801084b4b7d4
x-ms-routing-request-id       : CENTRALUS:20201119T002646Z:6b23eae6-d857-4f4a-8790-801084b4b7d4
X-Content-Type-Options        : nosniff
Date                          : Thu, 19 Nov 2020 00:26:46 GMT

Body:
{
  "error": {
    "code": "InvalidRequestFormat",
    "message": "Cannot parse the request.",
    "details": [
      {
        "code": "InvalidJson",
        "message": "Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45."
      }
    ]
  }
}
Set-AzVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
At line:1 char:9
+ $vnet | Set-AzVirtualNetwork
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand
DEBUG: AzureQoSEvent: CommandName - Set-AzVirtualNetwork; IsSuccess - False; Duration - 00:00:01.0637675;; Exception -
Microsoft.Azure.Commands.Network.Common.NetworkCloudException: Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
ErrorMessage: Cannot parse the request.
Additional details:
    Code: InvalidJson
    Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
'VirtualNetworkPeeringProperties'. Path
'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position 45.
OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4 ---> Microsoft.Rest.Azure.CloudException: Cannot parse the request.
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__14.MoveNext()

--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Azure.Management.Network.VirtualNetworksOperations.<CreateOrUpdateWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.<CreateOrUpdateAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Management.Network.VirtualNetworksOperationsExtensions.CreateOrUpdate(IVirtualNetworksOperations
operations, String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters)
   at Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand.Execute()
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 6:26:48 PM - SetAzureVirtualNetworkCommand end processing.

Error output

DEBUG: 6:32:02 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 6:32:02 PM - using account id '[email protected]'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use
`Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other
information on breaking changes in Azure PowerShell.


   HistoryId: 10


RequestId      :
Message        : Cannot parse the request.
                 StatusCode: 400
                 ReasonPhrase: Bad Request
                 ErrorCode: InvalidRequestFormat
                 ErrorMessage: Cannot parse the request.
                 Additional details:
                     Code: InvalidJson
                     Message: Could not find member 'remoteVirtualNetworkAddressSpace' on object of type
                 'VirtualNetworkPeeringProperties'. Path
                 'properties.virtualNetworkPeerings[0].properties.remoteVirtualNetworkAddressSpace', line 47, position
                 45.
                 OperationID : aaa3a6ca-5dad-419d-8bcd-4a4df39900c4
ServerMessage  :
ServerResponse :
RequestMessage :
InvocationInfo : {Set-AzVirtualNetwork}
Line           : $vnet | Set-AzVirtualNetwork
Position       : At line:1 char:9
                 + $vnet | Set-AzVirtualNetwork
                 +         ~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId      : 10


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0677493;
DEBUG: Finish sending metric.
DEBUG: 6:32:03 PM - ResolveError end processing.

Author: trindels
Assignees: -
Labels:

Network, Network - Virtual Network, Service Attention, customer-reported, question

Milestone: -

ghost avatar Jan 07 '21 20:01 ghost

similar issues with UDR association, downgrading az.network module to 4.1.0 fixed it. does not work with 4.3.0 or 4.4.0

tariqaliuk avatar Jan 12 '21 15:01 tariqaliuk

With Az 6 the version 4.7.0 of Az.Network came. So the problem no longer exists for me.

alphasteff avatar Jun 10 '21 06:06 alphasteff

@alphasteff Thanks for confirming here.

@trindels - Could you please confirm if this issue can be closed.

Thank you

KranthiPakala-MSFT avatar Oct 31 '21 04:10 KranthiPakala-MSFT

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost avatar Nov 07 '21 09:11 ghost