Skip to content

Commit bec9f79

Browse files
author
maddieclayton
committed
merge upstream
2 parents 0a9f18a + dd495ae commit bec9f79

File tree

650 files changed

+894054
-81659
lines changed

Some content is hidden

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

650 files changed

+894054
-81659
lines changed

Azure.PowerShell.Netcore.sln

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27130.2010
4+
VisualStudioVersion = 15.0.27130.2027
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Authentication.Netcore", "src\Common\Commands.Common.Authentication\Common.Authentication.Netcore.csproj", "{D12674F6-CB92-438F-A68D-21CE12F8611B}"
77
EndProject
@@ -51,6 +51,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Strategies.Netcore",
5151
EndProject
5252
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Common.Tests", "src\Common\Commands.Common.Tests\Commands.Common.Tests.csproj", "{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}"
5353
EndProject
54+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Common.Compute.Netcore", "src\Common\Commands.Common.Compute\Commands.Common.Compute.Netcore.csproj", "{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}"
55+
EndProject
5456
Global
5557
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5658
Debug|Any CPU = Debug|Any CPU
@@ -205,18 +207,6 @@ Global
205207
{AF50ACE6-9A6A-4A18-8140-B6C5BDD0EFD6}.Release|x64.Build.0 = Release|Any CPU
206208
{AF50ACE6-9A6A-4A18-8140-B6C5BDD0EFD6}.Release|x86.ActiveCfg = Release|Any CPU
207209
{AF50ACE6-9A6A-4A18-8140-B6C5BDD0EFD6}.Release|x86.Build.0 = Release|Any CPU
208-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
209-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
210-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|x64.ActiveCfg = Debug|Any CPU
211-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|x64.Build.0 = Debug|Any CPU
212-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|x86.ActiveCfg = Debug|Any CPU
213-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Debug|x86.Build.0 = Debug|Any CPU
214-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
215-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|Any CPU.Build.0 = Release|Any CPU
216-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|x64.ActiveCfg = Release|Any CPU
217-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|x64.Build.0 = Release|Any CPU
218-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|x86.ActiveCfg = Release|Any CPU
219-
{7B61AB3B-9F62-4B96-BCED-13920B56CD3C}.Release|x86.Build.0 = Release|Any CPU
220210
{40ACDC82-5A87-4D52-83B5-ED21274363A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
221211
{40ACDC82-5A87-4D52-83B5-ED21274363A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
222212
{40ACDC82-5A87-4D52-83B5-ED21274363A5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -337,6 +327,18 @@ Global
337327
{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}.Release|x64.Build.0 = Release|Any CPU
338328
{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}.Release|x86.ActiveCfg = Release|Any CPU
339329
{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}.Release|x86.Build.0 = Release|Any CPU
330+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
331+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
332+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|x64.ActiveCfg = Debug|Any CPU
333+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|x64.Build.0 = Debug|Any CPU
334+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|x86.ActiveCfg = Debug|Any CPU
335+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Debug|x86.Build.0 = Debug|Any CPU
336+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
337+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|Any CPU.Build.0 = Release|Any CPU
338+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|x64.ActiveCfg = Release|Any CPU
339+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|x64.Build.0 = Release|Any CPU
340+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|x86.ActiveCfg = Release|Any CPU
341+
{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}.Release|x86.Build.0 = Release|Any CPU
340342
EndGlobalSection
341343
GlobalSection(SolutionProperties) = preSolution
342344
HideSolutionNode = FALSE

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

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.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/TestHttpOperationsFactory.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Rest.Azure;
1516
using System;
1617
using System.Collections.Concurrent;
1718
using System.Collections.Generic;
@@ -31,7 +32,13 @@ private TestHttpOperationsFactory()
3132
}
3233

3334
IDictionary<string, object> _responses = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
34-
public IHttpOperations<T> GetHttpOperations<T>()
35+
public IHttpOperations<T> GetHttpOperations<T>() where T : class, ICacheable
36+
{
37+
var result = new TestHttpOperations<T>(_responses, _output);
38+
return result;
39+
}
40+
41+
public IHttpOperations<T> GetHttpOperations<T>(bool useCaching) where T : class, ICacheable
3542
{
3643
var result = new TestHttpOperations<T>(_responses, _output);
3744
return result;
@@ -83,7 +90,7 @@ public Task<T> GetAsync(string requestUri, CancellationToken token)
8390
{
8491
if (!_responses.ContainsKey(requestUri))
8592
{
86-
throw new InvalidOperationException(string.Format("Unexpected request Uri '{0}'", requestUri));
93+
throw new CloudException(string.Format("Unexpected request Uri '{0}'", requestUri));
8794
}
8895

8996
var output = _responses[requestUri];

0 commit comments

Comments
 (0)