Deleting Storage Account Pending Migration to SRP in Powershell

806572387 0 Reputation points
2024-04-29T21:46:30.1633333+00:00

After much research on these forums and online in general, I'm trying to run the following two commands in attempt to delete a storage account that is pending migration to SRP:

Move-AzureStorageAccount-Abort -StorageAccountName "storageaccountname"

Move-AzureStorageAccount-Commit -StorageAccountName "storageaccountname"

Error:

Move-AzureStorageAccount: GenericArguments[0], 'Microsoft.WindowsAzure.Management.Compute.Models.DataDiskConfigurationCreateParameters', on 'System.Nullable1[T] MaxInteger[T](System.Collections.Generic.IEnumerable1[System.Nullable`1[T]])' violates the constraint of type 'T'.

This is the command I'm trying to run to delete the Resource Group:

Remove-AzResource "resourcegroupname"

Error:

AccountPendingMigrationToSrp The specified account is pending migration to SRP.

PS Version is:

Name Value


PSVersion 7.4.2

PSEdition Core

GitCommitId 7.4.2

OS Microsoft Windows 10.0.22631

Platform Win32NT

PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}

PSRemotingProtocolVersion 2.3

SerializationVersion 1.1.0.1

WSManStackVersion 3.0

Any help with this would be appreciated!

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,731 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,128 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nehruji R 2,501 Reputation points Microsoft Vendor
    2024-04-30T05:15:36.8333333+00:00

    Hello Jason McWhinnie,

    Greetings! Welcome to Microsoft Q&A Platform.

    I understand that you’re encountering issues with Azure PowerShell commands related to a storage account pending migration to SRP (Storage Resource Provider). The error messages indicate that there’s a problem with the migration process, which is preventing the deletion of the storage account and the resource group.

    If you’re certain that you want to abort the migration process, you can use the Move-AzureStorageAccount cmdlet with the -Abort parameter. However, it’s important to note that the AzureRM module will be retired, and it’s recommended to use the Az module instead. Since you’re using PowerShell 7.4.2, you should use the Az module commands. To abort the migration, you might need to use the Move-AzStorageAccount cmdlet with the -Abort parameter. If this cmdlet is not recognized, ensure that you have the latest version of the Az module installed.

    Once the migration has been aborted or completed, you can attempt to remove the storage account again using the Remove-AzStorageAccount cmdlet with the -Force parameter to bypass the confirmation prompt. If the storage account was the only resource within the resource group, you can then use the Remove-AzResourceGroup cmdlet to delete the resource group.

    Make sure you’re working within the correct Azure subscription context and please run in the below cmdlets in PowerShell:

    Cancel Migration : Move-AzureStorageAccount -Abort -StorageAccountName "Saname"

    Remove Storage Account: Remove-AzureStorageAccount -ResourceGroupName "RG01" -AccountName "mystorageaccount" -Force -debug -verbose

    Similar SO thread for reference - https://stackoverflow.com/questions/72360137/getting-accountpendingmigrationtosrp-the-specified-account-is-pending-migration, https://learn.microsoft.com/en-us/answers/questions/1499834/azure-storage-account-pending-migration-prevents-d

    Hope this answer helps! Please let us know if you have any further queries. I’m happy to assist you further.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.