Skip to content

Commit 7da1103

Browse files
Merge remote-tracking branch 'upstream/master' into links1
2 parents e79df50 + a093487 commit 7da1103

File tree

139 files changed

+2741235
-626
lines changed

Some content is hidden

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

139 files changed

+2741235
-626
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Azure PowerShell specific
2+
Net472Tests/
23
artifacts/
34
src/Stack/
45
src/local-artifacts/*

build.proj

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
4949
<LibrarySourceFolder>$(LibraryRoot)src</LibrarySourceFolder>
5050
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
51+
<LibraryArtifactsFolder>$(LibraryRoot)artifacts</LibraryArtifactsFolder>
5152
<LocalFeedFolder>$(LibraryToolsFolder)\LocalFeed</LocalFeedFolder>
5253
<Configuration Condition=" '$(Configuration)' != 'Release'">Debug</Configuration>
5354
<CodeSign>false</CodeSign>
@@ -378,6 +379,9 @@
378379
<PropertyGroup Condition="'$(ExcludeAuthenticators)' == 'true'">
379380
<AuthenticatorExclusions>$(LibraryRoot)src/**/Authenticators.csproj;</AuthenticatorExclusions>
380381
</PropertyGroup>
382+
<PropertyGroup Condition="'$(Framework)' == ''">
383+
<Framework>netcoreapp2.0</Framework>
384+
</PropertyGroup>
381385

382386
<CallTarget Targets="BinScopeCheck" Condition="'$(OnPremiseBuild)'" />
383387
<CallTarget Targets="RunPoliCheck" Condition="'$(OnPremiseBuild)'" />
@@ -397,7 +401,7 @@
397401
<Exec Command="dotnet sln Azure.PowerShell.sln add $(LibraryRoot)tools/ScenarioTest.ResourceManager/ScenarioTest.ResourceManager.csproj $(LibraryRoot)tools/TestFx/TestFx.csproj" />
398402
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
399403
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
400-
<Exec Command="dotnet test Azure.PowerShell.sln --filter &quot;AcceptanceType=CheckIn%26RunType!=DesktopOnly&quot; --configuration $(Configuration) --framework netcoreapp2.0 --logger trx" />
404+
<Exec Command="dotnet test Azure.PowerShell.sln --filter &quot;AcceptanceType=CheckIn%26RunType!=DesktopOnly&quot; --configuration $(Configuration) --framework $(Framework) --logger trx" />
401405

402406
<ItemGroup>
403407
<TestResults Include="$(LibraryRoot)src/**/TestResults/*.trx" />
@@ -407,6 +411,37 @@
407411
<OnError ExecuteTargets="TestFailureErrorMessage" />
408412
</Target>
409413

