Skip to content

Commit a734307

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-powershell into xynoclafe/exportTemplateSDK
2 parents 89a48cf + 5e94a7f commit a734307

File tree

5,505 files changed

+842610
-632183
lines changed

Some content is hidden

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

5,505 files changed

+842610
-632183
lines changed

LICENSE.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,5 +223,19 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
223223
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
224224
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
225225

226+
***************
227+
228+
The software includes BouncyCastle.NetCore. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software.
229+
230+
BouncyCastle.NetCore
231+
232+
LICENSE
233+
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
234+
235+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
236+
237+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
238+
239+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
226240
-------------END OF THIRD PARTY NOTICE----------------------------------------
227241

documentation/azure-powershell-modules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Database for MariaDB | `Az.MariaDb`
7575
Marketplace | `Az.Marketplace` | [![Marketplace]][MarketplaceGallery]
7676
Marketplace Ordering | `Az.MarketplaceOrdering` | [![MarketplaceOrdering]][MarketplaceOrderingGallery]
7777
Media | `Az.Media` | [![Media]][MediaGallery]
78+
Migrate | `Az.Migrate` | [![Migrate]][MigrateGallery]
7879
Mixed Reality | `Az.MixedReality` | [![MixedReality]][MixedRealityGallery]
7980
Monitor | `Az.Monitor` | [![Monitor]][MonitorGallery]
8081
Monitoring Solutions | `Az.MonitoringSolutions` | [![MonitoringSolutions]][MonitoringSolutionsGallery]
@@ -187,6 +188,7 @@ Web App Service | `Az.Websites`
187188
[Marketplace]: https://img.shields.io/powershellgallery/v/Az.Marketplace.svg?style=flat-square&label=Az.Marketplace
188189
[MarketplaceOrdering]: https://img.shields.io/powershellgallery/v/Az.MarketplaceOrdering.svg?style=flat-square&label=Az.MarketplaceOrdering
189190
[Media]: https://img.shields.io/powershellgallery/v/Az.Media.svg?style=flat-square&label=Az.Media
191+
[Migrate]: https://img.shields.io/powershellgallery/v/Az.Migrate.svg?style=flat-square&label=Az.Migrate
190192
[MixedReality]: https://img.shields.io/powershellgallery/v/Az.MixedReality.svg?style=flat-square&label=Az.MixedReality
191193
[Monitor]: https://img.shields.io/powershellgallery/v/Az.Monitor.svg?style=flat-square&label=Az.Monitor
192194
[MonitoringSolutions]: https://img.shields.io/powershellgallery/v/Az.MonitoringSolutions.svg?style=flat-square&label=Az.MonitoringSolutions
@@ -296,6 +298,7 @@ Web App Service | `Az.Websites`
296298
[MarketplaceGallery]: https://www.powershellgallery.com/packages/Az.Marketplace/
297299
[MarketplaceOrderingGallery]: https://www.powershellgallery.com/packages/Az.MarketplaceOrdering/
298300
[MediaGallery]: https://www.powershellgallery.com/packages/Az.Media/
301+
[MigrateGallery]: https://www.powershellgallery.com/packages/Az.Migrate/
299302
[MixedRealityGallery]: https://www.powershellgallery.com/packages/Az.MixedReality/
300303
[MonitorGallery]: https://www.powershellgallery.com/packages/Az.Monitor/
301304
[MonitoringSolutionsGallery]: https://www.powershellgallery.com/packages/Az.MonitoringSolutions/

src/Accounts/Accounts.Test/AutoSaveSettingOnLoadingTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
using Microsoft.Azure.Commands.Common.Authentication;
1616
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
17-
using Microsoft.Azure.Commands.Common.Authentication.Core;
1817
using Microsoft.Azure.Commands.Common.Authentication.Models;
1918
using Microsoft.Azure.Commands.Common.Authentication.Properties;
2019
using Microsoft.Azure.Commands.ResourceManager.Common;
@@ -111,7 +110,7 @@ public void DisableAutoSaveWhenSettingFileBreaks()
111110
var newSetting = JsonConvert.DeserializeObject<ContextAutosaveSettings>(afterModified) as ContextAutosaveSettings;
112111
Assert.NotNull(newSetting);
113112
Assert.Equal(ContextSaveMode.CurrentUser, newSetting.Mode);
114-
Assert.Equal(typeof(AuthenticationStoreTokenCache), AzureSession.Instance.TokenCache.GetType());
113+
//Assert.Equal(typeof(AzureTokenCache), AzureSession.Instance.TokenCache.GetType());
115114
}
116115
finally
117116
{

src/Accounts/Accounts.Test/AutosaveTests.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Common.Authentication;
16-
// TODO: Remove IfDef
17-
#if NETSTANDARD
18-
using Microsoft.Azure.Commands.Common.Authentication.Core;
19-
#endif
2016
using Microsoft.Azure.Commands.Common.Authentication.Models;
2117
using Microsoft.Azure.ServiceManagement.Common.Models;
2218
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
@@ -49,11 +45,15 @@ void ResetState()
4945

5046
TestExecutionHelpers.SetUpSessionAndProfile();
5147
ResourceManagerProfileProvider.InitializeResourceManagerProfile(true);
48+
// prevent token acquisition
49+
AzureRmProfileProvider.Instance.GetProfile<AzureRmProfile>().ShouldRefreshContextsFromCache = false;
5250
AzureSession.Instance.DataStore = dataStore;
5351
AzureSession.Instance.ARMContextSaveMode = ContextSaveMode.Process;
5452
AzureSession.Instance.AuthenticationFactory = new MockTokenAuthenticationFactory();
55-
AzureSession.Instance.TokenCache = new AuthenticationStoreTokenCache(new AzureTokenCache());
5653
Environment.SetEnvironmentVariable("Azure_PS_Data_Collection", "false");
54+
PowerShellTokenCacheProvider tokenProvider = new InMemoryTokenCacheProvider();
55+
AzureSession.Instance.RegisterComponent(PowerShellTokenCacheProvider.PowerShellTokenCacheProviderKey, () => tokenProvider);
56+
AzureSession.Instance.RegisterComponent(nameof(PowerShellTokenCache), () => tokenProvider.GetTokenCache());
5757
}
5858

