Skip to content

[QUERY] Figure out if ASR protection is enabled for VMs using Azure SDK for Java #37270

Open
@AbhinavHegde97

Description

@AbhinavHegde97

Query/Question
I'm trying to figure out if ASR protection is enabled for VMs using Azure SDK for Java. However, there's no way of getting the details of whether ASR is enabled and get the corresponding vault details (Vault, Fabric, Container, etc) directly from the virtual machine info using AzureResourceManager

Currently I am using a brute force approach like below

recoveryServicesManager.vaults().list().stream().forEach(vault -> {
    siteRecoveryManager.replicationFabrics().list(vault.name(), vault.resourceGroupName()).stream().forEach(fabric -> {
        siteRecoveryManager.replicationProtectionContainers().listByReplicationFabrics(vault.name(), vault.resourceGroupName(), fabric.name()).stream().forEach(protectionContainer -> {
            siteRecoveryManager.serviceClient().getReplicationProtectedItems().listByReplicationProtectionContainers(vault.name(), vault.resourceGroupName(), fabric.name(), protectionContainer.name()).stream().forEach(replicationProtectedItemInner -> {
                if (replicationProtectedItemInner.properties().friendlyName().equals(vmId)) {
                    log.info("vm id {} has asr enabled ", vmId);
                }
                log.info("vm with asr enabled is  {} ", replicationProtectedItemInner.properties().friendlyName());
            });
        });
    });
});

Need a better way to find out if ASR is enabled for a particular VM, without having to make so many API calls

Why is this not a Bug or a feature Request?
I tried finding if there is a way to find out if ASR is enabled for a particular VM, but could not find it via API docs. I am not sure whether there is a way. Hence have not opened a feature request until i get a confirmation

Setup (please complete the following information if applicable):

  • Library/Libraries:
    com.azure.resourcemanager:azure-resourcemanager:2.20.0
    com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery:1.0.0
    com.azure.resourcemanager:azure-resourcemanager-recoveryservices:1.2.0

Metadata

Metadata

Assignees

Labels

ARMMgmtThis issue is related to a management-plane library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-triageWorkflow: This issue needs the team to triage.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions