Skip to content

Commit f473e81

Browse files
authored
Merge branch 'preview' into FIPSissue
2 parents 79f2880 + 443db7d commit f473e81

File tree

1,574 files changed

+1186887
-2478479
lines changed

Some content is hidden

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

1,574 files changed

+1186887
-2478479
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,8 @@ Results
226226
Package
227227
.DS_Store
228228
.idea
229+
/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Logger/bin
230+
/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/bin
231+
/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/bin
232+
/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/bin
233+
/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/bin

Azure.PowerShell.Netcore.sln

Lines changed: 870 additions & 2 deletions
Large diffs are not rendered by default.

ChangeLog.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,62 @@
1-
## 5.5.0 - March 2018
1+
## 5.6.0 - March 2018
2+
3+
#### General
4+
* Fix issue with Default Resource Group in CloudShell
5+
* Fix issue where incorrect startup scripts were being executed during module import
6+
7+
#### AzureRM.Profile
8+
* Enable MSI authentication in unsupported scenarios
9+
* Add support for user-defined Managed Service Identity
10+
11+
#### AzureRM.AnalysisServices
12+
* Fixed issue with cleaning up scripts in build
13+
14+
#### AzureRM.Cdn
15+
* Fixed issue with cleaning up scripts in build
16+
17+
#### AzureRM.Compute
18+
* 'New-AzureRmVM' and 'New-AzureRmVMSS' support data disks.
19+
* 'New-AzureRmVM' and 'New-AzureRmVMSS' support custom image by name or by id.
20+
* Log analytic feature
21+
- Added 'Export-AzureRmLogAnalyticRequestRateByInterval' cmdlet
22+
- Added 'Export-AzureRmLogAnalyticThrottledRequests' cmdlet
23+
24+
#### AzureRM.ContainerInstance
25+
* Fix parameter sets issue for container registry and azure file volume mount
26+
27+
#### AzureRM.DataFactoryV2
28+
* Updated the ADF .Net SDK to version 0.6.0-preview containing the following changes:
29+
- Added new AzureDatabricks LinkedService and DatabricksNotebook Activity
30+
- Added headNodeSize and dataNodeSize properties in HDInsightOnDemand LinkedService
31+
- Added LinkedService, Dataset, CopySource for SalesforceMarketingCloud
32+
- Added support for SecureOutput on all activities
33+
- Added new BatchCount property on ForEach activity which control how many concurrent activities to run
34+
- Added new Filter Activity
35+
- Added Linked Service Parameters support
36+
37+
#### AzureRM.Dns
38+
* Support for Private DNS Zones (Public Preview)
39+
- Adds ability to create DNS zones that are visible only to the associated virtual networks
40+
41+
#### AzureRM.Network
42+
* Updating model types for compatibility with DNS cmdlets.
43+
44+
#### AzureRM.RecoveryServices.SiteRecovery
45+
* Changes for ASR Azure to Azure Site Recovery (cmdlets are currently supporting operations for Enterprise to Enterprise, Enterprise to Azure, HyperV to Azure,VMware to Azure)
46+
- New-AzureRmRecoveryServicesAsrProtectionContainer
47+
- New-AzureRmRecoveryServicesAsrAzureToAzureDiskReplicationConfig
48+
- Remove-AzureRmRecoveryServicesAsrProtectionContainer
49+
- Update-AzureRmRecoveryServicesAsrProtectionDirection
50+
51+
#### AzureRM.Storage
52+
* Obsolete following parameters in new and set Storage Account cmdlets: EnableEncryptionService and DisableEncryptionService, since Encryption at Rest is enabled by default and can't be disabled.
53+
- New-AzureRmStorageAccount
54+
- Set-AzureRmStorageAccount
55+
56+
#### AzureRM.Websites
57+
* Fixed the help for Remove-AzureRmWebAppSlot
58+
59+
## 5.5.0 - March 2018
260
#### AzureRM.Profile
361
* Fixed issue with importing aliases
462
* Load version 10.0.3 of Newtonsoft.Json side-by-side with version 6.0.8

build.proj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
<Delete Files="@(ExtraPsdFiles->'%(FullPath)')"/>
299299

300300
<!-- Update module manifests. -->
301-
<Exec Command="&quot;$(PowerShellCoreCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) AzureRM.Netcore -Profile Latest &quot; " Condition="'$(Latest)' == 'true' and '$(CodeSign)' == 'false'" ContinueOnError="false" />
301+
<Exec Command="&quot;$(PowerShellCoreCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) AzureRM.Netcore -Profile Latest &quot; " Condition="'$(Latest)' == 'true'" ContinueOnError="false" />
302302

