diff --git a/src/Compute/Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs b/src/Compute/Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs index 1dc1bb99072b..175b1e5ae3ec 100644 --- a/src/Compute/Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs +++ b/src/Compute/Compute/AvailabilitySets/NewAzureAvailabilitySetCommand.cs @@ -85,6 +85,19 @@ public class NewAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet )] public Hashtable Tag { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -116,6 +129,36 @@ public override void ExecuteCmdlet() avSetParams.ProximityPlacementGroup = new SubResource(this.ProximityPlacementGroupId); } + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (avSetParams.ScheduledEventsPolicy == null) + { + avSetParams.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (avSetParams.ScheduledEventsPolicy == null) + { + avSetParams.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (avSetParams.ScheduledEventsPolicy.AllInstancesDown == null) + { + avSetParams.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + avSetParams.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } + var result = this.AvailabilitySetClient.CreateOrUpdateWithHttpMessagesAsync( this.ResourceGroupName, this.Name, diff --git a/src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs b/src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs index e86c625127e2..01da42ff3275 100644 --- a/src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs +++ b/src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs @@ -56,6 +56,19 @@ public class UpdateAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet )] public Hashtable Tag { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -84,6 +97,36 @@ public override void ExecuteCmdlet() avSetParams.ProximityPlacementGroup.Id = null; } + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (avSetParams.ScheduledEventsPolicy == null) + { + avSetParams.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + avSetParams.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (avSetParams.ScheduledEventsPolicy == null) + { + avSetParams.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (avSetParams.ScheduledEventsPolicy.AllInstancesDown == null) + { + avSetParams.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + avSetParams.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } + var result = this.AvailabilitySetClient.CreateOrUpdateWithHttpMessagesAsync( this.AvailabilitySet.ResourceGroupName, this.AvailabilitySet.Name, diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index 3b20e3949f01..5243999a954b 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -24,6 +24,10 @@ * Updated Azure.Core from 1.45.0 to 1.47.3 * Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Bool) to `New-AzVmGalleryApplication` and `New-AzVmssGalleryApplication` cmdlets. * Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Switch) to `Add-AzVmGalleryApplication` and `Add-AzVmssGalleryApplication` cmdlets. +* Added `-ScheduledEventsApiVersion` and `-EnableAllInstancesDown` parameters to support Scheduled Events policy configuration + - Added to `Update-AzVmss`, `New-AzVmss`, `Update-AzVM`, `New-AzVM`, `Update-AzAvailabilitySet`, and `New-AzAvailabilitySet` cmdlets + - `ScheduledEventsApiVersion` parameter specifies the API (Application Programming Interface) version to determine which scheduled events schema version will be delivered + - `EnableAllInstancesDown` parameter specifies if scheduled events should be auto-approved when all Virtual Machine (VM) instances are down ## Version 10.5.0 * Added `-Redeploy` switch parameter for `Update-AzHost` cmdlet to enable dedicated host redeployment. diff --git a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs index 174bb69541e8..65d68d7f68a9 100644 --- a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs +++ b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs @@ -77,5 +77,7 @@ public string ResourceGroupName public string Etag { get; private set; } public ResiliencyPolicy ResiliencyPolicy { get; set; } + + public ScheduledEventsPolicy ScheduledEventsPolicy { get; set; } } } diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs index e4dca274e627..7215375609a5 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs @@ -345,10 +345,44 @@ private VirtualMachineScaleSet BuildVirtualMachineScaleSetParameters() SetDefaultOrchestrationMode(parameters); ConfigureFlexibleOrchestrationMode(parameters); ConfigureSecuritySettings(parameters); + ConfigureScheduledEventsPolicy(parameters); return parameters; } + private void ConfigureScheduledEventsPolicy(VirtualMachineScaleSet parameters) + { + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.AllInstancesDown == null) + { + parameters.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + parameters.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } + } + private void CheckImageVersionWarning(VirtualMachineScaleSet parameters) { if (parameters?.VirtualMachineProfile?.StorageProfile?.ImageReference?.Version?.ToLower() != ImageVersions.Latest) @@ -474,6 +508,19 @@ private void WriteVMSSResult(VirtualMachineScaleSet result) ValueFromPipeline = true)] public PSVirtualMachineScaleSet VirtualMachineScaleSet { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs index d9f4c57facfc..94bbfc0d7781 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs @@ -348,6 +348,19 @@ public override void ExecuteCmdlet() [ValidateNotNullOrEmpty] public string[] VhdContainer { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -1511,6 +1524,44 @@ void InitializeAutomaticZoneRebalancingPolicy() InitializeAutomaticZoneRebalancingPolicy(); this.VirtualMachineScaleSetUpdate.ResiliencyPolicy.AutomaticZoneRebalancingPolicy.RebalanceBehavior = this.AutomaticZoneRebalanceBehavior; } + + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (this.VirtualMachineScaleSetUpdate == null) + { + this.VirtualMachineScaleSetUpdate = new VirtualMachineScaleSetUpdate(); + } + if (this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy == null) + { + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (this.VirtualMachineScaleSetUpdate == null) + { + this.VirtualMachineScaleSetUpdate = new VirtualMachineScaleSetUpdate(); + } + if (this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy == null) + { + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.AllInstancesDown == null) + { + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + this.VirtualMachineScaleSetUpdate.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } } private void BuildPutObject() @@ -2364,6 +2415,36 @@ void InitializeAutomaticZoneRebalancingPolicy() InitializeAutomaticZoneRebalancingPolicy(); this.VirtualMachineScaleSetUpdate.ResiliencyPolicy.AutomaticZoneRebalancingPolicy.RebalanceBehavior = this.AutomaticZoneRebalanceBehavior; } + + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (this.VirtualMachineScaleSet.ScheduledEventsPolicy == null) + { + this.VirtualMachineScaleSet.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (this.VirtualMachineScaleSet.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + this.VirtualMachineScaleSet.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (this.VirtualMachineScaleSet.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + this.VirtualMachineScaleSet.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + this.VirtualMachineScaleSet.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (this.VirtualMachineScaleSet.ScheduledEventsPolicy == null) + { + this.VirtualMachineScaleSet.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (this.VirtualMachineScaleSet.ScheduledEventsPolicy.AllInstancesDown == null) + { + this.VirtualMachineScaleSet.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + this.VirtualMachineScaleSet.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } } } } \ No newline at end of file diff --git a/src/Compute/Compute/Models/PSAvailabilitySet.cs b/src/Compute/Compute/Models/PSAvailabilitySet.cs index 0e9c236ad58d..db9ff86674ee 100644 --- a/src/Compute/Compute/Models/PSAvailabilitySet.cs +++ b/src/Compute/Compute/Models/PSAvailabilitySet.cs @@ -82,5 +82,8 @@ public string VirtualMachinesReferencesText public string Sku { get; set; } public SubResource ProximityPlacementGroup { get; set; } + + // Gets or sets the ScheduledEventsPolicy + public ScheduledEventsPolicy ScheduledEventsPolicy { get; set; } } } diff --git a/src/Compute/Compute/Models/PSVirtualMachine.cs b/src/Compute/Compute/Models/PSVirtualMachine.cs index c6b2a7b69fce..5eb420d5371f 100644 --- a/src/Compute/Compute/Models/PSVirtualMachine.cs +++ b/src/Compute/Compute/Models/PSVirtualMachine.cs @@ -160,5 +160,8 @@ public string ResourceGroupName // Gets or sets the AddProxyAgentExtension public bool? AddProxyAgentExtension { get; set; } + + // Gets or sets the ScheduledEventsPolicy + public ScheduledEventsPolicy ScheduledEventsPolicy { get; set; } } } diff --git a/src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs b/src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs index aaf8fb3c1e08..be3206f661dd 100644 --- a/src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs +++ b/src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs @@ -256,6 +256,19 @@ public class NewAzureVMCommand : VirtualMachineBaseCmdlet [ValidateNotNullOrEmpty] public string UserAssignedIdentity { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -1022,6 +1035,36 @@ public void DefaultExecuteCmdlet() Rest.Azure.AzureOperationResponse result; + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.AllInstancesDown == null) + { + parameters.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + parameters.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } + if (this.IsParameterBound(c => c.SshKeyName)) { parameters = addSshPublicKey(parameters); diff --git a/src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs b/src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs index 8731fab6d02c..6c4e7f87a167 100644 --- a/src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs +++ b/src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs @@ -120,6 +120,19 @@ public class UpdateAzureVMCommand : VirtualMachineBaseCmdlet [ResourceIdCompleter("Microsoft.Compute/capacityReservationGroups")] public string CapacityReservationGroupId { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Specifies the API version to determine which scheduled events schema version will be delivered. Format: YYYY-MM-DD", + ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ScheduledEventsApiVersion { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Specifies if scheduled events should be auto-approved when all instances are down.", + ValueFromPipelineByPropertyName = true)] + public bool? EnableAllInstancesDown { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -444,6 +457,36 @@ public override void ExecuteCmdlet() parameters.StorageProfile.AlignRegionalDisksToVMZone = this.AlignRegionalDisksToVMZone; } + if (this.IsParameterBound(c => c.ScheduledEventsApiVersion)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets = new ScheduledEventsAdditionalPublishingTargets(); + } + if (parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph == null) + { + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph = new EventGridAndResourceGraph(); + } + parameters.ScheduledEventsPolicy.ScheduledEventsAdditionalPublishingTargets.EventGridAndResourceGraph.ScheduledEventsApiVersion = this.ScheduledEventsApiVersion; + } + + if (this.IsParameterBound(c => c.EnableAllInstancesDown)) + { + if (parameters.ScheduledEventsPolicy == null) + { + parameters.ScheduledEventsPolicy = new ScheduledEventsPolicy(); + } + if (parameters.ScheduledEventsPolicy.AllInstancesDown == null) + { + parameters.ScheduledEventsPolicy.AllInstancesDown = new AllInstancesDown(); + } + parameters.ScheduledEventsPolicy.AllInstancesDown.AutomaticallyApprove = this.EnableAllInstancesDown; + } + if (NoWait.IsPresent) { var op = this.VirtualMachineClient.BeginCreateOrUpdateWithHttpMessagesAsync(