如何从Service Management迁移至Azure Resource Manager?(Azure托管asmx服务场景)
Hey there, let's walk through how to migrate your ASMX web service from Azure Service Management (ASM) to Azure Resource Manager (ARM) step by step. I've helped several developers with this exact migration, so here's a clear, actionable guide:
前置准备工作
Before you start, take these quick steps to avoid hiccups:
- Backup your service: Export your ASMX web service's configuration from the Azure portal (under "Export template" for classic resources) or use PowerShell to create a backup of your app settings and content. This ensures you can roll back if needed.
- Run a compatibility check: Use Azure CLI to verify your classic App Service doesn't use ARM-unsupported features (like legacy virtual networks or deprecated extensions):
az cloud-service validate-migration --name <your-classic-web-service-name> --resource-group <target-arm-resource-group> - Pick a low-traffic window: Migration might cause a brief service interruption, so plan it during a time when users are least affected.
迁移步骤
You can choose either the Azure Portal (for a GUI-based approach) or PowerShell/CLI (for automation):
Option 1: Azure Portal (Simplest for One-Off Migrations)
- Log into the Azure Portal and navigate to your classic ASMX web service (it'll be marked as "Classic" in the resource type).
- In the left-hand menu, look for the Migrate to ARM option (if it's not visible, refresh the page or confirm your service passed the compatibility check).
- Follow the wizard:
- Select a target ARM resource group (create a new one if you don't have an existing one you want to use).
- Review the migration settings—most of your existing config (like app settings, SSL certificates, and scaling rules) will carry over automatically.
- Run the pre-migration check: The portal will flag any issues that block migration (e.g., dependent classic resources that need to be migrated first).
- Click Migrate once pre-checks pass. The process usually takes 5-15 minutes.
Option 2: Azure PowerShell (For Automation or Bulk Migrations)
- Make sure you have the latest Azure PowerShell Az module installed (the old Azure module won't work for ARM migrations).
- Log into both ASM and ARM environments:
Add-AzureAccount # For classic ASM Connect-AzAccount # For ARM - Select your subscription:
Select-AzureSubscription -SubscriptionName "<your-subscription-name>" Select-AzSubscription -SubscriptionName "<your-subscription-name>" - Validate your service is migration-ready:
$classicWebApp = Get-AzureWebsite -Name "<your-web-service-name>" Test-AzureRmResourceGroupDeployment -ResourceGroupName "<target-rg-name>" -TemplateParameterObject @{siteName = $classicWebApp.Name} - Execute the migration:
Note: You can use the same app name for the migrated resource if it's available in ARM.Move-AzureWebsite -Name "<your-web-service-name>" -DestinationResourceGroupName "<target-rg-name>" -DestinationWebAppName "<migrated-app-name>"
验证迁移结果
Once migration finishes, don't skip these checks:
- Navigate to your new ARM-based web service in the portal and confirm all settings (app settings, connection strings, SSL bindings) match the original.
- Test your ASMX service by accessing its URL and running sample requests to ensure functionality is intact.
- Check that the classic resource is marked as "Migrated"—you can delete it after confirming everything works (it won't affect the ARM resource).
Post-Migration Next Steps
- Update your management tools: Going forward, only use ARM-compatible tools for managing your service: Azure Portal (ARM view), Azure CLI (
azcommands), or Azure PowerShell Az module. Stop using any old ASM scripts or APIs. - Update automation workflows: If you had scripts for deploying, scaling, or configuring your service, rewrite them to use ARM APIs or commands.
- Monitor service health: Keep an eye on your service's metrics and logs for the first 24 hours post-migration to catch any unexpected issues early.
内容的提问来源于stack exchange,提问作者Ean
相关产品推荐
相关产品推荐