414+
<Target Name="TestNet472">
415+
<Message Importance="high" Text="Running check in tests..." />
416+
<PropertyGroup>
417+
<AuthExclusions>$(LibraryRoot)src/**/Authenticators.csproj;</AuthExclusions>
418+
<AutomationExclusions>$(LibraryRoot)src/**/Automation.Test.csproj;</AutomationExclusions>
419+
<StorageExclusions>$(LibraryRoot)src/**/Storage.Test.csproj;</StorageExclusions>
420+
</PropertyGroup>
421+
422+
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
423+
<Exec Command="dotnet new sln -n Azure.PowerShell --force" />
424+
<ItemGroup>
425+
<ModuleCsprojFiles Include="$(LibraryRoot)src/**/*.csproj" Exclude="$(AuthExclusions);$(AutomationExclusions);$(StorageExclusions)"/>
426+
</ItemGroup>
427+
<!-- https://stackoverflow.com/a/35477012/294804 -->
428+
<ItemGroup>
429+
<ModuleCsprojFilesRelative Include="@(ModuleCsprojFiles)">
430+
<RelativePath>$([MSBuild]::MakeRelative($(LibraryRoot), %(ModuleCsprojFiles.FullPath)))</RelativePath>
431+
</ModuleCsprojFilesRelative>
432+
</ItemGroup>
433+
<Exec Command="dotnet sln Azure.PowerShell.sln add @(ModuleCsprojFilesRelative->'%(RelativePath)', ' ')" />
434+
<Exec Command="dotnet sln Azure.PowerShell.sln add $(LibraryRoot)tools/ScenarioTest.ResourceManager/ScenarioTest.ResourceManager.csproj $(LibraryRoot)tools/TestFx/TestFx.csproj" />
435+
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
436+
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
437+
<Exec Command="dotnet build Azure.PowerShell.sln --configuration $(Configuration)" />
438+
<Exec Command="dotnet new console -n Net472Tests" />
439+
<Exec Command="dotnet add Net472Tests package xunit.runner.console --version 2.4.0" />
440+
<Exec Command="dotnet restore --packages ./artifacts/tools -f --no-cache Net472Tests" />
441+
<Exec Command="$(PowerShellCommandPrefix) &quot;$(LibraryToolsFolder)/TestNet472Modules.ps1 -TestExecPath '$(LibraryArtifactsFolder)/tools/xunit.runner.console/2.4.0/tools/net472/xunit.console.exe' &quot;" />
442+
<OnError ExecuteTargets="TestFailureErrorMessage" />
443+
</Target>
444+
410445
<Target Name="TestFailureErrorMessage">
411446
<Error Text="Test failures occured, check the files in artifacts/Test" />
412447
</Target>

