public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string resourceGroupName = resourceIdentifier.ResourceGroupName; string shouldProcessName = InputItem.Id; string protectedItemUri = ""; if (ShouldProcess(shouldProcessName, VerbsLifecycle.Enable)) { Dictionary <UriEnums, string> keyValueDict = HelperUtils.ParseUri(InputItem.Id); protectedItemUri = HelperUtils.GetProtectableItemUri( keyValueDict, InputItem.Id); AzureRecoveryServiceVaultProtectionIntent properties = new AzureRecoveryServiceVaultProtectionIntent(); properties.BackupManagementType = ServiceClientModel.BackupManagementType.AzureWorkload; properties.ItemId = InputItem.Id; properties.PolicyId = Policy.Id; ProtectionIntentResource serviceClientRequest = new ProtectionIntentResource() { Properties = properties }; bool isAutoProtectionSuccessful = false; try { var itemResponse = ServiceClientAdapter.CreateOrUpdateProtectionIntent( GetGuid ?? Guid.NewGuid().ToString(), serviceClientRequest, vaultName: vaultName, resourceGroupName: resourceGroupName); isAutoProtectionSuccessful = true; } catch { } if (PassThru.IsPresent) { WriteObject(isAutoProtectionSuccessful); } } }); }