internal/tasks/Set-Arm.Trigger.ApiConnection.Recurrence.AsParameter.task.ps1
$parm = @{ Description = @" Creates an Arm parameter: trigger_Frequency -Sets the default value to the original value, extracted from recurrence.frequency -Sets the recurrence.frequency value to: [parameters('trigger_Frequency')] Creates an Arm parameter: trigger_Interval -Set the default value to the original value, extracted from recurrence.interval -Sets the recurrence.interval value to: [parameters('trigger_Interval')] "@ Alias = "Arm.Set-Arm.Trigger.ApiConnection.Recurrence.AsParameter" } Task -Name "Set-Arm.Trigger.ApiConnection.Recurrence.AsParameter" @parm -Action { Set-TaskWorkDirectory $armObj = Get-TaskWorkObject if ($armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.type -eq "ApiConnection" -and $armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.recurrence) { $frequencyPreSuf = Format-Name -Type "Trigger" -Prefix $Trigger_Prefix -Suffix $Trigger_Suffix -Value "Frequency" $intervalPreSuf = Format-Name -Type "Trigger" -Prefix $Trigger_Prefix -Suffix $Trigger_Suffix -Value "Interval" $orgFrequency = $armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.recurrence.frequency $armObj = Add-ArmParameter -InputObject $armObj -Name "$frequencyPreSuf" ` -Type "string" ` -Value $orgFrequency ` -Description "The frequency used for the trigger to evalutate / run." $armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.recurrence.frequency = "[parameters('$frequencyPreSuf')]" $orgInterval = $armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.recurrence.interval $armObj = Add-ArmParameter -InputObject $armObj -Name "$intervalPreSuf" ` -Type "int" ` -Value $orgInterval ` -Description "The interval used for the trigger to evalutate / run." $armObj.resources[0].properties.definition.triggers.PsObject.Properties.Value.recurrence.interval = "[parameters('$intervalPreSuf')]" } Out-TaskFileArm -InputObject $armObj } |