Is there a way to extract azure resource template formats programmatically (REST API, Powershell, Azure CLI)?
The end result should be something along the lines of the JSON presented here, that includes datatypes etc.: https://learn.microsoft.com/en-us/azure/templates/Microsoft.KeyVault/vaults?tabs=json
Preferably being able to select API-version too: https://learn.microsoft.com/en-us/azure/templates/Microsoft.KeyVault/2015-06-01/vaults?tabs=json
I have tried using az provider
and expand properties, but properties are always null.
az provider show -n Microsoft.KeyVault --expand resourceTypes/properties
az resource
seems only to work on existing resources.
If you just want to extract Azure ARM template format, try the PowerShell below:
$webRequest = Invoke-WebRequest "https://learn.microsoft.com/en-us/azure/templates/Microsoft.KeyVault/2019-09-01/vaults"
$webRequest.ParsedHTML.getElementsByClassName("lang-json") | % innerHTML