303303
<!-- Generate the help. -->
304304
<Exec Command="&quot;$(PowerShellCoreCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;Set-Variable -Name ProgressPreference -Value 'SilentlyContinue';. $(LibraryToolsFolder)\GenerateHelp.ps1 -GenerateMamlHelp -BuildConfig $(Configuration) &quot;" ContinueOnError="true" Condition=" '$(SkipHelp)' == 'false' and '$(Latest)' == 'true'"/>
@@ -372,8 +372,8 @@
372372
ContinueOnError="false"
373373
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
374374

375-
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Latest &quot; " Condition="'$(Latest)' == 'true' "/>
376-
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Stack &quot; " Condition="'$(Stack)' == 'true' "/>
375+
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Latest &quot; " Condition="'$(Latest)' == 'true' and '$(NetCore)' == 'false' "/>
376+
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 $(Configuration) $(Scope) -Profile Stack &quot; " Condition="'$(Stack)' == 'true' and '$(NetCore)' == 'false' "/>
377377

378378
<!-- Copying shortcut to be signed -->
379379
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"

src/Common/Commands.Common.Authentication.Abstractions/AzureAccount.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ public static class Property
123123
/// <summary>
124124
/// Login Uri for Managed Service Login
125125
/// </summary>
126-
MSILoginUri = "MSILoginUri";
126+
MSILoginUri = "MSILoginUri",
127+
128+
/// <summary>
129+
/// Backup login Uri for MSI
130+
/// </summary>
131+
MSILoginUriBackup = "MSILoginBackup";
127132

128133

129134
}

src/Common/Commands.Common.Authentication.Abstractions/Commands.Common.Authentication.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<Private>True</Private>
5959
</Reference>
6060
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
61+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.11\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

src/Common/Commands.Common.Authentication.Abstractions/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" />
88
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net452" />
99
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net452" />
10-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
10+
<package id="Microsoft.Rest.ClientRuntime" version="2.3.11" targetFramework="net452" />
1111
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
1212
</packages>

src/Common/Commands.Common.Authentication.Test/AuthenticationFactoryTests.cs

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using Microsoft.Azure.Commands.Common.Authentication.Test;
2626
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2727
using Xunit.Abstractions;
28+
using Microsoft.Rest.Azure;
2829

2930
namespace Common.Authentication.Test
3031
{
@@ -162,14 +163,14 @@ public void CanAuthenticateUsingMSIDefault()
162163
};
163164
var environment = AzureEnvironment.PublicEnvironments["AzureCloud"];
164165
var expectedResource = environment.ActiveDirectoryServiceEndpointResourceId;
165-
var builder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
166-
builder.Query = string.Format("resource={0}", Uri.EscapeDataString(environment.ActiveDirectoryServiceEndpointResourceId));
166+
var builder = new UriBuilder(AuthenticationFactory.DefaultBackupMSILoginUri);
167+
builder.Query = $"resource={Uri.EscapeDataString(environment.ActiveDirectoryServiceEndpointResourceId)}&api-version=2018-02-01";
167168
var defaultUri = builder.Uri.ToString();
168169

169170
var responses = new Dictionary<string, ManagedServiceTokenInfo>(StringComparer.OrdinalIgnoreCase)
170171
{
171172
{defaultUri, new ManagedServiceTokenInfo { AccessToken = expectedAccessToken, ExpiresIn = 3600, Resource=expectedResource}},
172-
{"http://myfunkyurl:10432/oauth2/token?resource=foo", new ManagedServiceTokenInfo { AccessToken = expectedToken2, ExpiresIn = 3600, Resource="foo"} }
173+
{"http://myfunkyurl:10432/oauth2/token?resource=foo&api-version=2018-02-01", new ManagedServiceTokenInfo { AccessToken = expectedToken2, ExpiresIn = 3600, Resource="foo"} }
173174
};
174175
AzureSession.Instance.RegisterComponent(HttpClientOperationsFactory.Name, () => TestHttpOperationsFactory.Create(responses, _output), true);
175176
var authFactory = new AuthenticationFactory();
@@ -189,6 +190,150 @@ public void CanAuthenticateUsingMSIDefault()
189190
Assert.Throws<InvalidOperationException>(() => token3.AccessToken);
190191
}
191192

