Skip to content

Parameter typo fix for New-AZAutomationUpdateManagementAzureQuery #9190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,14 @@ public void TestGetSoftwareUpdateConfigurationRunWithPrePost()
TestRunner.RunTestScript("Test-GetSoftwareUpdateConfigurationRunWithPrePost");
}

[Fact]
[Trait(Category.Service, Category.Automation)]
[Trait(Category.RunType, Category.LiveOnly)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.AcceptanceType, Category.BVT)]
public void TestGetSoftwareUpdateConfigurationAzureDynamicGroupLocationParameterBackwardCompatiple()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Typo for Compatible

{
TestRunner.RunTestScript("Test-CreateAndGetSoftwareUpdateConfigurationWithAzureDynamicGroupsWithLocationParameterbackwardCompatiple");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Typo for Compatible

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ $query1Scope = @(
$azq = New-AzAutomationUpdateManagementAzureQuery -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Scope $query1Scope `
-Locaton $query1Location `
-Location $query1Location `
-Tag $tag1


Expand Down Expand Up @@ -248,7 +248,7 @@ $query1Scope = @(
$azq = New-AzAutomationUpdateManagementAzureQuery -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Scope $query1Scope `
-Locaton $query1Location `
-Location $query1Location `
-Tag $tag1


Expand Down Expand Up @@ -295,6 +295,62 @@ Test-CreateAndGetSoftwareUpdateConfigurationWithAzureDynamicGroupsOnlyWithOutTag
-StartTime $startTime `
-ForUpdate

$query1Scope = @(
"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus"
)

$query1Location =@("Japan East", "UK South")
$query1FilterOperator = "All"

$azq = New-AzAutomationUpdateManagementAzureQuery -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Scope $query1Scope `
-Location $query1Location `
-FilterOperator $query1FilterOperator

$AzureQueries = @($azq)

$suc = New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Schedule $s `
-Window `
-Duration (New-TimeSpan -Hours 2) `
-AzureQuery $AzureQueries `
-IncludedUpdateClassification Security,Critical


Assert-NotNull $suc "New-AzureRmAutomationSoftwareUpdateConfiguration returned null"
Assert-AreEqual $suc.Name $name "Name of created software update configuration didn't match given name"

$sucGet = Get-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Name $name

Assert-NotNull $sucGet "Get-AzureRmAutomationSoftwareUpdateConfiguration returned null"
Assert-AreEqual $sucGet.Name $name "Name of created software update configuration didn't match given name"
Assert-NotNull $sucGet.UpdateConfiguration "UpdateConfiguration of the software update configuration object is null"
Assert-NotNull $sucGet.UpdateConfiguration.Targets "Update targets object is null"
Assert-NotNull $sucGet.UpdateConfiguration.Targets.AzureQueries "Update targets azureQueries list null"
Assert-AreEqual $sucGet.UpdateConfiguration.Targets.AzureQueries.Count 1 "Update targets doesn't have the correct number of azure queries"

}

<#
.SYNOPSIS
Test-CreateAndGetSoftwareUpdateConfigurationWithAzureDynamicGroupsOnlyWithOutTags
#>
function Test-CreateAndGetSoftwareUpdateConfigurationWithAzureDynamicGroupsWithLocationParameterbackwardCompatiple
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Typo for Compatible

{
$name = "DG-suc-04"
$startTime = ([DateTime]::Now).AddMinutes(10)
$s = New-AzAutomationSchedule -ResourceGroupName $rg `
-AutomationAccountName $aa `
-Name $name `
-Description test-OneTime `
-OneTime `
-StartTime $startTime `
-ForUpdate

$query1Scope = @(
"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04?api-version=2017-05-15-preview",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL21tcy13Y3VzL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0b21hdGlvbi9hdXRvbWF0aW9uQWNjb3VudHMvSmVtYWxPTVNBdXRvbWF0aW9uL3NvZnR3YXJlVXBkYXRlQ29uZmlndXJhdGlvbnMvREctc3VjLTA0P2FwaS12ZXJzaW9uPTIwMTctMDUtMTUtcHJldmlldw==",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"properties\": {\r\n \"updateConfiguration\": {\r\n \"operatingSystem\": \"Windows\",\r\n \"windows\": {\r\n \"includedUpdateClassifications\": \"Security,Critical\",\r\n \"rebootSetting\": \"IfRequired\"\r\n },\r\n \"duration\": \"PT2H\",\r\n \"targets\": {\r\n \"azureQueries\": [\r\n {\r\n \"scope\": [\r\n \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus\"\r\n ],\r\n \"locations\": [\r\n \"Japan East\",\r\n \"UK South\"\r\n ],\r\n \"tagSettings\": {\r\n \"tags\": {},\r\n \"filterOperator\": \"Any\"\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"scheduleInfo\": {\r\n \"startTime\": \"2019-04-26T16:34:51.9929739-07:00\",\r\n \"expiryTime\": \"9999-12-31T15:59:59.9999999-08:00\",\r\n \"expiryTimeOffsetMinutes\": 0.0,\r\n \"isEnabled\": false,\r\n \"nextRunOffsetMinutes\": 0.0,\r\n \"frequency\": \"Onetime\",\r\n \"creationTime\": \"0001-01-01T00:00:00-08:00\",\r\n \"lastModifiedTime\": \"0001-01-01T00:00:00-08:00\"\r\n },\r\n \"tasks\": {}\r\n }\r\n}",
"RequestHeaders": {
"x-ms-client-request-id": [
"137754ee-4f5f-4c55-b9a4-95466b7e9cb7"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.27129.04",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.17763.",
"Microsoft.Azure.Management.Automation.AutomationClient/3.8.1.0"
],
"x-ms-activity-id": [
"42356e59-c15e-4af7-8502-7cd102b9234a"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"1101"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"Location": [
"https://management.azure.com/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04?api-version=2017-05-15-preview"
],
"x-ms-request-id": [
"42356e59-c15e-4af7-8502-7cd102b9234a"
],
"x-ms-location": [
"https://management.azure.com/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04?api-version=2017-05-15-preview"
],
"ocp-location": [
"https://management.azure.com/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04?api-version=2017-05-15-preview"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"Server": [
"Microsoft-IIS/10.0"
],
"X-AspNet-Version": [
"4.0.30319"
],
"X-Powered-By": [
"ASP.NET"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1199"
],
"x-ms-correlation-request-id": [
"5f893cfa-43ec-411f-93f3-ec97b7e3c7de"
],
"x-ms-routing-request-id": [
"WESTUS2:20190426T232459Z:5f893cfa-43ec-411f-93f3-ec97b7e3c7de"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Fri, 26 Apr 2019 23:24:59 GMT"
],
"Content-Length": [
"1451"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04\",\r\n \"name\": \"DG-suc-04\",\r\n \"type\": null,\r\n \"properties\": {\r\n \"updateConfiguration\": {\r\n \"operatingSystem\": \"Windows\",\r\n \"windows\": {\r\n \"includedUpdateClassifications\": \"Critical, Security\",\r\n \"excludedKbNumbers\": null,\r\n \"includedKbNumbers\": null,\r\n \"rebootSetting\": \"IfRequired\",\r\n \"IsInvalidKbNumbers\": false\r\n },\r\n \"linux\": null,\r\n \"targets\": {\r\n \"azureQueries\": [\r\n {\r\n \"scope\": [\r\n \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus\"\r\n ],\r\n \"tagSettings\": {\r\n \"tags\": {},\r\n \"filterOperator\": \"Any\"\r\n },\r\n \"locations\": [\r\n \"Japan East\",\r\n \"UK South\"\r\n ]\r\n }\r\n ],\r\n \"nonAzureQueries\": null\r\n },\r\n \"duration\": \"PT2H\",\r\n \"azureVirtualMachines\": null,\r\n \"nonAzureComputerNames\": null\r\n },\r\n \"scheduleInfo\": {\r\n \"description\": null,\r\n \"startTime\": \"2019-04-26T16:34:00-07:00\",\r\n \"startTimeOffsetMinutes\": 0.0,\r\n \"expiryTime\": \"2019-04-26T16:34:00-07:00\",\r\n \"expiryTimeOffsetMinutes\": 0.0,\r\n \"isEnabled\": true,\r\n \"nextRun\": \"2019-04-26T16:34:00-07:00\",\r\n \"nextRunOffsetMinutes\": 0.0,\r\n \"interval\": null,\r\n \"frequency\": \"OneTime\",\r\n \"creationTime\": \"2019-04-26T16:24:52.7-07:00\",\r\n \"lastModifiedTime\": \"2019-04-26T16:24:52.7-07:00\",\r\n \"timeZone\": \"UTC\",\r\n \"advancedSchedule\": null\r\n },\r\n \"provisioningState\": \"Provisioning\",\r\n \"createdBy\": \"{scrubbed}\",\r\n \"error\": null,\r\n \"tasks\": {\r\n \"preTask\": null,\r\n \"postTask\": null\r\n },\r\n \"creationTime\": \"2019-04-26T16:24:52.7066667-07:00\",\r\n \"lastModifiedBy\": null,\r\n \"lastModifiedTime\": \"2019-04-26T16:24:52.7233333-07:00\"\r\n }\r\n}",
"StatusCode": 201
},
{
"RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04?api-version=2017-05-15-preview",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL21tcy13Y3VzL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0b21hdGlvbi9hdXRvbWF0aW9uQWNjb3VudHMvSmVtYWxPTVNBdXRvbWF0aW9uL3NvZnR3YXJlVXBkYXRlQ29uZmlndXJhdGlvbnMvREctc3VjLTA0P2FwaS12ZXJzaW9uPTIwMTctMDUtMTUtcHJldmlldw==",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"d8c1fb19-2319-48f4-a31d-ffdc350e9ab1"
],
"Accept-Language": [
"en-US"
],
"User-Agent": [
"FxVersion/4.6.27129.04",
"OSName/Windows",
"OSVersion/Microsoft.Windows.10.0.17763.",
"Microsoft.Azure.Management.Automation.AutomationClient/3.8.1.0"
],
"x-ms-activity-id": [
"4b7d2e6b-4afd-402e-8d39-d548f7daf646"
]
},
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"4b7d2e6b-4afd-402e-8d39-d548f7daf646"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"Server": [
"Microsoft-IIS/10.0"
],
"X-AspNet-Version": [
"4.0.30319"
],
"X-Powered-By": [
"ASP.NET"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"11998"
],
"x-ms-correlation-request-id": [
"d554678b-a483-479f-91e1-86f4f0705936"
],
"x-ms-routing-request-id": [
"WESTUS2:20190426T232455Z:d554678b-a483-479f-91e1-86f4f0705936"
],
"X-Content-Type-Options": [
"nosniff"
],
"Date": [
"Fri, 26 Apr 2019 23:24:55 GMT"
],
"Content-Length": [
"1448"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus/providers/Microsoft.Automation/automationAccounts/JemalOMSAutomation/softwareUpdateConfigurations/DG-suc-04\",\r\n \"name\": \"DG-suc-04\",\r\n \"type\": null,\r\n \"properties\": {\r\n \"updateConfiguration\": {\r\n \"operatingSystem\": \"Windows\",\r\n \"windows\": {\r\n \"includedUpdateClassifications\": \"Critical, Security\",\r\n \"excludedKbNumbers\": null,\r\n \"includedKbNumbers\": null,\r\n \"rebootSetting\": \"IfRequired\",\r\n \"IsInvalidKbNumbers\": false\r\n },\r\n \"linux\": null,\r\n \"targets\": {\r\n \"azureQueries\": [\r\n {\r\n \"scope\": [\r\n \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/mms-wcus\"\r\n ],\r\n \"tagSettings\": {\r\n \"tags\": {},\r\n \"filterOperator\": \"Any\"\r\n },\r\n \"locations\": [\r\n \"Japan East\",\r\n \"UK South\"\r\n ]\r\n }\r\n ],\r\n \"nonAzureQueries\": null\r\n },\r\n \"duration\": \"PT2H\",\r\n \"azureVirtualMachines\": null,\r\n \"nonAzureComputerNames\": null\r\n },\r\n \"scheduleInfo\": {\r\n \"description\": null,\r\n \"startTime\": \"2019-04-26T16:34:00-07:00\",\r\n \"startTimeOffsetMinutes\": 0.0,\r\n \"expiryTime\": \"2019-04-26T16:34:00-07:00\",\r\n \"expiryTimeOffsetMinutes\": 0.0,\r\n \"isEnabled\": true,\r\n \"nextRun\": \"2019-04-26T16:34:00-07:00\",\r\n \"nextRunOffsetMinutes\": 0.0,\r\n \"interval\": null,\r\n \"frequency\": \"OneTime\",\r\n \"creationTime\": \"2019-04-26T16:24:52.7-07:00\",\r\n \"lastModifiedTime\": \"2019-04-26T16:24:52.7-07:00\",\r\n \"timeZone\": \"UTC\",\r\n \"advancedSchedule\": null\r\n },\r\n \"provisioningState\": \"Succeeded\",\r\n \"createdBy\": \"{scrubbed}\",\r\n \"error\": null,\r\n \"tasks\": {\r\n \"preTask\": null,\r\n \"postTask\": null\r\n },\r\n \"creationTime\": \"2019-04-26T16:24:52.7066667-07:00\",\r\n \"lastModifiedBy\": null,\r\n \"lastModifiedTime\": \"2019-04-26T16:24:52.7233333-07:00\"\r\n }\r\n}",
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "cd45f23b-b832-4fa4-a434-1bf7e6f14a5a"
}
}
1 change: 1 addition & 0 deletions src/Automation/Automation/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Updated Get-AzAutomationJobOutputRecord to handle JSON and Text record values.
- Fix for issue https://github.com/Azure/azure-powershell/issues/7977
- Fix for issue https://github.com/Azure/azure-powershell/issues/8600
* Bug fix for NewAZAutomationUpdateManagementAzureQuery
* Changed behavior for Start-AzAutomationDscCompilationJob to just start the job instead of waiting for its completion.
* Fix for issue https://github.com/Azure/azure-powershell/issues/8347

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet.UpdateManagement
using System.Collections;
using TagHelper = Microsoft.Azure.Commands.ResourceManager.Common.Tags;
using System.Collections.Generic;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;

[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzurePrefix + "AutomationUpdateManagementAzureQuery")]
[OutputType(typeof(AzureQueryProperties))]
Expand All @@ -35,7 +36,9 @@ public class NewAutomationUpdateManagementAzureQuery : AzureAutomationBaseCmdlet
public string[] Scope { get; set; }

[Parameter(Mandatory = false, HelpMessage = "List of locations for azure virtual machines.")]
public string[] Locaton { get; set; }
[LocationCompleter("Microsoft.Automation/SoftwareUpdateConfiguration")]
[Alias("Locaton")]
public string[] Location { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Tag for azure virtual machines.")]
public Hashtable Tag { get; set; }
Expand All @@ -53,7 +56,7 @@ protected override void AutomationProcessRecord()
var azureQuery = new AzureQueryProperties
{
Scope = this.Scope,
Locations = this.Locaton,
Locations = this.Location,
TagSettings = this.Tag == null ? null : new TagSettings
{
Tags = CreateTagDictionary(this.Tag),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Creates azure automation software update configuration azure query object.
## SYNTAX

```
New-AzAutomationUpdateManagementAzureQuery -Scope <String[]> [-Locaton <String[]>] [-Tag <Hashtable>]
New-AzAutomationUpdateManagementAzureQuery -Scope <String[]> [-Location <String[]>] [-Tag <Hashtable>]
[-FilterOperator <TagOperators>] [-ResourceGroupName] <String> [-AutomationAccountName] <String>
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```
Expand All @@ -36,7 +36,7 @@ PS C:\>$tag1.add("tag2", "tag2Value")
PS C:\>$azq = New-AzAutomationUpdateManagementAzureQuery -ResourceGroupName "mygroup" `
-AutomationAccountName "myaccount" `
-Scope $query1Scope `
-Locaton $query1Location `
-Location $query1Location `
-Tag $tag1
PS C:\>$AzureQueries = @($azq)
PS C:\> $startTime = [DateTimeOffset]"2018-09-13T21:00"
Expand Down Expand Up @@ -118,7 +118,7 @@ Default value: None
Accept wildcard characters: False
```

### -Locaton
### -Location
List of locations for azure virtual machines.

```yaml
Expand Down