Azure / Azure/azure-powershell

Set-AzVirtualNetworkSubnetConfig doesn't work with ServiceEndpoints

Open
#8,735 13 comments 1 reaction 1 assignee Claimed by @sumeetmittal View on GitHub
act-quality-productivity-squad bug Network - Virtual Network Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

## Description
Set-AzVirtualNetworkSubnetConfig doesn't work with ServiceEndpoints - it tries to send 'Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint' as a string, not a type.

All examples show adding a service endpoint as a string ('Microsoft.Storage') but the behind object is a PSServiceENdpoint that is a Service and Location array.

ProvisioningState Service Locations
----------------- ------- ---------
Microsoft.SQL {EastUS, WestUS}

## Steps to reproduce

```powershell
$rg = 'networkRG'
$vnetName = 'vnet01'
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rg -name $vnetName
$SNConfig = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name 'subnet01'

$ServiceEndPoints = New-Object 'System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]'
$ServiceEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]::new()
$ServiceEndPoint.Service = "Microsoft.Storage"
$ServiceEndPoint.Locations = @("EastUS","WestUS")
$ServiceEndPoints.Add($ServiceEndPoint)

Set-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $SNConfig.Name `
-AddressPrefix $SNConfig.AddressPrefix -ServiceEndpoint $ServiceEndPoints

Set-AzureRmVirtualNetwork -VirtualNetwork $vnet
Set-AzureRmVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : '0b2dffc0-ebc2-4415-9b30-20211e66c4da'
At line:1 char:5
+ Set-AzureRmVirtualNetwork -VirtualNetwork $vnet -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand
```

Note that I can set the ServiceEndpoints by bypassing Set-AzVirtualNetworkSubnetConfig

```powershell
$rg = 'networkRG'
$vnetName = 'vnet01'
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rg -name $vnetName
$vnet.Subnets.Where({$_.name -eq 'subnet01'})[0].serviceendpoints = $ServiceEndPoints
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet

```

## Environment data
```
Name Value
---- -----
PSVersion 5.1.17763.316
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.316
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

## Module versions

```powershell
Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.3.0 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzCont...
Script 1.0.1 Az.Aks {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script 1.0.2 Az.AnalysisServices {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesSe...
Script 1.0.0 Az.ApiManagement {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementCustomHostnameCo...
Script 1.0.0 Az.ApplicationInsights {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzA...
Script 1.1.1 Az.Automation {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJo...
Script 1.0.0 Az.Batch {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeys, New-AzBatchAccount...}
Script 1.0.0 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget...
Script 1.0.1 Az.Cdn {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script 1.0.1 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesA...
Script 1.4.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabili...
Script 1.0.0 Az.ContainerInstance {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanc...
Script 1.0.1 Az.ContainerRegistry {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzCont...
Script 1.0.1 Az.DataFactory {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}
Script 1.0.0 Az.DataLakeAnalytics {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataL...
Script 1.1.0 Az.DataLakeStore {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDat...
Script 1.0.0 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-A...
Script 1.0.0 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script 1.1.0 Az.EventGrid {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}
Script 1.0.1 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHu...
Script 1.0.0 Az.HDInsight {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsight...
Script 1.0.2 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIot...
Script 1.0.2 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperatio...
Script 1.2.0 Az.LogicApp {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccou...
Script 1.0.0 Az.MachineLearning {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageH...
Script 1.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.0.0 Az.Media {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMediaServiceKeys, Get-AzMediaS...
Script 1.0.1 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script 1.2.1 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCe...
Script 1.0.0 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, Get-AzNotificationHubListKe...
Script 1.1.0 Az.OperationalInsights {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogData...
Script 1.0.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}
Script 1.0.0 Az.PowerBIEmbedded {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspa...
Script 1.0.1 Az.RecoveryServices {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVa...
Script 1.0.0 Az.RedisCache {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSched...
Script 1.0.0 Az.Relay {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}
Script 1.1.3 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignmen...
Script 1.0.0 Az.ServiceBus {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzS...
Script 1.0.1 Az.ServiceFabric {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServ...
Script 1.0.2 Az.SignalR {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script 1.3.0 Az.Sql {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActiv...
Script 1.0.2 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKe...
Script 1.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStream...
Script 1.0.1 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint...
Script 1.1.1 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}

```

