ASR Get Agent Status with PowerShell

DMichaud33 1 Reputation point
2022-11-03T17:41:38.047+00:00

Hello,

I am trying to retrieve the Agent Status of a replicated item within Azure Site Recovery. Currently, I have a script that loops through a handful of get-AzRecoveryService* calls and finishes with Get-AzRecoveryServicesAsrReplicationProtectedItem. I have drilled down into the output of each command, but none includes the Agent Status. I do see the Agent version in the expandedproperty of the ProviderSpecificDetails field, but the agent status is not there. For example:

Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $Container | select -expandpropery ProviderSpecificDetails

The Agent Status is visible in the Azure portal after you click through on an replicated item in a section on the page called "Failover Readiness".

Thanks for any help.

Azure Site Recovery
Azure Site Recovery
An Azure native disaster recovery service. Previously known as Microsoft Azure Hyper-V Recovery Manager.
659 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 39,806 Reputation points Microsoft Employee
    2022-11-04T17:31:33.55+00:00

    @DMichaud33 Thank you for posting your question on Microsoft Q&A community platform!

    I understand that you have a requirement to get status of ASR agent using PowerShell. However, I see no property in JSON returned in either the PowerShell object nor the rest API for replication protected item to get this status. You can however see ProviderSpecificDetails.LastHeartbeat to see the last heartbeat received from the agent by service and use that to have an idea of agent health.


    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments