Error Connecting to Azure ASR Via Powershell RRS feed

  • Question

  • Hello Technet Community

    Getting the following when connecting to Azure ARS via Powershell 

    WARNING: 10:02:27 a.m. - This parameter set will be deprecated soon. Please use other suitable parameter set.
    Get-AzureRmSiteRecoveryProtectionContainer : Operation failed.
    ClientRequestId: d78e50d1-0974-40ca-8ce1-a7a7c15e3eed-2017-01-16 21:02:29Z-P
    Object reference not set to an instance of an object.
    At line:1 char:1
    + Get-AzureRmSiteRecoveryProtectionContainer
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Get-AzureRmSite...ectionContainer], Exception
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.SiteRecovery.GetAzureRmSiteRecoveryProtectionContainer

    This is a very generic error and have not found any solutions on the net yet. Here is the code im using

    Import-Module AzureRM
    $cred = Get-Credential <My account>
    Login-AzureRmAccount -Credential $cred
    $Sub = get-AzureRmSubscription -TenantId "<My ID>"
    select-AzureRmSubscription -SubscriptionId Sub.SubscriptionId
    $vault = Get-AzureRmSiteRecoveryVault -Name <My vault>
    Set-AzureRmSiteRecoveryVaultSettings -ASRVault $vault
    $protectionContainer = Get-AzureRmSiteRecoveryProtectionContainer

    I need to return a container for the command Get-AzureRmSiteRecoveryProtectionEntity  so the we can add/remove VM's in VMM Clouds. Also to remove VMs from protection plans, this is all so we can automate decommissioning of a VM from SCVMM to ASR.

    Steps i have tried so far

    • Installing Powershell 5
    • Installing latest AzureRM and Azure Modules
    • Errors on Server 2012R2 & Windows 7

    One site said to set your CurrentStorageAccount but we don't have any Storage Accounts setup, is this a must?

    any help appreciated


    Monday, January 16, 2017 9:42 PM


  • Hi,

    Thank you for contacting Microsoft forums. We are pleased to answer your query.

    Storage account is required for ASR.

    Azure Site Recovery replicates data to an Azure Storage Account over a public endpoint

    This article will explain complete information on PowerShell support for Azure Site recovery

    Refer here: Manage vaults in PowerShell

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    I hope that the reply will assist you in getting your query addressed. In case you require further assistance, please do reply to the thread as we are always available to your queries.

    Sumanth BM
    Kindly click "Mark as Answer" on the post that helps you, this can be beneficial to other community members reading the thread. And Vote as Helpful.

    Tuesday, January 17, 2017 7:07 PM