Show more details on errors for New-AzVirtualNetwork when there are duplicate Subnets
Problem
When using array object for the Subnet parameter of New-AzVirtualNetwork command. If there is a duplicate subnet (same name) we get the following error:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'f5cdb7f6-c616-40fd-91b3-c20d05bba58c'
At line:1 char:9
+ $VNet = New-AzVirtualNetwork -Name $VNetName -ResourceGroupName $RGNa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzVirtualNetwork], NetworkCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkCommand
By enabling -Debug we can see the actual issue:
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": [
{
"code": "DuplicateResourceName",
"message": "Resource /subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/ has two child resources with the same name (SL-App)."
}
]
}
Proposed implementation details (optional)
Allow the error message to include why the command has failed instead of juts saying 400 / Bad request
@avijitgupta @chandrasekarsrinivasan hey folks, would one of you be able to take a look at the above feature request? This should just be about properly bubbling up the underlying exception message when an error is thrown on the server.
- @Amol Bhattadmailto:[email protected] who is the VNET owner.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Cormac McCarthy [email protected] Sent: Tuesday, August 27, 2019 1:00:26 PM To: Azure/azure-powershell [email protected] Cc: Chandrasekar Srinivasan [email protected]; Mention [email protected] Subject: Re: [Azure/azure-powershell] Show more details on errors for New-AzVirtualNetwork when there are duplicate Subnets (#9920)
@avijitguptahttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Favijitgupta&data=02%7C01%7Cchsrini%40microsoft.com%7C88bea1682aac429cabf508d72b2934e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637025328299697678&sdata=5CSqHdRGXw9QUGbk%2BlRVdd1ZagkKRhhAnQ0YnAOwmBM%3D&reserved=0 @chandrasekarsrinivasanhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchandrasekarsrinivasan&data=02%7C01%7Cchsrini%40microsoft.com%7C88bea1682aac429cabf508d72b2934e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637025328299697678&sdata=f7lUPf%2BWENARkamYPfqalyGq2kl0wJq9iEmtM8WK%2FHM%3D&reserved=0 hey folks, would one of you be able to take a look at the above feature request? This should just be about properly bubbling up the underlying exception message when an error is thrown on the server.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fissues%2F9920%3Femail_source%3Dnotifications%26email_token%3DAH5ZC4JOFCTIAO2U7OQJ2HLQGWBVVA5CNFSM4IQDNTMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5I5U3Y%23issuecomment-525458031&data=02%7C01%7Cchsrini%40microsoft.com%7C88bea1682aac429cabf508d72b2934e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637025328299707673&sdata=kTDWS3o9MJgAwbHraJzv6Tujna2S%2BuJxiBjoKyIVjHw%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAH5ZC4JTAGLTY5J32HHKN7TQGWBVVANCNFSM4IQDNTMA&data=02%7C01%7Cchsrini%40microsoft.com%7C88bea1682aac429cabf508d72b2934e1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637025328299707673&sdata=WqeLtZ3gtBpxh0JtpujGXggtRW5pgz%2Boy0nrkmmq6oM%3D&reserved=0.
I could improve Network's class for parsing cloud exceptions to check for details. Will try to get it into the next release
Opened PR with improvement: https://github.com/Azure/azure-powershell/pull/9924 Example of new output (I'm open to formatting suggestions)
New-AzVirtualNetwork : Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: InvalidRequestFormat
ErrorMessage: Cannot parse the request.
Additional details:
Code: DuplicateResourceName
Message: Resource /subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/ has two child resources with the same name (subnet).
OperationID : d8b924a7-9819-4a19-b962-8da10bf549b1
At line:3 char:1
+ New-AzVirtualNetwork -Name vnet-e -ResourceGroupName
PR with the fix got merged: https://github.com/Azure/azure-powershell/pull/9924 ETA for the next release: 9/24
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.
Issue Details
Problem
When using array object for the Subnet parameter of New-AzVirtualNetwork command. If there is a duplicate subnet (same name) we get the following error:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'f5cdb7f6-c616-40fd-91b3-c20d05bba58c'
At line:1 char:9
+ $VNet = New-AzVirtualNetwork -Name $VNetName -ResourceGroupName $RGNa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzVirtualNetwork], NetworkCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkCommand
By enabling -Debug we can see the actual issue:
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": [
{
"code": "DuplicateResourceName",
"message": "Resource /subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/ has two child resources with the same name (SL-App)."
}
]
}
Proposed implementation details (optional)
Allow the error message to include why the command has failed instead of juts saying 400 / Bad request
| Author: | WillyMoselhy |
|---|---|
| Assignees: | avijitgupta, chandrasekarsrinivasan |
| Labels: |
|
| Milestone: | - |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @vnetsuppgithub.
Issue Details
Problem
When using array object for the Subnet parameter of New-AzVirtualNetwork command. If there is a duplicate subnet (same name) we get the following error:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'f5cdb7f6-c616-40fd-91b3-c20d05bba58c'
At line:1 char:9
+ $VNet = New-AzVirtualNetwork -Name $VNetName -ResourceGroupName $RGNa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzVirtualNetwork], NetworkCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkCommand
By enabling -Debug we can see the actual issue:
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": [
{
"code": "DuplicateResourceName",
"message": "Resource /subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks/ has two child resources with the same name (SL-App)."
}
]
}
Proposed implementation details (optional)
Allow the error message to include why the command has failed instead of juts saying 400 / Bad request
| Author: | WillyMoselhy |
|---|---|
| Assignees: | avijitgupta, chandrasekarsrinivasan |
| Labels: |
|
| Milestone: | - |
@vnetsuppgithub Do you have any updates on this.
:bell: Routing this issue to @act-quality-productivity-squad.