Last active
January 23, 2026 01:44
-
-
Save shibayan/e37307ba05a91cac884872505a4625f6 to your computer and use it in GitHub Desktop.
Script to bulk register frequently used Resource Providers with an Azure subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| # Azure Resource Providers Registration Script | |
| # Registers common PaaS / Serverless resource providers | |
| readonly RESOURCE_PROVIDERS=( | |
| # Core Infrastructure | |
| "Microsoft.Compute" | |
| "Microsoft.Network" | |
| "Microsoft.Storage" | |
| "Microsoft.Resources" | |
| "Microsoft.Authorization" | |
| "Microsoft.CloudShell" | |
| # Containers | |
| "Microsoft.ContainerInstance" | |
| "Microsoft.ContainerRegistry" | |
| "Microsoft.ContainerService" | |
| # PaaS / Serverless | |
| "Microsoft.Web" | |
| "Microsoft.Logic" | |
| "Microsoft.ApiManagement" | |
| "Microsoft.SignalRService" | |
| # Databases | |
| "Microsoft.Sql" | |
| "Microsoft.DBforMySQL" | |
| "Microsoft.DBforPostgreSQL" | |
| "Microsoft.DocumentDB" | |
| "Microsoft.Cache" | |
| # AI / Search | |
| "Microsoft.CognitiveServices" | |
| "Microsoft.Search" | |
| # Messaging | |
| "Microsoft.EventGrid" | |
| "Microsoft.EventHub" | |
| "Microsoft.ServiceBus" | |
| # Security / Identity | |
| "Microsoft.KeyVault" | |
| "Microsoft.ManagedIdentity" | |
| "Microsoft.Security" | |
| # Monitoring / Management | |
| "microsoft.insights" | |
| "Microsoft.OperationalInsights" | |
| "Microsoft.CostManagement" | |
| # Other | |
| "Microsoft.AppConfiguration" | |
| "Microsoft.Cdn" | |
| "Microsoft.RecoveryServices" | |
| ) | |
| echo "Registering ${#RESOURCE_PROVIDERS[@]} resource providers..." | |
| failed=() | |
| for provider in "${RESOURCE_PROVIDERS[@]}"; do | |
| if az provider register --namespace "$provider" > /dev/null 2>&1; then | |
| echo "✓ $provider" | |
| else | |
| echo "✗ $provider (failed)" | |
| failed+=("$provider") | |
| fi | |
| done | |
| echo "" | |
| echo "Registration initiated for $((${#RESOURCE_PROVIDERS[@]} - ${#failed[@]}))/${#RESOURCE_PROVIDERS[@]} providers." | |
| if [[ ${#failed[@]} -gt 0 ]]; then | |
| echo "Failed: ${failed[*]}" | |
| exit 1 | |
| fi | |
| echo "Note: Registration may take a few minutes to complete." |
Author
shibayan
commented
Mar 24, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment