コード例 #1
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            var sourceApp = ResourcesClient.GetAppResource(InputObject.Name, InputObject.Slot);
            SnapshotRecoverySource source = new SnapshotRecoverySource()
            {
                Location = sourceApp.Location,
                Id       = sourceApp.Id
            };
            SnapshotRestoreRequest recoveryReq = new SnapshotRestoreRequest()
            {
                Overwrite                  = true,
                SnapshotTime               = this.InputObject.SnapshotTime.ToString("o"),
                RecoverConfiguration       = this.RecoverConfiguration,
                IgnoreConflictingHostNames = true,
                RecoverySource             = source,
                UseDRSecondary             = UseDisasterRecovery
            };
            Action recoverAction = () => WebsitesClient.RestoreSnapshot(ResourceGroupName, Name, Slot, recoveryReq);

            ConfirmAction(this.Force.IsPresent, "Web app contents will be overwritten with the contents of the snapshot.",
                          "The snapshot has been restored.", Name, recoverAction);
        }