src/ApiManagement/ApiManagement.ServiceManagement.Test/ScenarioTests/ApiManagementTests.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function Api-ImportExportWadlTest {
164164

165165
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $serviceName
166166

167-
$wadlPath = Join-Path "$TestOutputRoot" "Resources" "WADLYahoo.xml"
167+
$wadlPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "WADLYahoo.xml"
168168
$path = "wadlapi"
169169
$wadlApiId = getAssetName
170170

@@ -198,7 +198,7 @@ function Api-ImportExportSwaggerTest {
198198

199199
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $serviceName
200200

201-
$swaggerPath = Join-Path "$TestOutputRoot" "Resources" "SwaggerPetStoreV2.json"
201+
$swaggerPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "SwaggerPetStoreV2.json"
202202
$swaggerUrl = "http://petstore.swagger.io/v2/swagger.json"
203203
$path1 = "swaggerapifromFile"
204204
$path2 = "swaggerapifromUrl"
@@ -254,7 +254,7 @@ function Api-ImportExportWsdlTest {
254254

255255
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $serviceName
256256
$wsdlUrl = "http://fazioapisoap.azurewebsites.net/fazioService.svc?singleWSDL"
257-
$wsdlPath1 = Join-Path "$TestOutputRoot" "Resources" "Weather.wsdl"
257+
$wsdlPath1 = Join-Path (Join-Path "$TestOutputRoot" "Resources") "Weather.wsdl"
258258
$path1 = "soapapifromFile"
259259
$path2 = "soapapifromUrl"
260260
$wsdlApiId1 = getAssetName
@@ -1091,10 +1091,10 @@ function Policy-CrudTest {
10911091

10921092
# load from file get to pipeline scenarios
10931093

1094-
$tenantValidPath = Join-Path "$TestOutputRoot" "Resources" "TenantValidPolicy.xml"
1095-
$productValidPath = Join-Path "$TestOutputRoot" "Resources" "ProductValidPolicy.xml"
1096-
$apiValidPath = Join-Path "$TestOutputRoot" "Resources" "ApiValidPolicy.xml"
1097-
$operationValidPath = Join-Path "$TestOutputRoot" "Resources" "OperationValidPolicy.xml"
1094+
$tenantValidPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "TenantValidPolicy.xml"
1095+
$productValidPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "ProductValidPolicy.xml"
1096+
$apiValidPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "ApiValidPolicy.xml"
1097+
$operationValidPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "OperationValidPolicy.xml"
10981098

10991099
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $serviceName
11001100

@@ -1285,7 +1285,7 @@ function Certificate-CrudTest {
12851285

12861286
Assert-AreEqual 0 $certificates.Count
12871287

1288-
$certPath = Join-Path "$TestOutputRoot" "Resources" "powershelltest.pfx"
1288+
$certPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "powershelltest.pfx"
12891289
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
12901290
$certPassword = 'Password'
12911291
$certSubject = "CN=*.msitesting.net"
@@ -2122,7 +2122,7 @@ function BackendServiceFabric-CrudTest {
21222122

21232123
# create certificate
21242124
$certId = getAssetName
2125-
$certPath = Join-Path "$TestOutputRoot" "Resources" "powershelltest.pfx"
2125+
$certPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "powershelltest.pfx"
21262126
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]
21272127
$certPassword = 'Password'
21282128
$certSubject = "CN=*.msitesting.net"
@@ -2299,7 +2299,7 @@ function ApiRevision-CrudTest {
22992299

23002300
$context = New-AzApiManagementContext -ResourceGroupName $resourceGroupName -ServiceName $serviceName
23012301

2302-
$swaggerPath = Join-Path "$TestOutputRoot" "Resources" "SwaggerPetStoreV2.json"
2302+
$swaggerPath = Join-Path (Join-Path "$TestOutputRoot" "Resources") "SwaggerPetStoreV2.json"
23032303
$path1 = "swaggerapifromFile"
23042304
$swaggerApiId1 = getAssetName
23052305
$apiRevisionId = "2"

src/ApiManagement/ApiManagement/help/Remove-AzApiManagementProduct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.ApiManagement.ServiceManagement.dll-Help.xml
33
Module Name: Az.ApiManagement
44
ms.assetid: D6B7F253-03CD-40BE-87D6-E4AE300A29D5
@@ -26,7 +26,7 @@ The **Remove-AzApiManagementProduct** cmdlet removes an existing API Management
2626
### Example 1: Remove an existing product and all subscriptions
2727
```powershell
2828
PS C:\>$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
29-
PS C:\>Remove-AzApiManagementProduct -Context $apimContext -ProductId "0123456789" -DeleteSubscriptions -Force
29+
PS C:\>Remove-AzApiManagementProduct -Context $apimContext -ProductId "0123456789" -DeleteSubscriptions
3030
```
3131

3232
This command removes an existing product and all subscriptions.

src/Automation/Automation.Test/Automation.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<PropertyGroup>
1010
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
1111
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
12+
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
1213
</PropertyGroup>
1314

1415
<ItemGroup>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.Automation.Test.UnitTests.Models
16+
{
17+
using System;
18+
using System.Collections.Generic;
19+
using Microsoft.Azure.Commands.Automation.Cmdlet;
20+
using Microsoft.Azure.Management.Automation.Models;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Xunit;
23+
24+
public class ScheduleTest
25+
{
26+
[Fact]
27+
[Trait(Category.AcceptanceType, Category.CheckIn)]
28+
[Trait(Category.Service, Category.Automation)]
29+
public void ScheduleConstructorHandlesMonthlyDayOfWeekSchedule()
30+
{
31+
const string expectedDayOfWeek = "Saturday";
32+
const int occurrence = 1;
33+
34+
var sdkSchedule = new Schedule()
35+
{
36+
Frequency = "Month",
37+
AdvancedSchedule = new AdvancedSchedule()
38+
{
39+
WeekDays = null,
40+
MonthDays = null,
41+
MonthlyOccurrences = new List<AdvancedScheduleMonthlyOccurrence>()
42+
{
43+
new AdvancedScheduleMonthlyOccurrence()
44+
{
45+
Day = expectedDayOfWeek,
46+
Occurrence = occurrence,
47+
},
48+
},
49+
},
50+
};
51+
52+
var schedule = new Model.Schedule("anyRg", "anyAccount", sdkSchedule);
53+
54+
Assert.NotNull(schedule.MonthlyScheduleOptions);
55+
Assert.Null(schedule.WeeklyScheduleOptions);
56+
57+
Assert.Null(schedule.MonthlyScheduleOptions.DaysOfMonth);
58+
Assert.NotNull(schedule.MonthlyScheduleOptions.DayOfWeek);
59+
60+
Assert.Equal(expectedDayOfWeek, schedule.MonthlyScheduleOptions.DayOfWeek.Day);
61+
Assert.Equal(Enum.GetName(typeof(DayOfWeekOccurrence), occurrence), schedule.MonthlyScheduleOptions.DayOfWeek.Occurrence);
62+
}
63+
64+
[Fact]
65+
[Trait(Category.AcceptanceType, Category.CheckIn)]
66+
[Trait(Category.Service, Category.Automation)]
67+
public void ScheduleConstructorHandlesMonthlyDayOfMonthSchedule()
68+
{
69+
var sdkSchedule = new Schedule()
70+
{
71+
Frequency = "Month",
72+
AdvancedSchedule = new AdvancedSchedule()
73+
{
74+
WeekDays = null,
75+
MonthDays = new List<int>() { 1, 15, },
76+
MonthlyOccurrences = null,
77+
},
78+
};
79+
80+
var schedule = new Model.Schedule("anyRg", "anyAccount", sdkSchedule);
81+
82+
Assert.NotNull(schedule.MonthlyScheduleOptions);
83+
Assert.Null(schedule.WeeklyScheduleOptions);
84+
85+
Assert.NotNull(schedule.MonthlyScheduleOptions.DaysOfMonth);
86+
Assert.Null(schedule.MonthlyScheduleOptions.DayOfWeek);
87+
}
88+
89+
[Fact]
90+
[Trait(Category.AcceptanceType, Category.CheckIn)]
91+
[Trait(Category.Service, Category.Automation)]
92+
public void ScheduleConstructorHandlesWeeklySchedule()
93+
{
94+
var sdkSchedule = new Schedule()
95+
{
96+
Frequency = "Week",
97+
AdvancedSchedule = new AdvancedSchedule()
98+
{
99+
WeekDays = new List<string>() { "Monday" },
100+
MonthDays = null,
101+
MonthlyOccurrences = null,
102+
},
103+
};
104+
105+
var schedule = new Model.Schedule("anyRg", "anyAccount", sdkSchedule);
106+
107+
Assert.Null(schedule.MonthlyScheduleOptions);
108+
Assert.NotNull(schedule.WeeklyScheduleOptions);
109+
110+
Assert.NotNull(schedule.WeeklyScheduleOptions.DaysOfWeek);
111+
}
112+
}
113+
}

src/Automation/Automation/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed issue when retreiving certain monthly schedules in several Azure Automation cmdlets
2122

2223
## Version 1.1.1
2324
* Update help for Import-AzAutomationDscNodeConfiguration

src/Automation/Automation/Model/Schedule.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ private WeeklyScheduleOptions CreateWeeklyScheduleOptions(Microsoft.Azure.Manage
233233
private static WeeklyScheduleOptions CreateWeeklyScheduleOptions(Microsoft.Azure.Management.Automation.Models.AdvancedSchedule advSchedule)
234234
{
235235
return advSchedule == null
236+
|| advSchedule.WeekDays == null
236237
? null
237238
: new WeeklyScheduleOptions()
238239
{
@@ -301,7 +302,12 @@ private static string GetDayOfWeekOccurrence(int? dayOfWeekOccurrence)
301302
/// </returns>
302303
private static IList<DaysOfMonth> GetDaysOfMonth(IList<int> daysOfMonth)
303304
{
304-
return daysOfMonth.Select(value => (DaysOfMonth)value).ToList();
305+
if (daysOfMonth != null)
306+
{
307+
return daysOfMonth.Select(value => (DaysOfMonth)value).ToList();
308+
}
309+
310+
return null;
305311
}
306312

307313
private static DateTimeOffset? AdjustOffset(DateTimeOffset? dateTimeOffset, double offsetMinutes)

src/Az.Test.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- Build -->
1313
<PropertyGroup>
14-
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0</TargetFrameworks>
14+
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;netstandard2.0</TargetFrameworks>
1515
<AssemblyName>$(AzAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</AssemblyName>
1616
<RootNamespace>$(AzAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
1717
<IsPackable>false</IsPackable>
@@ -25,6 +25,10 @@
2525
<DefineConstants>TRACE;RELEASE;NETSTANDARD</DefineConstants>
2626
</PropertyGroup>
2727

28+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
29+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
30+
</PropertyGroup>
31+
2832
<ItemGroup Condition="'$(IncludeCommonTestProject)' != 'false'">
2933
<ProjectReference Include="$(RepoTools)ScenarioTest.ResourceManager\ScenarioTest.ResourceManager.csproj" />
3034
<ProjectReference Include="$(RepoTools)TestFx\TestFx.csproj" />

src/Dns/Dns/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Dns/Dns/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
<data name="Success_NewRecordSet" xml:space="preserve">
175175
<value>Record set '{0}' was created in zone '{1}'.The record set is empty. Use Add-AzDnsRecordConfig to add {2} records to it and Set-AzDnsRecordSet to save your changes.</value>
176176
</data>
177+
<data name="Success_NewRecordSetHasRecords" xml:space="preserve">
178+
<value>Record set '{0}' was created in zone '{1}'. Use Add-AzDnsRecordConfig to add more {2} records to it and Set-AzDnsRecordSet to save your changes.</value>
179+
</data>
177180
<data name="Success_NewZone" xml:space="preserve">
178181
<value>Zone '{0}' was created in resource group '{1}'. The SOA and authoritative NS records for this zone have been created automatically. Use Get-AzDnsRecordSet to retrieve them</value>
179182
</data>

src/Dns/Dns/Records/NewAzureDnsRecordSet.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,15 @@ public override void ExecuteCmdlet()
141141
if (result != null)
142142
{
143143
WriteVerbose(ProjectResources.Success);
144-
WriteVerbose(string.Format(ProjectResources.Success_NewRecordSet, this.Name, zoneName, this.RecordType));
144+
if (DnsRecords != null && DnsRecords.Length != 0)
145+
{
146+
WriteVerbose(string.Format(ProjectResources.Success_NewRecordSetHasRecords, this.Name, zoneName, this.RecordType));
147+
}
148+
else
149+
{
150+
WriteVerbose(string.Format(ProjectResources.Success_NewRecordSet, this.Name, zoneName, this.RecordType));
151+
}
152+
145153
WriteVerbose(string.Format(ProjectResources.Success_RecordSetFqdn, this.Name, zoneName, this.RecordType));
146154
}
147155

src/Dns/Dns/Records/RemoveAzureDnsRecordSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public override void ExecuteCmdlet()
126126
if (deleted)
127127
{
128128
WriteVerbose(ProjectResources.Success);
129-
WriteVerbose(ProjectResources.Success_RemoveRecordSet);
129+
WriteVerbose(string.Format(ProjectResources.Success_RemoveRecordSet, this.Name, this.ZoneName));
130130
}
131131

132132
if (this.PassThru)

src/GuestConfiguration/GuestConfiguration/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
[assembly: CLSCompliant(false)]
2626
[assembly: Guid("d28548d3-2673-4508-a28b-a69e0470faf7")]
2727

28-
[assembly: AssemblyVersion("0.10.1")]
29-
[assembly: AssemblyFileVersion("0.10.1")]
28+
[assembly: AssemblyVersion("0.10.2")]
29+
[assembly: AssemblyFileVersion("0.10.2")]

0 commit comments

Comments
 (0)