diff --git a/src/Automation/Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs b/src/Automation/Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
index beb7578ba9e7..f3cd45ead38a 100644
--- a/src/Automation/Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
+++ b/src/Automation/Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
@@ -50,7 +50,7 @@ public void SetAzureAutomationWebhookToDisabledSuccessful()
string name = "webhookName";
this.mockAutomationClient.Setup(
- f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false));
+ f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false, "TestHybridGroup"));
// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
@@ -58,11 +58,12 @@ public void SetAzureAutomationWebhookToDisabledSuccessful()
this.cmdlet.Name = name;
this.cmdlet.IsEnabled = false;
this.cmdlet.Parameters = null;
+ this.cmdlet.RunOn = "TestHybridGroup";
this.cmdlet.ExecuteCmdlet();
// Assert
this.mockAutomationClient.Verify(
- f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false),
+ f => f.UpdateWebhook(resourceGroupName, accountName, name, null, false, "TestHybridGroup"),
Times.Once());
}
}
diff --git a/src/Automation/Automation/ChangeLog.md b/src/Automation/Automation/ChangeLog.md
index 8e49db5b0d0c..ef099b994e3c 100644
--- a/src/Automation/Automation/ChangeLog.md
+++ b/src/Automation/Automation/ChangeLog.md
@@ -21,6 +21,7 @@
## Version 1.3.7
* Fixed the issue that string with escape chars cannot be converted into json object.
+* Added a parameters to Set-AzAutomationWebhook to specify a Hybrid Worker Group
## Version 1.3.6
* Fixed typo in Example 1 in reference documentation for `New-AzAutomationSoftwareUpdateConfiguration`
diff --git a/src/Automation/Automation/Cmdlet/SetAzureAutomationWebhook.cs b/src/Automation/Automation/Cmdlet/SetAzureAutomationWebhook.cs
index 86bb976c51b7..ca01c95b3116 100644
--- a/src/Automation/Automation/Cmdlet/SetAzureAutomationWebhook.cs
+++ b/src/Automation/Automation/Cmdlet/SetAzureAutomationWebhook.cs
@@ -49,6 +49,14 @@ public class SetAzureAutomationWebhook : AzureAutomationBaseCmdlet
HelpMessage = "The Runbook parameters name/value.")]
public IDictionary Parameters { get; set; }
+ ///
+ /// Gets or sets the optional hybrid agent friendly name upon which the runbook should be executed.
+ ///
+ [Parameter(Mandatory = false,
+ HelpMessage = "Optional name of the hybrid agent which should execute the runbook")]
+ [Alias("HybridWorker")]
+ public string RunOn { get; set; }
+
///
/// Execute this cmdlet.
///
@@ -60,7 +68,8 @@ protected override void AutomationProcessRecord()
this.AutomationAccountName,
this.Name,
this.Parameters,
- this.IsEnabled);
+ this.IsEnabled,
+ this.RunOn);
this.WriteObject(updatedWebhook);
}
}
diff --git a/src/Automation/Automation/Common/AutomationPSClientWebhook.cs b/src/Automation/Automation/Common/AutomationPSClientWebhook.cs
index 3786b90e002c..a20683cff30a 100644
--- a/src/Automation/Automation/Common/AutomationPSClientWebhook.cs
+++ b/src/Automation/Automation/Common/AutomationPSClientWebhook.cs
@@ -145,7 +145,8 @@ public Model.Webhook UpdateWebhook(
string automationAccountName,
string name,
IDictionary parameters,
- bool? isEnabled)
+ bool? isEnabled,
+ string RunOn)
{
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
@@ -168,6 +169,11 @@ public Model.Webhook UpdateWebhook(
webhookPatchParameters.Parameters =
this.ProcessRunbookParameters(resourceGroupName, automationAccountName, webhookModel.Runbook.Name, parameters);
}
+ if (RunOn != null)
+ {
+ webhookPatchParameters.RunOn = RunOn;
+
+ }
}
var webhook =
diff --git a/src/Automation/Automation/Common/IAutomationPSClient.cs b/src/Automation/Automation/Common/IAutomationPSClient.cs
index 458ec9878b6c..56115bc6aaf9 100644
--- a/src/Automation/Automation/Common/IAutomationPSClient.cs
+++ b/src/Automation/Automation/Common/IAutomationPSClient.cs
@@ -171,7 +171,7 @@ Model.Webhook CreateWebhook(
IEnumerable ListWebhooks(string resourceGroupName, string automationAccountName, string runbooName, ref string nextLink);
- Model.Webhook UpdateWebhook(string resourceGroupName, string automationAccountName, string name, IDictionary parameters, bool? isEnabled);
+ Model.Webhook UpdateWebhook(string resourceGroupName, string automationAccountName, string name, IDictionary parameters, bool? isEnabled, string runOn);
void DeleteWebhook(string resourceGroupName, string automationAccountName, string name);
diff --git a/src/Automation/Automation/help/Set-AzAutomationWebhook.md b/src/Automation/Automation/help/Set-AzAutomationWebhook.md
index 8cd94ea66620..ddeb60882603 100644
--- a/src/Automation/Automation/help/Set-AzAutomationWebhook.md
+++ b/src/Automation/Automation/help/Set-AzAutomationWebhook.md
@@ -14,7 +14,7 @@ Modifies a webhook for an Automation runbook.
## SYNTAX
```
-Set-AzAutomationWebhook [-Name] [-IsEnabled] [[-Parameters] ]
+Set-AzAutomationWebhook [-Name] [-IsEnabled] [[-Parameters] ] [-RunOn ]
[-ResourceGroupName] [-AutomationAccountName] [-DefaultProfile ]
[]
```
@@ -32,14 +32,19 @@ PS C:\>Set-AzAutomationWebhook -Name "Webhook01" -ResourceGroup "ResourceGroup01
This command disables a webhook named Webhook01 in the Automation account named AutomationAccount01.
### Example 2
+```powershell
+PS C:\>Set-AzAutomationWebhook -Name "Webhook01" -ResourceGroup "ResourceGroup01" -AutomationAccountName "AutomationAccount01" -RunOn 'Windows'
+```
-Modifies a webhook for an Automation runbook. (autogenerated)
+This command sets the run on value for the webhook and forces the runbook to be run on a Hybrid Worker group called Windows.
-
+### Example 3
```powershell
-Set-AzAutomationWebhook -AutomationAccountName 'AutomationAccount01' -IsEnabled $false -Name 'Webhook01' -Parameters -ResourceGroupName 'ResourceGroup01'
+PS C:\>Set-AzAutomationWebhook -Name "Webhook01" -ResourceGroup "ResourceGroup01" -AutomationAccountName "AutomationAccount01" -RunOn $null
```
+This command updates the run on value for the webhook and forces the runbook to be run on an Azure runbook worker.
+
## PARAMETERS
### -AutomationAccountName
@@ -135,8 +140,23 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
+### -RunOn
+Optional name of the hybrid agent which should execute the runbook
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases: HybridWorker
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS