Skip to content

Commit 177088e

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-powershell into routing-source-dt
2 parents 820712b + ffa5d2e commit 177088e

File tree

132 files changed

+8599
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+8599
-201
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: Az 4.x preview bug report
3+
about: Report errors or unexpected behaviors specifically for the Az 4.0 module in preview
4+
title: ''
5+
labels: 'Az 4.x Preview', 'Azure PS Team'
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
12+
- This issue is specifically for reporting issues related to the preview versions of the Az 4.0 PowerShell module
13+
- Please search the existing issues to see if there has been a similar issue filed
14+
- For issue related to importing a module, please refer to our troubleshooting guide:
15+
- https://github.com/Azure/azure-powershell/blob/master/documentation/troubleshoot-module-load.md
16+
17+
-->
18+
19+
## Description
20+
21+
22+
23+
## Steps to reproduce
24+
25+
```powershell
26+
27+
```
28+
29+
## Environment data
30+
31+
<!-- Please run $PSVersionTable and paste the output in the below code block -->
32+
33+
```
34+
35+
```
36+
37+
## Module version
38+
39+
<!-- Please run (Get-Module -ListAvailable) and paste the output in the below code block -->
40+
41+
```powershell
42+
43+
```
44+
45+
## Azure Profile
46+
47+
<!-- Please indicate the selected Azure profile, if any -->
48+
49+
```powershell
50+
51+
```
52+
53+
## Debug output
54+
55+
<!-- Set $DebugPreference='Continue' before running the repro and paste the resulting debug stream in the below code block -->
56+
57+
```
58+
59+
```
60+
61+
## Error output
62+
63+
<!-- Please run Resolve-AzError and paste the output in the below code block -->
64+
65+
```
66+
67+
```

src/Accounts/Accounts/Az.Accounts.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.6.2'
15+
ModuleVersion = '1.6.3'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'

src/Accounts/Accounts/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
-->
2020
## Upcoming Release
2121