193+
[Fact]
194+
[Trait(Category.AcceptanceType, Category.CheckIn)]
195+
public void CanAuthenticateUsingMSIResourceId()
196+
{
197+
AzureSessionInitializer.InitializeAzureSession();
198+
string expectedAccessToken = Guid.NewGuid().ToString();
199+
_output.WriteLine("Expected access token for ARM URI: {0}", expectedAccessToken);
200+
string expectedToken2 = Guid.NewGuid().ToString();
201+
string tenant = Guid.NewGuid().ToString();
202+
_output.WriteLine("Expected access token for graph URI: {0}", expectedToken2);
203+
string userId = "/foo/bar/baz";
204+
var account = new AzureAccount
205+
{
206+
Id = userId,
207+
Type = AzureAccount.AccountType.ManagedService
208+
};
209+
var environment = AzureEnvironment.PublicEnvironments["AzureCloud"];
210+
var expectedResource = environment.ActiveDirectoryServiceEndpointResourceId;
211+
var builder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
212+
builder.Query = $"resource={Uri.EscapeDataString(environment.ActiveDirectoryServiceEndpointResourceId)}&msi_res_id={Uri.EscapeDataString(userId)}&api-version=2018-02-01";
213+
var defaultUri = builder.Uri.ToString();
214+
215+
var customBuilder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
216+
customBuilder.Query = $"resource={Uri.EscapeDataString(environment.GraphEndpointResourceId)}&msi_res_id={Uri.EscapeDataString(userId)}&api-version=2018-02-01";
217+
var customUri = customBuilder.Uri.ToString();
218+
219+
var responses = new Dictionary<string, ManagedServiceTokenInfo>(StringComparer.OrdinalIgnoreCase)
220+
{
221+
{defaultUri, new ManagedServiceTokenInfo { AccessToken = expectedAccessToken, ExpiresIn = 3600, Resource=expectedResource}},
222+
{customUri, new ManagedServiceTokenInfo { AccessToken = expectedToken2, ExpiresIn = 3600, Resource=environment.GraphEndpointResourceId} }
223+
};
224+
AzureSession.Instance.RegisterComponent(HttpClientOperationsFactory.Name, () => TestHttpOperationsFactory.Create(responses, _output), true);
225+
var authFactory = new AuthenticationFactory();
226+
var token = authFactory.Authenticate(account, environment, tenant, null, null, null);
227+
_output.WriteLine($"Received access token for default Uri ${token.AccessToken}");
228+
Assert.Equal(expectedAccessToken, token.AccessToken);
229+
var account2 = new AzureAccount
230+
{
231+
Id = userId,
232+
Type = AzureAccount.AccountType.ManagedService
233+
};
234+
var token2 = authFactory.Authenticate(account2, environment, tenant, null, null, null, AzureEnvironment.Endpoint.GraphEndpointResourceId);
235+
_output.WriteLine($"Received access token for custom Uri ${token2.AccessToken}");
236+
Assert.Equal(expectedToken2, token2.AccessToken);
237+
var token3 = authFactory.Authenticate(account, environment, tenant, null, null, null, "bar");
238+
Assert.Throws<InvalidOperationException>(() => token3.AccessToken);
239+
}
240+
241+
[Fact]
242+
[Trait(Category.AcceptanceType, Category.CheckIn)]
243+
public void CanAuthenticateUsingMSIClientId()
244+
{
245+
AzureSessionInitializer.InitializeAzureSession();
246+
string expectedAccessToken = Guid.NewGuid().ToString();
247+
_output.WriteLine("Expected access token for ARM URI: {0}", expectedAccessToken);
248+
string expectedToken2 = Guid.NewGuid().ToString();
249+
string tenant = Guid.NewGuid().ToString();
250+
_output.WriteLine("Expected access token for graph URI: {0}", expectedToken2);
251+
string userId = Guid.NewGuid().ToString();
252+
var account = new AzureAccount
253+
{
254+
Id = userId,
255+
Type = AzureAccount.AccountType.ManagedService
256+
};
257+
var environment = AzureEnvironment.PublicEnvironments["AzureCloud"];
258+
var expectedResource = environment.ActiveDirectoryServiceEndpointResourceId;
259+
var builder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
260+
builder.Query = $"resource={Uri.EscapeDataString(environment.ActiveDirectoryServiceEndpointResourceId)}&client_id={userId}&api-version=2018-02-01";
261+
var defaultUri = builder.Uri.ToString();
262+
263+
var customBuilder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
264+
customBuilder.Query = $"resource={Uri.EscapeDataString(environment.GraphEndpointResourceId)}&client_id={userId}&api-version=2018-02-01";
265+
var customUri = customBuilder.Uri.ToString();
266+
267+
var responses = new Dictionary<string, ManagedServiceTokenInfo>(StringComparer.OrdinalIgnoreCase)
268+
{
269+
{defaultUri, new ManagedServiceTokenInfo { AccessToken = expectedAccessToken, ExpiresIn = 3600, Resource=expectedResource}},
270+
{customUri, new ManagedServiceTokenInfo { AccessToken = expectedToken2, ExpiresIn = 3600, Resource=environment.GraphEndpointResourceId} }
271+
};
272+
AzureSession.Instance.RegisterComponent(HttpClientOperationsFactory.Name, () => TestHttpOperationsFactory.Create(responses, _output), true);
273+
var authFactory = new AuthenticationFactory();
274+
var token = authFactory.Authenticate(account, environment, tenant, null, null, null);
275+
_output.WriteLine($"Received access token for default Uri ${token.AccessToken}");
276+
Assert.Equal(expectedAccessToken, token.AccessToken);
277+
var account2 = new AzureAccount
278+
{
279+
Id = userId,
280+
Type = AzureAccount.AccountType.ManagedService
281+
};
282+
var token2 = authFactory.Authenticate(account2, environment, tenant, null, null, null, AzureEnvironment.Endpoint.GraphEndpointResourceId);
283+
_output.WriteLine($"Received access token for custom Uri ${token2.AccessToken}");
284+
Assert.Equal(expectedToken2, token2.AccessToken);
285+
var token3 = authFactory.Authenticate(account, environment, tenant, null, null, null, "bar");
286+
Assert.Throws<InvalidOperationException>(() => token3.AccessToken);
287+
}
288+
289+
[Fact]
290+
[Trait(Category.AcceptanceType, Category.CheckIn)]
291+
public void CanAuthenticateUsingMSIObjectId()
292+
{
293+
AzureSessionInitializer.InitializeAzureSession();
294+
string expectedAccessToken = Guid.NewGuid().ToString();
295+
_output.WriteLine("Expected access token for ARM URI: {0}", expectedAccessToken);
296+
string expectedToken2 = Guid.NewGuid().ToString();
297+
string tenant = Guid.NewGuid().ToString();
298+
_output.WriteLine("Expected access token for graph URI: {0}", expectedToken2);
299+
string userId = Guid.NewGuid().ToString();
300+
var account = new AzureAccount
301+
{
302+
Id = userId,
303+
Type = AzureAccount.AccountType.ManagedService
304+
};
305+
var environment = AzureEnvironment.PublicEnvironments["AzureCloud"];
306+
var expectedResource = environment.ActiveDirectoryServiceEndpointResourceId;
307+
var builder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
308+
builder.Query = $"resource={Uri.EscapeDataString(environment.ActiveDirectoryServiceEndpointResourceId)}&object_id={userId}&api-version=2018-02-01";
309+
var defaultUri = builder.Uri.ToString();
310+
311+
var customBuilder = new UriBuilder(AuthenticationFactory.DefaultMSILoginUri);
312+
customBuilder.Query = $"resource={Uri.EscapeDataString(environment.GraphEndpointResourceId)}&object_id={userId}&api-version=2018-02-01";
313+
var customUri = customBuilder.Uri.ToString();
314+
315+
var responses = new Dictionary<string, ManagedServiceTokenInfo>(StringComparer.OrdinalIgnoreCase)
316+
{
317+
{defaultUri, new ManagedServiceTokenInfo { AccessToken = expectedAccessToken, ExpiresIn = 3600, Resource=expectedResource}},
318+
{customUri, new ManagedServiceTokenInfo { AccessToken = expectedToken2, ExpiresIn = 3600, Resource=environment.GraphEndpointResourceId} }
319+
};
320+
AzureSession.Instance.RegisterComponent(HttpClientOperationsFactory.Name, () => TestHttpOperationsFactory.Create(responses, _output), true);
321+
var authFactory = new AuthenticationFactory();
322+
var token = authFactory.Authenticate(account, environment, tenant, null, null, null);
323+
_output.WriteLine($"Received access token for default Uri ${token.AccessToken}");
324+
Assert.Equal(expectedAccessToken, token.AccessToken);
325+
var account2 = new AzureAccount
326+
{
327+
Id = userId,
328+
Type = AzureAccount.AccountType.ManagedService
329+
};
330+
var token2 = authFactory.Authenticate(account2, environment, tenant, null, null, null, AzureEnvironment.Endpoint.GraphEndpointResourceId);
331+
_output.WriteLine($"Received access token for custom Uri ${token2.AccessToken}");
332+
Assert.Equal(expectedToken2, token2.AccessToken);
333+
var token3 = authFactory.Authenticate(account, environment, tenant, null, null, null, "bar");
334+
Assert.Throws<InvalidOperationException>(() => token3.AccessToken);
335+
}
336+
192337
[Fact]
193338
[Trait(Category.AcceptanceType, Category.CheckIn)]
194339
void ResponseRedactionWorks()

src/Common/Commands.Common.Authentication.Test/Commands.Common.Authentication.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.9\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
71+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.11\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.9\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
75+
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.12\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
7676
<Private>True</Private>
7777
</Reference>
7878
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

0 commit comments

Comments
 (0)