Open ChristopherGLewis opened 5 years ago
@avijitgupta @chandrasekarsrinivasan Can you take a look?
This is only somewhat fixed - you can pass in an array of service endpoints
$serviceEndpoints = @("Microsoft.Sql","Microsoft.Storage")
Set-AzureRmVirtualNetworkSubnetConfig -Name $subnet.subnetName -VirtualNetwork $vnetObject -AddressPrefix $currentSubnetConfig.AddressPrefix -ServiceEndpoint $serviceEndpoints
but not the location
@ChristopherGLewis, Thank you for your patience - I'm looking into the issue and will update soon.
Assigning to ServiceEndpoint owner
@ajinkyapotdarvjti can you weigh in on this?
Also, when I set -ServiceEndpoint on "Add-AzVirtualNetworkSubnetConfig" to an empty string array "@()", I get an error when running Set-AzVirtualNetwork:
Subnet
I have a similar issue
`$vnName = "dbvnet" $sname = "default" $subnetPrefix = "10.2.0.0/24" $resourcegroupname = "Temp"
Get-AzurermVirtualNetwork -ResourceGroupName $resourcegroupname -Name $vnName | Set-AzurermVirtualNetworkSubnetConfig -Name $sname -AddressPrefix $subnetPrefix -ServiceEndpoint "Microsoft.AzureCosmosDB" | Set-AzurermVirtualNetwork
I authenticate using Service Principal and this code creates the service endpoint when I execute it from my local machine. The same code if run on a azure DevOps pipeline, it fails with the below error
I have tried installing running Install-Module -Name AzureRM.Network -RequiredVersion 5.4.2. This does not help either.
Any guidance on this ?
@viswanathtr, @rtaylor72 are you still experiencing the same issues? Assigning @sumeetmittal to take a look
@allegradomel , has a new version been deployed since then? Should be easy to test since the error appears when that one property is set to an empty array.
@allegradomel this still does not work. attempting to run Set-AzVirtualNetworkSubnetConfig -name $vnetSub.name -VirtualNetwork $vnet -ServiceEndpoint $serviceEndPoints -AddressPrefix $vnetSub.AddressPrefix wont error out anymore and running a get command shows the service endpoint was added, but not accurately and isn't reflected in the portal anywhere either.
This bug is over two years old - @allegradomel @Am018 any updates on this?
Experiencing the same issue and was surprised to find this issue open for so long. Is anyone able to get this resolved please @allegradomel @sumeetmittal
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.
Steps to reproduce
Note that I can set the ServiceEndpoints by bypassing Set-AzVirtualNetworkSubnetConfig
Environment data
Module versions
Debug output
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
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.d14.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