Closed tmeadon closed 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @vaibhav-agar.
Author: | tommagumma |
---|---|
Assignees: | - |
Labels: | `Compute - Managed Disks`, `Service Attention`, `customer-reported`, `question` |
Milestone: | - |
@Vaibhav-Agar could you please take a look at this issue?
Hi @tommagumma,
Thanks for opening the issue. The behavior is as per design where 'Get' supports $null but 'Remove' doesn't support $null. So, the edge case you are mentioning will not occur. I am closing the issue but please feel free to reopen if the response doesn't make sense or if you have further questions. Thanks!
Description
When running the command
Get-AzDisk -Name $null
, all disks in the connected subscription are returned. This creates a possibility of unexpected results, for example:If
$vm.StorageProfile.OsDisk.Name
is$null
thenRemove-AzDisk
will proceed to attempt to remove all disks in the subscription. Clearly this can be prevented by adding appropriate checks but as a user I would expect the first command to fail.Perhaps a
PSBoundParameters
check could be added toGet-AzDisk
to differentiate between valid requests for all disks in the subscription (executed without the-Name
parameter) and requests for a specific disk (but where the value supplied for the-Name
parameter is unexpectedly$null
).Steps to reproduce
Environment data
Module versions
Debug output
Error output