Forum Discussion
API to retrieve if specific Azure resource type can be deployed in an Azure region
Since this is an installer app, we don't want to list existing resources (because they don't exist yet and will be deployed by the installer app) but need to find out if the required resource type (for example Azure SQL, App Service, Storage Account) can be deployed in the selected region. For example, the installer fails when a specific region is selected (let's say useast) that doesn't support Azure SQL (just an example...)
This is a screenshot of the dropdown with Azure Locations. This list is currently hardcoded but we'd like to find a way to get current status of what can or can't be installed in a specific region to populate the dropdown with the latest information
Hi, Pascal_KTeam
Thank you for your prompt response.
At present, I have not found a direct API to fulfil your requirements. However, I believe you can try using the following API to check whether it contains the resources you need for your installation:
HEAD https://management.azure.com/{resourceId}?api-version=2021-04-01
For further details, please refer to:
Resources - Check Existence By Id - REST API (Azure Resource Management) | Microsoft Learn
You can then use simple conditional statements to output the results.
if ($availability) {
Write-Host "$($location.displayName) supports $resourceType"
} else {
Write-Host "$($location.displayName) does NOT support $resourceType"
}
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.