public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); string resourceId = ResourceId; if (ParameterSetName == NameParamSet) { // Form ID from name ResourceIdentifier resourceIdentifier = new ResourceIdentifier(); resourceIdentifier.Subscription = ServiceClientAdapter.SubscriptionId; resourceIdentifier.ResourceGroupName = ResourceGroupName; resourceIdentifier.ResourceType = ConversionUtils.GetARMResourceType(Type); resourceIdentifier.ResourceName = Name; resourceId = resourceIdentifier.ToString(); } else if (ParameterSetName == IdParamSet) { ResourceIdentifier resourceIdentifier = new ResourceIdentifier(resourceId); Type = ConversionUtils.GetWorkloadTypeFromArmType(resourceIdentifier.ResourceType); } else { // Pass on the ID } GenericResource resource = ServiceClientAdapter.GetAzureResource(resourceId); BackupStatusResponse backupStatus = ServiceClientAdapter.CheckBackupStatus(Type, resourceId, resource.Location, ProtectableObjectName).Body; Boolean isProtected = String.Equals(backupStatus.ProtectionStatus, "Protected", StringComparison.OrdinalIgnoreCase); WriteObject(new ResourceBackupStatus( isProtected == true ? backupStatus.VaultId : null, isProtected)); }); }