Azure / Azure/azurestack-powershell
Get-Azs*Quota throws error when quota doesn't exist
- Dominant language
- PowerShell
- Stars
- 16
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
When you run the following command:
Get-AzsStorageQuota -Name "DoesNotExist"
Instead of returning $null, it throws an error. This should is no the expected behavior.
```
============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/d6446c5c-0c5e-4899-9af0-ee6dde60c397/providers/Microsoft.Storage.Admin/locations/local/quotas/ascanstorquota510?api-version=2019-08-
08-preview
Headers:
Body:
BeforeCall:
============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Pragma : no-cache
x-ms-correlation-request-id : bc200d00-b9bc-4d5a-b364-2bfeaeabd70a
x-ms-ratelimit-remaining-subscription-reads: 14955
x-ms-request-id : bc200d00-b9bc-4d5a-b364-2bfeaeabd70a
x-ms-routing-request-id : LOCAL:20210517T230009Z:bc200d00-b9bc-4d5a-b364-2bfeaeabd70a
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Mon, 17 May 2021 23:00:09 GMT
Server : Microsoft-HTTPAPI/2.0
WWW-Authenticate : oYG3MIG0oAMKAQChCwYJKoZIgvcSAQICooGfBIGcYIGZBgkqhkiG9xIBAgICAG+BiTCBhqADAgEFoQMCAQ+iejB4oAMCARKicQRvIU8qOXigYqrxMa3MM5fwqeo6Nmx+FR3CZ6yx9SG7IjE
zAPIR+UipPmlpIg+N1lmR/HJ1n7ErdjhHw9NnA7kJabX2HmNJTOFrZM7utsrmSYQMc576wrYHH3cdV86pmGKq2x82GldbR0yLabKp4j9J
Body:
{
"code": "QuotaNotFound",
"message": "The specified quota was not found.",
"target": "ascanstorquota510"
}
ResponseCreated:
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.EventData
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.EventData
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.EventData
BeforeResponseDispatch:
Get-AzsStorageQuota_Get : The specified quota was not found.
At C:\az.0.10.0\Azs.Storage.Admin\0.9.0\internal\ProxyCmdletDefinitions.ps1:130 char:23
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ SubscriptionI...nstorquota510 }:<>f__AnonymousType0`3) [Get-AzsStorageQuota_Get], Exception
+ FullyQualifiedErrorId : QuotaNotFound,Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Cmdlets.GetAzsStorageQuota_Get
[Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSResourceNotFoundCloudException: InternalException' from response
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with Get-AzsStorageQuota -Name "DoesNotExist" and inspect the cmdlet path shown in internal/ProxyCmdletDefinitions.ps1. Start with the handling of the QuotaNotFound response and verify the command returns $null for a missing quota without changing other errors. Done means the not-found case no longer throws an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100