22+
## Version 1.6.3
23+
* Update telemetry and url rewriting for generated modules, fix windows unit tests.
24+
2225
## Version 1.6.2
2326
* Fixed miscellaneous typos across module
2427
* Support user-assigned MSI in Azure Functions Authentication (#9479)

src/Accounts/Accounts/CommonModule/EnvironmentExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ internal static Uri PatchHost(this Uri baseUri, string newBase)
237237
if (baseUri.IsAbsoluteUri)
238238
{
239239
output.Path = output.Uri.AppendPathRemoveDuplicates(baseUri.AbsolutePath);
240-
output.Query = baseUri.Query;
241-
output.Fragment = baseUri.Fragment;
240+
output.Query = baseUri.Query?.TrimStart('?');
241+
output.Fragment = baseUri.Fragment?.TrimStart('#');
242242
return output.Uri;
243243
}
244244

src/Accounts/Accounts/CommonModule/TelemetryProvider.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ public virtual AzurePSQoSEvent CreateQosEvent(InvocationInfo invocationInfo, str
139139
SessionId = correlationId,
140140
ParameterSetName = parameterSetName,
141141
InvocationName = invocationInfo?.InvocationName,
142-
InputFromPipeline = invocationInfo?.PipelineLength > 0,
142+
InputFromPipeline = invocationInfo?.PipelineLength > 0
143143
};
144144

145+
data.CustomProperties.Add("PSPreviewVersion", "4.0.0");
146+
145147
if (invocationInfo != null)
146148
{
147149
data.Parameters = string.Join(",", invocationInfo?.BoundParameters?.Keys?.ToArray());

src/Accounts/Accounts/CommonModule/UniqueId.cs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
using System.Threading;
1717
using System.Threading.Tasks;
1818
using System.Net.Http;
19-
using Microsoft.Azure.Commands.Common.Authentication;
20-
using System.Net.Http.Headers;
21-
using System.Management.Automation;
2219

2320
namespace Microsoft.Azure.Commands.Common
2421
{
@@ -28,19 +25,12 @@ namespace Microsoft.Azure.Commands.Common
2825
/// <summary>
2926
/// Pipeline step for adding x-ms-unique-id header
3027
/// </summary>
31-
public class UserAgent
28+
public class UniqueId
3229
{
33-
Version _version;
30+
private static UniqueId _instance;
31+
public static UniqueId Instance => UniqueId._instance ?? (UniqueId._instance = new UniqueId());
3432

35-
public UserAgent(InvocationInfo invocation)
36-
: this(invocation?.MyCommand?.Module?.Version ?? new Version("1.0.0"))
37-
{
38-
}
39-
40-
public UserAgent(Version moduleVersion)
41-
{
42-
_version = moduleVersion;
43-
}
33+
private int count;
4434

4535
/// <summary>
4636
/// Pipeline delegate to add a unique id header to an outgoing request
@@ -53,13 +43,8 @@ public UserAgent(Version moduleVersion)
5343
/// <returns>Amended pipeline for retrieving a response</returns>
5444
public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next)
5545
{
56-
var userAgents = AzureSession.Instance?.ClientFactory?.UserAgents ?? new ProductInfoHeaderValue[] { new ProductInfoHeaderValue("AzurePowerShell", $"Az{_version.ToString()}") };
57-
// add user agent haeaders
58-
59-
foreach (var userAgent in userAgents)
60-
{
61-
request.Headers.UserAgent.Add(userAgent);
62-
}
46+
// add a header...
47+
request.Headers.Add("x-ms-unique-id", Interlocked.Increment(ref this.count).ToString());
6348

6449
// continue with pipeline.
6550
return next(request, token, cancel, signal);

src/Accounts/Accounts/CommonModule/UserAgent.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
using System.Threading;
1717
using System.Threading.Tasks;
1818
using System.Net.Http;
19+
using Microsoft.Azure.Commands.Common.Authentication;
20+
using System.Net.Http.Headers;
21+
using System.Management.Automation;
1922

2023
namespace Microsoft.Azure.Commands.Common
2124
{
@@ -25,12 +28,19 @@ namespace Microsoft.Azure.Commands.Common
2528
/// <summary>
2629
/// Pipeline step for adding x-ms-unique-id header
2730
/// </summary>
28-
public class UniqueId
31+
public class UserAgent
2932
{
30-
private static UniqueId _instance;
31-
public static UniqueId Instance => UniqueId._instance ?? (UniqueId._instance = new UniqueId());
33+
Version _version;
3234

33-
private int count;
35+
public UserAgent(InvocationInfo invocation)
36+
: this(invocation?.MyCommand?.Module?.Version ?? new Version("1.0.0"))
37+
{
38+
}
39+
40+
public UserAgent(Version moduleVersion)
41+
{
42+
_version = moduleVersion;
43+
}
3444

3545
/// <summary>
3646
/// Pipeline delegate to add a unique id header to an outgoing request
@@ -43,8 +53,13 @@ public class UniqueId
4353
/// <returns>Amended pipeline for retrieving a response</returns>
4454
public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next)
4555
{
46-
// add a header...
47-
request.Headers.Add("x-ms-unique-id", Interlocked.Increment(ref this.count).ToString());
56+
var userAgents = new ProductInfoHeaderValue[] { new ProductInfoHeaderValue("AzurePowerShell", $"Az4.0.0-preview") };
57+
// add user agent haeaders
58+
59+
foreach (var userAgent in userAgents)
60+
{
61+
request.Headers.UserAgent.Add(userAgent);
62+
}
4863

4964
// continue with pipeline.
5065
return next(request, token, cancel, signal);

src/Accounts/Accounts/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
// You can specify all the values or you can default the Build and Revision Numbers
4444
// by using the '*' as shown below:
4545

46-
[assembly: AssemblyVersion("1.6.2")]
47-
[assembly: AssemblyFileVersion("1.6.2")]
46+
[assembly: AssemblyVersion("1.6.3")]
47+
[assembly: AssemblyFileVersion("1.6.3")]
4848
#if !SIGN
4949
[assembly: InternalsVisibleTo("Microsoft.Azure.PowerShell.Cmdlets.Accounts.Test")]
5050
#endif

src/Advisor/Advisor/Az.Advisor.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ DotNetFrameworkVersion = '4.7.2'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
54+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.Advisor.dll'

src/Aks/Aks/Az.Aks.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\YamlDotNet.dll', '.\AutoMapper.dll'

src/AlertsManagement/AlertsManagement/Az.AlertsManagement.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\Microsoft.Azure.Management.AlertsManagement.dll'

src/AnalysisServices/AnalysisServices/Az.AnalysisServices.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\Microsoft.Azure.Management.Analysis.dll'

src/ApiManagement/ApiManagement/Az.ApiManagement.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\AutoMapper.dll',

src/ApplicationInsights/ApplicationInsights/Az.ApplicationInsights.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\Microsoft.Azure.Management.ApplicationInsights.dll'

src/Attestation/Attestation/Az.Attestation.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.2'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.6.3'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = '.\Microsoft.Azure.Management.Attestation.dll'

src/Automation/Automation.Test/ScenarioTests/UpdateManagementTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,13 @@ public void CreateLinuxIncludePackageNameMasksSUC()
175175
{
176176
TestRunner.RunTestScript("Test-CreateLinuxIncludedPackageNameMasksSoftwareUpdateConfiguration");
177177
}
178+
179+
[Fact]
180+
[Trait(Category.AcceptanceType, Category.CheckIn)]
181+
[Trait(Category.Service, Category.Automation)]
182+
public void CreateLinuxSucWithRebootSetting()
183+
{
184+
TestRunner.RunTestScript("Test-CreateLinuxSoftwareUpdateConfigurationWithRebootSetting");
185+
}
178186
}
179187
}

src/Automation/Automation.Test/ScenarioTests/UpdateManagementTests.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,43 @@ function Test-CreateLinuxIncludedPackageNameMasksSoftwareUpdateConfiguration() {
522522
WaitForProvisioningState $name "Succeeded"
523523
}
524524

525+
526+
<#
527+
Test-CreateLinuxOneTimeSoftwareUpdateConfigurationWithAllOption
528+
#>
529+
function Test-CreateLinuxSoftwareUpdateConfigurationWithRebootSetting {
530+
$azureVMIdsLinux = @(
531+
"/subscriptions/d2b38167-d3ca-4d1f-a020-948eee21b6bc/resourceGroups/ikanni-rhel76-hw-001-RG/providers/Microsoft.Compute/virtualMachines/ikanni-rhel76-hw-001",
532+
"/subscriptions/d2b38167-d3ca-4d1f-a020-948eee21b6bc/resourceGroups/ikanni-rhel76-JPE-hw-002-RG/providers/Microsoft.Compute/virtualMachines/ikanni-rhel76-JPE-hw-002"
533+
)
534+
535+
$name = "linx-suc-reboot"
536+
$rebootSetting = "Never"
537+
$startTime = ([DateTime]::Now).AddMinutes(10)
538+
$s = New-AzAutomationSchedule -ResourceGroupName $rg `
539+
-AutomationAccountName $aa `
540+
-Name $name `
541+
-Description linux-suc-reboot `
542+
-OneTime `
543+
-StartTime $startTime `
544+
-ForUpdate
545+
546+
$suc = New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $rg `
547+
-AutomationAccountName $aa `
548+
-Schedule $s `
549+
-Linux `
550+
-AzureVMResourceId $azureVMIdsLinux `
551+
-NonAzureComputer $nonAzurecomputers `
552+
-Duration (New-TimeSpan -Hours 2) `
553+
-IncludedPackageClassification Security,Critical `
554+
-ExcludedPackageNameMask Mask01,Mask02 `
555+
-IncludedPackageNameMask Mask100 `
556+
-RebootSetting $rebootSetting
557+
558+
Assert-NotNull $suc "New-AzAutomationSoftwareUpdateConfiguration returned null"
559+
Assert-AreEqual $suc.Name $name "Name of created software update configuration didn't match given name"
560+
Assert-AreEqual $suc.UpdateConfiguration.Linux.rebootSetting $rebootSetting "Reboot setting failed to match"
561+
562+
WaitForProvisioningState $name "Failed"
563+
}
564+

0 commit comments

Comments
 (0)