Exemple #1
0
        /// <summary>
        ///     ProcessRecord of the command.
        /// </summary>
        public override void ExecuteSiteRecoveryCmdlet()
        {
            base.ExecuteSiteRecoveryCmdlet();
            ASRAzuretoAzureDiskReplicationConfig diskRelicationConfig = null;

            var entityId = this.VhdUri == null ? this.DiskId : this.VhdUri;

            // Creating ASRAzureToAzureDiskReplicationConfig for Disk
            if (this.ShouldProcess(
                    this.VhdUri,
                    VerbsCommon.New))
            {
                switch (this.ParameterSetName)
                {
                case ASRParameterSets.AzureToAzure:
                    diskRelicationConfig = new ASRAzuretoAzureDiskReplicationConfig()
                    {
                        VhdUri = this.VhdUri,
                        LogStorageAccountId           = this.LogStorageAccountId,
                        RecoveryAzureStorageAccountId = this.RecoveryAzureStorageAccountId
                    };
                    break;

                case ASRParameterSets.AzureToAzureManagedDisk:
                    diskRelicationConfig = new ASRAzuretoAzureDiskReplicationConfig()
                    {
                        DiskId = this.DiskId,
                        LogStorageAccountId            = this.LogStorageAccountId,
                        RecoveryReplicaDiskAccountType = this.RecoveryReplicaDiskAccountType,
                        RecoveryResourceGroupId        = this.RecoveryResourceGroupId,
                        RecoveryTargetDiskAccountType  = this.RecoveryTargetDiskAccountType,
                        IsManagedDisk               = true,
                        DiskEncryptionSecretUrl     = this.DiskEncryptionSecretUrl,
                        DiskEncryptionVaultId       = this.DiskEncryptionVaultId,
                        KeyEncryptionKeyUrl         = this.KeyEncryptionKeyUrl,
                        KeyEncryptionVaultId        = this.KeyEncryptionVaultId,
                        RecoveryDiskEncryptionSetId = this.RecoveryDiskEncryptionSetId,
                        FailoverDiskName            = this.FailoverDiskName,
                        TfoDiskName = this.TfoDiskName
                    };
                    break;
                }
                this.WriteObject(diskRelicationConfig);
            }
        }
Exemple #2
0
        /// <summary>
        ///     ProcessRecord of the command.
        /// </summary>
        public override void ExecuteSiteRecoveryCmdlet()
        {
            base.ExecuteSiteRecoveryCmdlet();

            // Creating ASRAzureToAzureDiskReplicationConfig for Disk uri
            if (this.ShouldProcess(
                    this.VhdUri,
                    VerbsCommon.New))
            {
                var diskRelicationConfig = new ASRAzuretoAzureDiskReplicationConfig()
                {
                    VhdUri = this.VhdUri,
                    LogStorageAccountId           = this.LogStorageAccountId,
                    RecoveryAzureStorageAccountId = this.RecoveryAzureStorageAccountId
                };
                this.WriteObject(diskRelicationConfig);
            }
        }