Skip to content

Commit 41191fc

Browse files
authored
Merge pull request #233738 from tamram/tamram23-0406
classic account migration: add PSH examples
2 parents e4f50be + 42b93d5 commit 41191fc

File tree

2 files changed

+75
-16
lines changed

2 files changed

+75
-16
lines changed

articles/storage/common/classic-account-migrate.md

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: tamram
77

88
ms.service: storage
99
ms.topic: how-to
10-
ms.date: 03/27/2023
10+
ms.date: 04/06/2023
1111
ms.author: tamram
1212
ms.subservice: common
1313
---
@@ -37,30 +37,37 @@ To list classic storage accounts in your subscription with PowerShell, run the f
3737
Get-AzResource -ResourceType Microsoft.ClassicStorage/storageAccounts
3838
```
3939

40-
# [Azure CLI](#tab/azure-cli)
40+
---
4141

42-
To list classic storage accounts in your subscription with Azure CLI, run the following command:
42+
## Migrate a classic storage account
4343

44-
```azurecli
45-
$ az resource list \
46-
--resource-type Microsoft.ClassicStorage/storageAccounts \
47-
--query "[].{resource_type:type, name:name}" \
48-
--output table
49-
```
44+
The process of migrating a classic storage account involves four steps:
5045

51-
---
46+
1. **Validate**. During the Validation phase, Azure checks the storage account to ensure that it can be migrated.
47+
1. **Prepare**. In the Prepare phase, Azure creates a new general-purpose v1 storage account and alerts you to any problems that may have occurred. The new account is created in a new resource group in the same region as your classic account.
5248

53-
## Migrate a classic storage account
49+
At this point your classic storage account still exists. If there are any problems reported, you can correct them or abort the process.
50+
51+
1. **Check manually**. It's a good idea to make a manual check of the new storage account to make sure that the output is as you expect.
52+
1. **Commit or abort**. If you are satisfied that the migration has been successful, then you can commit the migration. Committing the migration permanently deletes the classic storage account.
53+
54+
If there are any problems with the migration, then you can abort the migration at this point. If you choose to abort, the new resource group and new storage account are deleted. Your classic account remains available. You can address any problems and attempt the migration again.
55+
56+
For more information about the migration process, see [Understand storage account migration from the classic deployment model to Azure Resource Manager](classic-account-migration-process.md)
57+
58+
You can migrate a classic storage account to the Azure Resource Manager deployment model with the Azure portal or PowerShell.
59+
60+
# [Portal](#tab/azure-portal)
5461

5562
To migrate a classic storage account to the Azure Resource Manager deployment model with the Azure portal:
5663

5764
1. Navigate to your classic storage account in the Azure portal.
58-
1. In the **Settings** section, click **Migrate to ARM**.
59-
1. Click on **Validate** to determine migration feasibility.
65+
1. In the **Settings** section, select **Migrate to ARM**.
66+
1. Select **Validate** to determine migration feasibility.
6067

6168
:::image type="content" source="./media/classic-account-migrate/validate-storage-account.png" alt-text="Screenshot showing how to migrate your classic storage account to Azure Resource Manager." lightbox="./media/classic-account-migrate/validate-storage-account.png":::
6269

63-
1. After a successful validation, click on **Prepare** button to simulate the migration.
70+
1. After a successful validation, select **Prepare** button to simulate the migration.
6471

6572
> [!IMPORTANT]
6673
> There may be a delay of a few minutes after validation is complete before the Prepare button is enabled.
@@ -74,6 +81,58 @@ To migrate a classic storage account to the Azure Resource Manager deployment mo
7481
1. If you're not satisfied with the results of the migration, select **Abort** to delete the new storage account and resource group. You can then address any problems and try again.
7582
1. When you're ready to commit, type **yes** to confirm, then select **Commit** to complete the migration.
7683

84+
# [PowerShell](#tab/azure-powershell)
85+
86+
To migrate a classic storage account to the Azure Resource Manager deployment model with PowerShell, you'll need to use the Azure PowerShell Service Management module. To learn how to install this module, see [Install and configure the Azure PowerShell Service Management module](/powershell/azure/servicemanagement/install-azure-ps#checking-the-version-of-azure-powershell). The key steps are included here for convenience.
87+
88+
> [!NOTE]
89+
> The cmdlets in the Azure Service Management module are for managing legacy Azure resources that use Service Management APIs, including classic storage accounts. This module includes the commands needed to migrate a classic storage account to Azure Resource Manager.
90+
>
91+
> To manage Azure Resource Manager resources, we recommend that you use the Az PowerShell module. The Az module replaces the deprecated AzureRM module. For more information about moving from the AzureRM module to the Az module, see [Migrate Azure PowerShell scripts from AzureRM to Az](/powershell/azure/migrate-from-azurerm-to-az).
92+
93+
First, install PowerShellGet if you do not already have it installed. For more information on how to install PowerShellGet, see [Installing PowerShellGet](/powershell/scripting/gallery/installing-psget#installing-the-latest-version-of-powershellget). After you install PowerShellGet, close and reopen the PowerShell console.
94+
95+
Next, install the Azure Service Management module. If you also have the AzureRM module installed, you'll need to include the `-AllowClobber` parameter, as described in [Step 2: Install Azure PowerShell](/powershell/azure/servicemanagement/install-azure-ps#step-2-install-azure-powershell). After the installation is complete, import the Azure Service Management module.
96+
97+
```azurepowershell
98+
Install-Module -Name Azure -AllowClobber
99+
Import-Module -Name Azure
100+
```
101+
102+
Log into your account by running [Add-AzureAccount](/powershell/module/servicemanagement/azure/add-azureaccount). Then call [Select-AzureSubscription](/powershell/module/servicemanagement/azure/select-azuresubscription) to set your current subscription. Remember to replace the placeholder values in brackets with your subscription name:
103+
104+
```azurepowershell
105+
Add-AzureAccount
106+
Select-AzureSubscription -SubscriptionName <subscription-name>
107+
```
108+
109+
To validate that the account is ready for migration, call the [Move-AzureStorageAccount](/powershell/module/servicemanagement/azure/move-azurestorageaccount) command. Remember to replace the placeholder values in brackets with the name of your classic storage account:
110+
111+
```azurepowershell
112+
$accountName = "<storage-account>"
113+
Move-AzureStorageAccount -Validate -StorageAccountName $accountName
114+
```
115+
116+
Next, prepare the account for migration:
117+
118+
```azurepowershell
119+
Move-AzureStorageAccount -Prepare -StorageAccountName $accountName
120+
```
121+
122+
Check the configuration for the prepared storage account with either Azure PowerShell or the Azure portal. If you're not ready for migration, use the following command to revert your account to its previous state:
123+
124+
```azurepowershell
125+
Move-AzureStorageAccount -Abort -StorageAccountName $accountName
126+
```
127+
128+
Finally, when you are satisfied with the prepared configuration, move forward with the migration and commit the resources with the following command:
129+
130+
```azurepowershell
131+
Move-AzureStorageAccount -Commit -StorageAccountName $accountName
132+
```
133+
134+
---
135+
77136
### Locate and delete disk artifacts in a classic account
78137

79138
Classic storage accounts may contain classic (unmanaged) disks, virtual machine images, and operating system (OS) images. To migrate the account, you may need to delete these artifacts first.

articles/storage/common/classic-account-migration-process.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ There are four steps to the migration process, as shown in the following diagram
5151
If there are any problems with the migration, then you can abort the migration at this point. If you choose to abort, the new resource group and new storage account are deleted. Your classic account remains available. You can address any problems and attempt the migration again.
5252

5353
> [!NOTE]
54-
> The operations described in the following sections are all idempotent. If you have a problem other than an unsupported feature or a configuration error, retry the prepare, abort, or commit operation. Azure tries the action again.
54+
> The operations described in the following sections are all idempotent. If you have a problem other than an unsupported feature or a configuration error, retry the prepare, abort, or commit operation.
5555
5656
### Validate
5757

@@ -98,7 +98,7 @@ To revert your changes to the classic deployment model, you can choose to abort
9898
After you are satisfied that your classic storage account has been migrated successfully, you can commit the migration. Committing the migration deletes your classic storage account. Your data is now available only in the newly migrated account in the Resource Manager deployment model.
9999

100100
> [!NOTE]
101-
> Committing the migration is an idempotent operation. If it fails, retry the operation. If it continues to fail, create a support ticket or ask a question on [Microsoft Q&A](/answers/index.html)
101+
> Committing the migration is an idempotent operation. If it fails, retry the operation. If it continues to fail, create a support ticket or ask a question on [Microsoft Q&A](/answers/index.html).
102102
103103
## After the migration
104104

0 commit comments

Comments
 (0)