user9360564
user9360564

Reputation: 385

List of all azure resource types in Azure?

Is there anywhere you can get a full list of all the resource types offered by Azure? I'm doing policy/role management and there doesn't seem to be a great place to look for all resource types. Currently I've been using the Get-AzureRmProviderOperation but this still doesn't show everything. For example, there's no option for Microsoft.Botservice

Upvotes: 14

Views: 26086

Answers (4)

Fbbc
Fbbc

Reputation: 1

Example using “az provider list”

$OutFileName = "resourcetypes.txt"
$output = @()   

$azproviders = az provider list | ConvertFrom-Json

foreach ($provider in $azproviders) { 
  foreach ($type in $provider.resourceTypes) 
  { 
    $output += $provider.namespace + "/" + $type.resourceType 
  } 
}
$output | Out-File $OutFileName

Upvotes: 0

Alberto
Alberto

Reputation: 853

Flagging the entire list is also available here for the resource providers and here for the types and actions

Upvotes: 8

PramodValavala
PramodValavala

Reputation: 6647

You can use the Providers - List API along with the $expand=resourceTypes/aliases query a parameter to give you everything that you need.

You can get all the resource types by 1. Appending namespace and resourceTypes[*].resourceType within each provider returned 2. The name of each alias is a resource type name already

Here is a simple nodejs script to get all the resource types sorted into a file

const fs = require('fs');

var a = <resource-provider-api-response-as-json-object>;

let final = [];

var b = a.value.forEach(p => {
  let ns = p.namespace;

  let rsts = p.resourceTypes.map(rst => ns + '/' + rst.resourceType);
  final = final.concat(rsts);

  p.resourceTypes.forEach(rst => {
    let aliases = rst.aliases.map(a => a.name)

    final = final.concat(aliases);
  });
});

final.sort();

fs.writeFile("random.data", final.join('\n'), function(err) {
  if(err) {
      return console.log(err);
  }

  console.log("The file was saved!");
}); 

Also, if you using bash with az and jq installed, you could simply run this :)

az provider list --expand resourceTypes/aliases | jq '[ .[].namespace + "/" + .[].resourceTypes[].resourceType , .[].resourceTypes[].aliases[]?.name ] | unique | sort' | less

You could just pipe the output to a file too for your use in other scripts, etc.

Upvotes: 4

Merivale
Merivale

Reputation: 11

Note that if you want to see the template references then you can go to https://learn.microsoft.com/en-us/azure/templates/. Note that as of this date, some resource types are missing (e.g. 'SendGrid.Email/accounts')

Upvotes: 0

Related Questions