## Debug output

Set-AzureRmVirtualNetwork -VirtualNetwork $vnet -Debug
DEBUG: 9:00:10 PM - SetAzureVirtualNetworkCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 9:00:11 PM - using account id 'CLewis@3cloudsolutions.com'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'CLewis@3cloudsolutions.com', environment: 'AzureCloud', tenant: '0c7b2a3d-9015-4
503-80e7-5c617cbf7d55'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtual
Networks/npduseavnet01?api-version=2018-11-01

Headers:
x-ms-client-request-id : 884e924a-3b8e-4530-a5be-1885fa1e3a3b
accept-language : en-US

Body:

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

Status Code:
OK

Headers:
Pragma : no-cache
x-ms-request-id : 0aab0779-2df5-4e26-bc9b-87e8a42cec3a
x-ms-correlation-request-id : 5adfac34-3076-40e3-ac91-c7154740438e
Strict-Transport-Security : max-age=31536000; includeSubDomains
Cache-Control : no-cache
ETag : W/"a8a1558e-f829-484c-a7aa-293d85ae07e9"
Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-routing-request-id : NORTHCENTRALUS:20190309T030015Z:5adfac34-3076-40e3-ac91-c7154740438e
X-Content-Type-Options : nosniff
Date : Sat, 09 Mar 2019 03:00:14 GMT

Body:
{
"name": "npduseavnet01",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npduseavne
t01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"type": "Microsoft.Network/virtualNetworks",
"location": "eastus",
"tags": {
"CreatedBy": "CLewis@3cloudsolutions.com",
"CreatedDate": "03/08/19",
"NS_Location": "USEA - US East",
"NS_Application": "NET - Network Resources",
"NS_Environment": "NPD - NonProduction"
},
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "d95bcfbb-26cd-4cc7-8996-ff441d1e1eea",
"addressSpace": {
"addressPrefixes": [
"10.212.0.0/16"
]
},
"dhcpOptions": {
"dnsServers": []
},
"subnets": [
{
"name": "subnet01",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/subnet01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"properties": {
"provisioningState": "Succeeded",
"addressPrefix": "10.212.128.0/20",
"networkSecurityGroup": {
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/subnet01nsg"
},
"routeTable": {
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/apps
n01route"
},
"serviceEndpoints": [],
"delegations": []
},
"type": "Microsoft.Network/virtualNetworks/subnets"
}
],
"virtualNetworkPeerings": [],
"enableDdosProtection": false,
"enableVmProtection": false
}
}

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

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtual
Networks/npduseavnet01?api-version=2018-11-01

Headers:
x-ms-client-request-id : 6d75e633-c79f-465c-aa0b-dbdc34ad76ef
accept-language : en-US