5959
[Fact]
@@ -70,9 +70,12 @@ public void EnableAutosaveWhenDisabled()
7070
cmdlet.ExecuteCmdlet();
7171
cmdlet.InvokeEndProcessing();
7272
Assert.Equal(ContextSaveMode.CurrentUser, AzureSession.Instance.ARMContextSaveMode);
73-
Assert.Equal(typeof(ProtectedFileTokenCache), AzureSession.Instance.TokenCache.GetType());
7473
Assert.Equal(typeof(ProtectedProfileProvider), AzureRmProfileProvider.Instance.GetType());
7574
}
75+
catch (PlatformNotSupportedException)
76+
{
77+
// swallow exception when test env (Linux server) doesn't support token cache persistence
78+
}
7679
finally
7780
{
7881
ResetState();
@@ -94,9 +97,12 @@ public void EnableAutosaveWhenEnabled()
9497
cmdlet.ExecuteCmdlet();
9598
cmdlet.InvokeEndProcessing();
9699
Assert.Equal(ContextSaveMode.CurrentUser, AzureSession.Instance.ARMContextSaveMode);
97-
Assert.Equal(typeof(ProtectedFileTokenCache), AzureSession.Instance.TokenCache.GetType());
98100
Assert.Equal(typeof(ProtectedProfileProvider), AzureRmProfileProvider.Instance.GetType());
99101
}
102+
catch (PlatformNotSupportedException)
103+
{
104+
// swallow exception when test env (Linux server) doesn't support token cache persistence
105+
}
100106
finally
101107
{
102108
ResetState();
@@ -119,7 +125,8 @@ public void DisableAutosaveWhenEnabled()
119125
cmdlet.ExecuteCmdlet();
120126
cmdlet.InvokeEndProcessing();
121127
Assert.Equal(ContextSaveMode.Process, AzureSession.Instance.ARMContextSaveMode);
122-
Assert.Equal(typeof(AuthenticationStoreTokenCache), AzureSession.Instance.TokenCache.GetType());
128+
Assert.True(AzureSession.Instance.TryGetComponent(PowerShellTokenCacheProvider.PowerShellTokenCacheProviderKey, out PowerShellTokenCacheProvider factory));
129+
Assert.Equal(typeof(InMemoryTokenCacheProvider), factory.GetType());
123130
Assert.Equal(typeof(ResourceManagerProfileProvider), AzureRmProfileProvider.Instance.GetType());
124131
}
125132
finally
@@ -142,7 +149,8 @@ public void DisableAutoSsaveWhenDisabled()
142149
cmdlet.ExecuteCmdlet();
143150
cmdlet.InvokeEndProcessing();
144151
Assert.Equal(ContextSaveMode.Process, AzureSession.Instance.ARMContextSaveMode);
145-
Assert.Equal(typeof(AuthenticationStoreTokenCache), AzureSession.Instance.TokenCache.GetType());
152+
Assert.True(AzureSession.Instance.TryGetComponent(PowerShellTokenCacheProvider.PowerShellTokenCacheProviderKey, out PowerShellTokenCacheProvider factory));
153+
Assert.Equal(typeof(InMemoryTokenCacheProvider), factory.GetType());
146154
Assert.Equal(typeof(ResourceManagerProfileProvider), AzureRmProfileProvider.Instance.GetType());
147155
}
148156
finally

src/Accounts/Accounts.Test/AzureRMProfileTests.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Common.Authentication;
16-
// TODO: Remove IfDef
17-
#if NETSTANDARD
18-
using Microsoft.Azure.Commands.Common.Authentication.Core;
19-
#endif
2016
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
2117
using Microsoft.Azure.Commands.Common.Authentication.Factories;
2218
using Microsoft.Azure.Commands.Common.Authentication.Models;
@@ -946,7 +942,7 @@ public void SavingProfileWorks()
946942
};
947943
profile.DefaultContext = new AzureContext(sub, account, environment, tenant);
948944
profile.EnvironmentTable[environment.Name] = environment;
949-
profile.DefaultContext.TokenCache = new AuthenticationStoreTokenCache(new AzureTokenCache { CacheData = new byte[] { 1, 2, 3, 4, 5, 6, 8, 9, 0 } });
945+
//profile.DefaultContext.TokenCache = new AuthenticationStoreTokenCache(new AzureTokenCache { CacheData = new byte[] { 1, 2, 3, 4, 5, 6, 8, 9, 0 } });
950946
profile.Save();
951947
string actual = dataStore.ReadFileAsText(path).Substring(1).TrimEnd(new[] { '\0' });
952948
#if NETSTANDARD
@@ -1019,7 +1015,6 @@ public void LoadingProfileWorks()
10191015
Assert.Equal("testCloud", profile.DefaultContext.Environment.Name);
10201016
Assert.Equal("[email protected]", profile.DefaultContext.Account.Id);
10211017
Assert.Equal(AzureAccount.AccountType.User, profile.DefaultContext.Account.Type);
1022-
Assert.Equal(expectedArray, profile.DefaultContext.TokenCache.CacheData);
10231018
Assert.Equal(path, profile.ProfilePath);
10241019
}
10251020

src/Accounts/Accounts.Test/ContextCmdletTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
using System.Linq;
3535
using Microsoft.Azure.Commands.Common.Authentication.ResourceManager;
3636
using Microsoft.Azure.Commands.Profile.Common;
37+
using Microsoft.Azure.Commands.ScenarioTest.Mocks;
3738

