Register Service Providers

This script registers resource providers for compute, networking, storage,
databases, monitoring, security, and other essential Azure services.

Requires Azure PowerShell module (Az) and authenticated session (Connect-AzAccount)
Run this script in PowerShell with admin privileges

PowerShell
# List of common resource providers to register
$resourceProviders = @(
    # Core Compute
    "Microsoft.Compute",
    "Microsoft.ContainerService",
    "Microsoft.ContainerRegistry",
    "Microsoft.ServiceFabric",
    
    # Networking
    "Microsoft.Network",
    "Microsoft.NetworkFunction",
    
    # Storage
    "Microsoft.Storage",
    "Microsoft.StorageSync",
    
    # Databases
    "Microsoft.DBforPostgreSQL",
    "Microsoft.DBforMySQL",
    "Microsoft.Sql",
    "Microsoft.Cache",
    "Microsoft.DocumentDB",
    
    # Monitoring & Management
    "Microsoft.Insights",
    "Microsoft.AlertsManagement",
    "Microsoft.OperationalInsights",
    "Microsoft.Monitor",
    
    # Backup & Recovery
    "Microsoft.RecoveryServices",
    "Microsoft.DataProtection",
    "Microsoft.Backup",
    
    # Security
    "Microsoft.Security",
    "Microsoft.KeyVault",
    "Microsoft.Authorization",
    
    # Web & Mobile
    "Microsoft.Web",
    "Microsoft.ApiManagement",
    
    # AI & Machine Learning
    "Microsoft.MachineLearningServices",
    "Microsoft.CognitiveServices",
    
    # IoT
    "Microsoft.Devices",
    "Microsoft.EventGrid",
    
    # Analytics
    "Microsoft.StreamAnalytics",
    "Microsoft.DataFactory",
    "Microsoft.Databricks",
    "Microsoft.Synapse",
    
    # Identity
    "Microsoft.AAD",
    
    # Management
    "Microsoft.PolicyInsights",
    "Microsoft.ResourceGraph",
    "Microsoft.ManagedServices",
    "Microsoft.CostManagement",
    
    # DevOps
    "Microsoft.DevOps"
)

# Initialize progress counter
$totalProviders = $resourceProviders.Count
$currentProvider = 0

Write-Host "Starting registration of $totalProviders Azure resource providers..."

foreach ($provider in $resourceProviders) {
    $currentProvider++
    $progress = [math]::Round(($currentProvider / $totalProviders) * 100)
    
    Write-Progress -Activity "Registering Resource Providers" -Status "$progress% Complete:" -PercentComplete $progress -CurrentOperation "Registering $provider"
    
    $registrationState = Get-AzResourceProvider -ProviderNamespace $provider | Select-Object -ExpandProperty RegistrationState
    
    if ($registrationState -ne "Registered") {
        Write-Host "Registering $provider..."
        Register-AzResourceProvider -ProviderNamespace $provider
    } else {
        Write-Host "$provider is already registered."
    }
}

Write-Host "Resource provider registration process completed."
Write-Host "Some registrations may take several minutes to complete. You can check status with:"
Write-Host "Get-AzResourceProvider -ListAvailable | Select-Object ProviderNamespace, RegistrationState | Sort-Object ProviderNamespace"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.