public CreateSnapshotForDisks ( |
||
vmConfig | ||
snapshotTag | string | |
virtualMachineExtensionBaseCmdlet | VirtualMachineExtensionBaseCmdlet | |
Résultat | void |
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = this.VMName; vmConfig.ExtensionName = this.Name; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig, Tag, this); }
private void CreateVMBackupForLinx() { try { AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; string tag = string.Format("{0}{1}", "AzureEnc", Guid.NewGuid().ToString()); // this would create shapshot only for Linux box. and we should wait for the snapshot found. azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig, tag, this); WriteWarning(string.Format("one snapshot for disks are created with tag,{0}, you can use {1}-{2} to remove it.", tag, VerbsCommon.Remove, ProfileNouns.AzureVMBackup)); } catch (AzureVMBackupException e) { ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, e.ToString())), "InvalidResult", ErrorCategory.InvalidResult, null)); } }
protected override void ProcessRecord() { base.ProcessRecord(); AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.ExtensionName = Name; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig,Tag, this); }