3839
namespace Microsoft.Azure.Commands.Profile.Test
3940
{
4041
public class ContextCmdletTests : RMTestBase
4142
{
4243
private MemoryDataStore dataStore;
4344
private MockCommandRuntime commandRuntimeMock;
45+
private MockPowerShellTokenCacheProvider tokenCacheProviderMock;
4446
const string guid1 = "a0cc8bd7-2c6a-47e9-a4c4-3f6ed136e240";
4547
const string guid2 = "eab635c0-a35a-4f70-9e46-e5351c7b5c8b";
4648
const string guid3 = "52f66548-2550-417b-941e-9d6e04f3ac8d";
@@ -52,6 +54,8 @@ public ContextCmdletTests(ITestOutputHelper output)
5254
AzureSession.Instance.DataStore = dataStore;
5355
commandRuntimeMock = new MockCommandRuntime();
5456
AzureSession.Instance.AuthenticationFactory = new MockTokenAuthenticationFactory();
57+
tokenCacheProviderMock = new MockPowerShellTokenCacheProvider();
58+
AzureSession.Instance.RegisterComponent<PowerShellTokenCacheProvider>(PowerShellTokenCacheProvider.PowerShellTokenCacheProviderKey, () => tokenCacheProviderMock);
5559
Environment.SetEnvironmentVariable("Azure_PS_Data_Collection", "True");
5660
}
5761

src/Accounts/Accounts.sln

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 15
3-
VisualStudioVersion = 15.0.27130.2027
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.30503.244
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "Accounts\Accounts.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}"
66
EndProject
@@ -16,10 +16,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioTest.ResourceManage
1616
EndProject
1717
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}"
1818
EndProject
19-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.Test", "Authentication.Test\Authentication.Test.csproj", "{78D9B754-6A18-4125-80CC-63437BDE3244}"
20-
EndProject
2119
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "Authenticators\Authenticators.csproj", "{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}"
2220
EndProject
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.Test", "Authentication.Test\Authentication.Test.csproj", "{43BE9983-BD21-4474-92E5-1FFC0220B2AD}"
22+
EndProject
2323
Global
2424
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2525
Debug|Any CPU = Debug|Any CPU
@@ -50,20 +50,21 @@ Global
5050
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
5151
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
5252
{BC80A1D0-FFA4-43D9-AA74-799F5CB54B58}.Release|Any CPU.Build.0 = Release|Any CPU
53-
{78D9B754-6A18-4125-80CC-63437BDE3244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54-
{78D9B754-6A18-4125-80CC-63437BDE3244}.Debug|Any CPU.Build.0 = Debug|Any CPU
55-
{78D9B754-6A18-4125-80CC-63437BDE3244}.Release|Any CPU.ActiveCfg = Release|Any CPU
56-
{78D9B754-6A18-4125-80CC-63437BDE3244}.Release|Any CPU.Build.0 = Release|Any CPU
5753
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5854
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.Build.0 = Debug|Any CPU
5955
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.ActiveCfg = Release|Any CPU
6056
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{43BE9983-BD21-4474-92E5-1FFC0220B2AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58+
{43BE9983-BD21-4474-92E5-1FFC0220B2AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
59+
{43BE9983-BD21-4474-92E5-1FFC0220B2AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
60+
{43BE9983-BD21-4474-92E5-1FFC0220B2AD}.Release|Any CPU.Build.0 = Release|Any CPU
6161
EndGlobalSection
6262
GlobalSection(SolutionProperties) = preSolution
6363
HideSolutionNode = FALSE
6464
EndGlobalSection
6565
GlobalSection(NestedProjects) = preSolution
6666
{152D78F0-A642-4D0E-B3A8-2FC64FFA9714} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
67+
{43BE9983-BD21-4474-92E5-1FFC0220B2AD} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
6768
EndGlobalSection
6869
GlobalSection(ExtensibilityGlobals) = postSolution
6970
SolutionGuid = {AA51E4F8-AA75-429D-9626-12C7B4305D72}

0 commit comments

Comments
 (0)