2
votes

When applying the allowed resource type policy through the Azure portal, there is a drop down with hundreds of available resource types that can be selected as assignment parameters. Does anyone know how this list is generated or where can I query for the contents so that I can create new policies programmatically?

I have created a powershell block to query available azure resource providers and their resource types but the matching list is several hundred resource types shorter than the list that is displayed in the azure portal.

$resourceTypes = @()
$resourceProviders = Get-AzResourceProvider -ListAvailable
foreach ($resourceProvider in $resourceProviders) {
    foreach ($resourceType in $resourceProvider.resourceTypes) {
        $fullResourceTypeName = $resourceProvider.ProviderNamespace + "/" + $resourceType.ResourceTypeName
        $resourceTypes += $fullResourceTypeName
    }
}

I would like to be able to download the contents of the drop down list so I see all the available resource types available to white list.

1
there is no other way of querying resource providers, can you show an example of a missing resource provider?4c74356b41

1 Answers

0
votes

To see the resource types for a resource provider, use:

(Get-AzResourceProvider -ProviderNamespace {Namespace}).ResourceTypes.ResourceTypeName

I got this from this link https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services