Body:
{
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.212.0.0/16"
]
},
"dhcpOptions": {
"dnsServers": []
},
"subnets": [
{
"properties": {
"addressPrefix": "10.212.112.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/trusn01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/trus
n01route",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "trusn01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/trusn01"
},
{
"properties": {
"addressPrefix": "10.212.32.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/mgtsn01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/mgts
n01route",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "mgtsn01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/mgtsn01"
},
{
"properties": {
"addressPrefix": "10.212.48.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/dmzsn01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/dmzs
n01route",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "dmzsn01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/dmzsn01"
},
{
"properties": {
"addressPrefix": "10.212.160.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/asesn01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/ases
n01route",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "asesn01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/asesn01"
},
{
"properties": {
"addressPrefix": "10.212.144.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/sqlsn01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/sqls
n01route",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "sqlsn01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/sqlsn01"
},
{
"properties": {
"addressPrefix": "10.212.0.240/28",
"addressPrefixes": [],
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/Gate
waySubnetroute",
"tags": {}
},
"serviceEndpoints": [],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "GatewaySubnet",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/GatewaySubnet"
},
{
"properties": {
"addressPrefix": "10.212.128.0/20",
"addressPrefixes": [],
"networkSecurityGroup": {
"properties": {
"securityRules": [],
"defaultSecurityRules": []
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/networkSecurityG
roups/subnet01nsg",
"tags": {}
},
"routeTable": {
"properties": {
"routes": [],
"disableBgpRoutePropagation": false
},
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/routeTables/apps
n01route",
"tags": {}
},
"serviceEndpoints": [
{
"service": "Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint",
"locations": []
},
{
"service": "Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint",
"locations": []
}
],
"serviceEndpointPolicies": [],
"resourceNavigationLinks": [],
"serviceAssociationLinks": [],
"delegations": [],
"provisioningState": "Succeeded"
},
"name": "subnet01",
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npdu
seavnet01/subnets/subnet01"
}
],
"virtualNetworkPeerings": [],
"resourceGuid": "d95bcfbb-26cd-4cc7-8996-ff441d1e1eea",
"provisioningState": "Succeeded",
"enableDdosProtection": false
},
"etag": "W/\"a8a1558e-f829-484c-a7aa-293d85ae07e9\"",
"id": "/subscriptions/53218f64-9d8e-40d9-9bcb-c03e038a134a/resourceGroups/networkRG/providers/Microsoft.Network/virtualNetworks/npduseavne
t01",
"location": "eastus",
"tags": {
"CreatedBy": "CLewis@3cloudsolutions.com",
"CreatedDate": "03/08/19",
"NS_Location": "USEA - US East",
"NS_Application": "NET - Network Resources",
"NS_Environment": "NPD - NonProduction"
}
}

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

Status Code:
BadRequest

Headers:
Pragma : no-cache
x-ms-request-id : 0b2dffc0-ebc2-4415-9b30-20211e66c4da
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: 1199
x-ms-correlation-request-id : 1730a418-9cea-41e7-b84d-5ea5c701425b
x-ms-routing-request-id : NORTHCENTRALUS:20190309T030016Z:1730a418-9cea-41e7-b84d-5ea5c701425b
X-Content-Type-Options : nosniff
Date : Sat, 09 Mar 2019 03:00:15 GMT

Body:
{
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": []
}
}

Set-AzureRmVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : '0b2dffc0-ebc2-4415-9b30-20211e66c4da'
At line:1 char:5
+ Set-AzureRmVirtualNetwork -VirtualNetwork $vnet -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzVirtualNetwork], NetworkCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureVirtualNetworkCommand

DEBUG: AzureQoSEvent: CommandName - Set-AzVirtualNetwork; IsSuccess - False; Duration - 00:00:08.0310332; Exception - Microsoft.Azure.Commands.
Network.Common.NetworkCloudException: Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : '0b2dffc0-ebc2-4415-9b30-20211e66c4da' ---> Microsoft.Rest.Azure.CloudException: Cannot parse the request.
at Microsoft.Azure.Management.Network.VirtualNetworksOperations.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.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.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 resou
rceGroupName, 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: 9:00:19 PM - SetAzureVirtualNetworkCommand end processing.
DEBUG: 9:00:19 PM - SetAzureVirtualNetworkCommand end processing.

```

```

## Error output

```
PS C:\VSProjects\RevSprings-ARSF\SubnetServiceEndpoints> Resolve-AzureRmError

HistoryId: 18

RequestId :
Message : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : '0b2dffc0-ebc2-4415-9b30-20211e66c4da'
ServerMessage :
ServerResponse :
RequestMessage :
InvocationInfo : {Set-AzVirtualNetwork}
Line : Set-AzureRmVirtualNetwork -VirtualNetwork $vnet -Debug
Position : At line:1 char:5
+ Set-AzureRmVirtualNetwork -VirtualNetwork $vnet -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId : 18

HistoryId: 10

RequestId :
Message : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'f74a292a-02cf-4836-bf28-aac3ad2ff233'
ServerMessage :
ServerResponse :
RequestMessage :
InvocationInfo : {Set-AzVirtualNetwork}
Line : Set-AzureRmVirtualNetwork -VirtualNetwork $vnet

Position : At line:9 char:5
+ Set-AzureRmVirtualNetwork -VirtualNetwork $vnet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
HistoryId : 10

HistoryId: -1

Message : You cannot call a method on a null-valued expression.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoints.Add($ServiceEndPoint)
Position : At line:14 char:1
+ $ServiceEndPoints.Add($ServiceEndPoint)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Locations' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object[] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Locations = @("EastUS","WestUS")

Position : At line:13 char:1
+ $ServiceEndPoint.Locations = @("EastUS","WestUS")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Service' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Service = "Microsoft.Storage"

Position : At line:12 char:1
+ $ServiceEndPoint.Service = "Microsoft.Storage"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : Unable to find type [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint].
StackTrace : at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]::new()

Position : At line:11 char:20
+ ... eEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : You cannot call a method on a null-valued expression.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoints.Add($ServiceEndPoint)

Position : At line:10 char:1
+ $ServiceEndPoints.Add($ServiceEndPoint)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Locations' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object[] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Locations = @("EastUS","WestUS")

Position : At line:9 char:1
+ $ServiceEndPoint.Locations = @("EastUS","WestUS")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Service' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Service = "Microsoft.SQL"

Position : At line:8 char:1
+ $ServiceEndPoint.Service = "Microsoft.SQL"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : Unable to find type [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint].
StackTrace : at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]::new()

Position : At line:7 char:20
+ ... eEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

HistoryId: 6

Message : Cannot find type [System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]]: verify that
the assembly containing this type is loaded.
StackTrace : at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Exception : System.Management.Automation.PSArgumentException
InvocationInfo : {New-Object}
Line : $ServiceEndPoints = New-Object 'System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]'

Position : At line:6 char:21
+ ... EndPoints = New-Object 'System.Collections.Generic.List[Microsoft.Azu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 6

HistoryId: -1

Message : You cannot call a method on a null-valued expression.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoints.Add($ServiceEndPoint)
Position : At line:14 char:1
+ $ServiceEndPoints.Add($ServiceEndPoint)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Locations' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object[] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Locations = @("EastUS","WestUS")

Position : At line:13 char:1
+ $ServiceEndPoint.Locations = @("EastUS","WestUS")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Service' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Service = "Microsoft.Storage"

Position : At line:12 char:1
+ $ServiceEndPoint.Service = "Microsoft.Storage"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : Unable to find type [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint].
StackTrace : at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]::new()

Position : At line:11 char:20
+ ... eEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : You cannot call a method on a null-valued expression.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoints.Add($ServiceEndPoint)

Position : At line:10 char:1
+ $ServiceEndPoints.Add($ServiceEndPoint)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Locations' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , Object[] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Locations = @("EastUS","WestUS")

Position : At line:9 char:1
+ $ServiceEndPoint.Locations = @("EastUS","WestUS")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : The property 'Service' cannot be found on this object. Verify that the property exists and can be set.
StackTrace : at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint.Service = "Microsoft.SQL"

Position : At line:8 char:1
+ $ServiceEndPoint.Service = "Microsoft.SQL"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

Message : Unable to find type [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint].
StackTrace : at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)
at System.Management.Automation.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line : $ServiceEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]::new()

Position : At line:7 char:20
+ ... eEndPoint = [Microsoft.Azure.Commands.Network.Models.PSServiceEndpoin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : -1

HistoryId: 2

Message : Cannot find type [System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]]: verify that
the assembly containing this type is loaded.
StackTrace : at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Exception : System.Management.Automation.PSArgumentException
InvocationInfo : {New-Object}
Line : $ServiceEndPoints = New-Object 'System.Collections.Generic.List[Microsoft.Azure.Commands.Network.Models.PSServiceEndpoint]'

Position : At line:6 char:21
+ ... EndPoints = New-Object 'System.Collections.Generic.List[Microsoft.Azu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 2

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.