From 871ff0f6459b5683b24bd2b7f606348846a0ec82 Mon Sep 17 00:00:00 2001 From: Thomas Pham Date: Wed, 22 Jun 2022 09:47:05 -0700 Subject: [PATCH 1/2] Task 14768687: AzNS || Powershell and SDK - Action Groups RP API's support for location --- .../SetAzureRmActionGroupCommand.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Monitor/Monitor/ActionGroups/SetAzureRmActionGroupCommand.cs b/src/Monitor/Monitor/ActionGroups/SetAzureRmActionGroupCommand.cs index 25301ae3fc96..8a3c4bbc4297 100644 --- a/src/Monitor/Monitor/ActionGroups/SetAzureRmActionGroupCommand.cs +++ b/src/Monitor/Monitor/ActionGroups/SetAzureRmActionGroupCommand.cs @@ -81,7 +81,7 @@ public class SetAzureRmActionGroupCommand : ManagementCmdletBase public SwitchParameter DisableGroup { get; set; } /// - /// Gets or sets the Tags of the activity log alert resource + /// Gets or sets the Tags of the action group resource /// [Parameter(ParameterSetName = ByPropertyName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The tags of the action group resource")] [Parameter(ParameterSetName = ByResourceId, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The tags of the action group resource")] @@ -89,6 +89,15 @@ public class SetAzureRmActionGroupCommand : ManagementCmdletBase [ValidateNotNullOrEmpty] public IDictionary Tag { get; set; } + /// + /// Gets or sets the location of the action group resource + /// + [Parameter(ParameterSetName = ByPropertyName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the action group resource")] + [Parameter(ParameterSetName = ByResourceId, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the action group resource")] + [Parameter(ParameterSetName = ByInputObject, Mandatory = false, ValueFromPipeline = true, HelpMessage = "The location of the action group resource")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + /// /// Gets or sets the resource id parameter. /// @@ -130,6 +139,10 @@ protected override void ProcessRecordInternal() { this.Tag = this.InputObject.Tags; } + if (this.Location == null) + { + this.Location = this.InputObject.Location; + } this.Receiver = new List(); this.Receiver.AddRange(this.InputObject.EmailReceivers); this.Receiver.AddRange(this.InputObject.SmsReceivers); @@ -224,7 +237,7 @@ protected override void ProcessRecordInternal() ActionGroupResource actionGroup = new ActionGroupResource { - Location = "Global", + Location = this.Location ?? "Global", GroupShortName = this.ShortName, Enabled = !this.DisableGroup.IsPresent || !this.DisableGroup, Tags = this.Tag, From 7f320e867392f61b435b7e17d71a0435a3671492 Mon Sep 17 00:00:00 2001 From: Thomas Pham Date: Thu, 23 Jun 2022 07:14:00 -0700 Subject: [PATCH 2/2] Add help and change log --- src/Monitor/Monitor/ChangeLog.md | 2 ++ src/Monitor/Monitor/help/Set-AzActionGroup.md | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Monitor/Monitor/ChangeLog.md b/src/Monitor/Monitor/ChangeLog.md index df47336957a8..5f533c530795 100644 --- a/src/Monitor/Monitor/ChangeLog.md +++ b/src/Monitor/Monitor/ChangeLog.md @@ -19,6 +19,8 @@ --> ## Upcoming Release +## Version 3.0.2 +* Added optional parameter `Location` for Adding/Update action group cmdlet ## Version 3.0.1 * Fixed an issue where users could not correctly ignore warning messages after setting environment variables [#17013] diff --git a/src/Monitor/Monitor/help/Set-AzActionGroup.md b/src/Monitor/Monitor/help/Set-AzActionGroup.md index 0b54a7d87e5a..801d65733cb9 100644 --- a/src/Monitor/Monitor/help/Set-AzActionGroup.md +++ b/src/Monitor/Monitor/help/Set-AzActionGroup.md @@ -17,7 +17,7 @@ Creates a new or updates an existing action group. ``` Set-AzActionGroup -ResourceGroupName -Name -ShortName -Receiver - [-DisableGroup] [-Tag ] + [-DisableGroup] [-Tag ] [-Location ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -26,12 +26,13 @@ Set-AzActionGroup -ResourceGroupName -Name -ShortName Set-AzActionGroup -ShortName -Receiver [-DisableGroup] [-Tag ] + [-Location ] -ResourceId [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByInputObject ``` -Set-AzActionGroup [-ShortName ] [-DisableGroup] +Set-AzActionGroup [-ShortName ] [-DisableGroup] [-Location ] [-Tag ] -InputObject [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -201,6 +202,9 @@ Accept wildcard characters: False ### -Tag The tags of the action group resource +### -Location +The location of the action group resource + ```yaml Type: System.Collections.Generic.IDictionary`2[System.String,System.String] Parameter Sets: ByPropertyName, ByResourceId