Get-AzureRmPolicyDefinition cannot get builtin policies by using name parameter #5747
Labels
Policy
Azure Resource Policy
Resource Authorization
AzRole* in Az.Resources
Service Attention
This issue is responsible by Azure service team.
Description
Right now you cannot use
Get-AzureRmPolicyDefinition
with the-Name
parameter to get a specific builtin policy definition as it will throw a not found exception. Instead you need to run the cmdlet and pipe it toWhere-Object
which is not optimal.The reason this happens is that the builtin policies are not exposed through the subscriptions route but actually through the providers route
Won't work:
Does work:
Azure cli deals with this as expected by querying the providers route uri when a 404 was received on the subscriptions route uri. I would expect AzureRm equivalent to have the same behavior.
Script/Steps for Reproduction
This will fail:
This does work:
Module Version
Environment Data
The text was updated successfully, but these errors were encountered: