/// <summary>
        /// Set Azure Site Recovery Vault context.
        /// </summary>
        private void SetASRVaultContext(ASRVault asrVault)
        {
            // Change the vault context
            RecoveryServicesClient.ChangeVaultContext(asrVault);

            // Validate the Vault
            RecoveryServicesClient.ValidateVaultSettings(
                asrVault.Name,
                asrVault.ResouceGroupName);

            this.WriteObject(new ASRVaultSettings(PSRecoveryServicesClient.asrVaultCreds));
        }
Exemplo n.º 2
0
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        protected override void ProcessRecord()
        {
            // Validate the Vault
            RecoveryServicesClient.ValidateVaultSettings(
                this.Vault.Name,
                this.Vault.ResouceGroupName);

            // Change the vault context
            ASRVaultCreds vaultCreds = RecoveryServicesClient.ChangeVaultContext(this.Vault);

            this.WriteObject(new ASRVaultSettings(PSRecoveryServicesClient.asrVaultCreds));
        }
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            // Validate the Vault
            RecoveryServicesClient.ValidateVaultSettings(
                this.Vault.Name,
                this.Vault.ResouceGroupName);

            // Change the vault context
            ASRVaultCreds vaultCreds = RecoveryServicesClient.ChangeVaultContext(this.Vault);

            this.WriteObject(new ASRVaultSettings(
                                 PSRecoveryServicesClient.asrVaultCreds.ResourceName,
                                 PSRecoveryServicesClient.asrVaultCreds.ResourceGroupName));
        }