public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
if (ShouldProcess(this.VM.Name, VerbsData.Update))
{
ExecuteClientAction(() =>
{
var parameters = new VirtualMachine
{
DiagnosticsProfile = this.VM.DiagnosticsProfile,
HardwareProfile = this.VM.HardwareProfile,
StorageProfile = this.VM.StorageProfile,
NetworkProfile = this.VM.NetworkProfile,
OsProfile = this.VM.OSProfile,
Plan = this.VM.Plan,
AvailabilitySet = this.VM.AvailabilitySetReference,
Location = this.VM.Location,
LicenseType = this.VM.LicenseType,
Tags = this.Tags != null ? this.Tags.ToDictionary() : this.VM.Tags
};
var op = this.VirtualMachineClient.CreateOrUpdateWithHttpMessagesAsync(
this.ResourceGroupName,
this.VM.Name,
parameters).GetAwaiter().GetResult();
var result = Mapper.Map<PSAzureOperationResponse>(op);
WriteObject(result);
});
}
}
}