Skip to content

Commit 1fbf97e

Browse files
author
Hovsep
committed
Merge pull request #21 from pomortaz/vault
Merge vault branch into dev branch
2 parents 6731e94 + 07d5696 commit 1fbf97e

File tree

97 files changed

+11361
-17
lines changed

Some content is hidden

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

97 files changed

+11361
-17
lines changed

AzurePowershell.Test.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<SqlDatabaseTestDebug>.\src\ServiceManagement\Sql\Commands.SqlDatabase.Test\bin\Debug\Microsoft.WindowsAzure.Commands.SqlDatabase.Test.dll</SqlDatabaseTestDebug>
2222
<HDInsightTestDebug>.\src\ServiceManagement\HDInsight\Commands.HDInsight.Test\bin\Debug\Microsoft.WindowsAzure.Commands.HDInsight.Test.dll</HDInsightTestDebug>
2323
<StorageTestDebug>.\src\ServiceManagement\Storage\Commands.Storage.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Storage.Test.dll</StorageTestDebug>
24+
<KeyVaultTestDebug>.\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll</KeyVaultTestDebug>
2425
<TestFilter>"!Functional&#x26;!Scenario&#x26;!AzureRTScenario&#x26;!Sequential&#x26;!PIRTest&#x26;!Preview&#x26;!ADDomain"</TestFilter>
2526
<ScenarioTestFilter>All</ScenarioTestFilter>
2627
<OneSDKCITFilter>"OneSDK&#x26;CIT"</OneSDKCITFilter>
@@ -137,6 +138,13 @@
137138
<Xunit.Runner.MSBuild.xunit Assemblies="$(SqlTestDebug)" Html="$(TestOutputDirectory)\SqlTests.xunit.dll.html" Verbose="false"
138139
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />
139140
</Target>
141+
142+
<!-- Run the KeyVault tests -->
143+
<Target Name="KeyVaultTests">
144+
<Message Importance="high" Text="Running KeyVault tests" />
145+
<Xunit.Runner.MSBuild.xunit Assemblies="$(KeyVaultTestDebug)" Html="$(TestOutputDirectory)\KeyVaultTests.xunit.dll.html" Verbose="true"
146+
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false"/>
147+
</Target>
140148

141149
<!-- Run the scenario tests with Mocks -->
142150
<Target Name="MockedScenarioTests">

build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<!-- Run checkin tests for each pull request -->
196196
<Target Name="Test" DependsOnTargets="BuildDebug;BeforeRunTests">
197197
<Message Importance="high" Text="Running check in tests..." />
198-
<CallTarget Targets="SqlTests; CommonTests; TestManagement; TestHDInsight; TestManagedCache; TestServiceManagement; TestServiceManagementExtensions; TestSqlDatabase; TestStorage; TestResourceManager; MockedScenarioTests; TestDSCExtension_x64; TestBatch; TestDataFactoryManager; TestRecoveryServices; TestStreamAnalyticsManager"/>
198+
<CallTarget Targets="KeyVaultTests; SqlTests; CommonTests; TestManagement; TestHDInsight; TestManagedCache; TestServiceManagement; TestServiceManagementExtensions; TestSqlDatabase; TestStorage; TestResourceManager; MockedScenarioTests; TestDSCExtension_x64; TestBatch; TestDataFactoryManager; TestRecoveryServices; TestStreamAnalyticsManager"/>
199199
</Target>
200200

201201
<!-- Run Full switch with scenario tests -->

setup/azurecmdfiles.wxi

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.

src/AzurePowershell.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network", "Service
143143
EndProject
144144
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network.Test", "ServiceManagement\Network\Commands.Network.Test\Commands.Network.Test.csproj", "{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}"
145145
EndProject
146+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.KeyVault", "ResourceManager\KeyVault\Commands.KeyVault\Commands.KeyVault.csproj", "{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}"
147+
EndProject
148+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.KeyVault.Test", "ResourceManager\KeyVault\Commands.KeyVault.Test\Commands.KeyVault.Test.csproj", "{080B0477-7E52-4455-90AB-23BD13D1B1CE}"
149+
EndProject
146150
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices", "ServiceManagement\RecoveryServices\Commands.RecoveryServices\Commands.RecoveryServices.csproj", "{98B10548-DF97-4FB1-8D82-2A12945D4F21}"
147151
EndProject
148152
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.Test", "ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\Commands.RecoveryServices.Test.csproj", "{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}"
@@ -347,6 +351,10 @@ Global
347351
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Debug|Any CPU.Build.0 = Debug|Any CPU
348352
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Release|Any CPU.ActiveCfg = Release|Any CPU
349353
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Release|Any CPU.Build.0 = Release|Any CPU
354+
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
355+
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Debug|Any CPU.Build.0 = Debug|Any CPU
356+
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.ActiveCfg = Release|Any CPU
357+
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.Build.0 = Release|Any CPU
350358
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
351359
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Debug|Any CPU.Build.0 = Debug|Any CPU
352360
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -355,6 +363,10 @@ Global
355363
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
356364
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
357365
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.Build.0 = Release|Any CPU
366+
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
367+
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
368+
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
369+
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.Build.0 = Release|Any CPU
358370
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
359371
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.Build.0 = Debug|Any CPU
360372
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -396,6 +408,7 @@ Global
396408
{F4ABAD68-64A5-4B23-B09C-42559A7524DE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
397409
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
398410
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
411+
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
399412
{7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
400413
EndGlobalSection
401414
EndGlobal

src/Common/Azure.Common.Extensions/Common/RequiredResourceLookup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ internal static IList<string> RequiredProvidersForResourceManager<T>() where T :
5252
"microsoft.visualstudio",
5353
"microsoft.insights",
5454
"successbricks.cleardb",
55-
"microsoft.cache" };
55+
"microsoft.cache",
56+
"Microsoft.KeyVault"};
5657
}
5758
if (typeof(T).FullName.EndsWith("BatchManagementClient"))
5859
{

src/Common/Azure.Common.Extensions/Factories/AuthenticationFactory.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ public AuthenticationFactory()
3232
}
3333

3434
public ITokenProvider TokenProvider { get; set; }
35+
3536

36-
public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior)
37+
public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
38+
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId)
3739
{
38-
var token = TokenProvider.GetAccessToken(GetAdalConfiguration(environment, tenant), promptBehavior, account.Id, password, account.Type);
40+
var token = TokenProvider.GetAccessToken(GetAdalConfiguration(environment, tenant, resourceId), promptBehavior, account.Id, password, account.Type);
3941
account.Id = token.UserId;
4042
return token;
4143
}
42-
4344
public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context)
4445
{
4546
if (context.Subscription == null)
@@ -77,20 +78,21 @@ public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext
7778
throw new ArgumentException(Resources.InvalidSubscriptionState, ex);
7879
}
7980
}
80-
81-
private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId)
81+
82+
83+
private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId,
84+
AzureEnvironment.Endpoint resourceId)
8285
{
8386
if (environment == null)
8487
{
8588
throw new ArgumentNullException("environment");
8689
}
8790
var adEndpoint = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory];
88-
var adResourceId = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId];
89-
91+
9092
return new AdalConfiguration
9193
{
9294
AdEndpoint = adEndpoint,
93-
ResourceClientUri = adResourceId,
95+
ResourceClientUri = environment.Endpoints[resourceId],
9496
AdDomain = tenantId
9597
};
9698
}

src/Common/Azure.Common.Extensions/Interfaces/IAuthenticationFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ public interface IAuthenticationFactory
2929
/// <param name="tenant"></param>
3030
/// <param name="password"></param>
3131
/// <param name="promptBehavior"></param>
32-
/// <returns></returns>
33-
IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior);
32+
/// <returns></returns>
33+
IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
34+
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId);
3435

3536
SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context);
3637
}

src/Common/Azure.Common.Extensions/Models/AzureEnvironment.Methods.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ private string StorageFileEndpointFormat()
9696
{ AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix },
9797
{ AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.AzureGraphEndpoint },
9898
{ AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.AzureTrafficManagerDnsSuffix },
99+
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.AzureKeyVaultDnsSuffix },
100+
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.AzureKeyVaultServiceEndpointResourceId },
99101
}
100102
}
101103
},
@@ -254,7 +256,7 @@ public string GetPublishSettingsFileUrlWithRealm(string realm = null)
254256

255257
public enum Endpoint
256258
{
257-
ActiveDirectoryServiceEndpointResourceId,
259+
ActiveDirectoryServiceEndpointResourceId,
258260

259261
AdTenant,
260262

@@ -277,6 +279,10 @@ public enum Endpoint
277279
Graph,
278280

279281
TrafficManagerDnsSuffix,
282+
283+
AzureKeyVaultDnsSuffix,
284+
285+
AzureKeyVaultServiceEndpointResourceId,
280286
}
281287
}
282288

@@ -322,5 +328,9 @@ public static class AzureEnvironmentConstants
322328
public const string AzureTrafficManagerDnsSuffix = "trafficmanager.net";
323329

324330
public const string ChinaTrafficManagerDnsSuffix = "trafficmanager.cn";
331+
332+
public const string AzureKeyVaultDnsSuffix = "vault.azure.net";
333+
334+
public const string AzureKeyVaultServiceEndpointResourceId = "https://vault.azure.net";
325335
}
326336
}

src/Common/Commands.Common.Test/Common/ProfileClientTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,8 @@ private void SetMockData()
14241424
{ AzureEnvironment.Endpoint.ActiveDirectory, "https://login.windows-ppe.net/" },
14251425
{ AzureEnvironment.Endpoint.Gallery, "https://current.gallery.azure-test.net" },
14261426
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
1427+
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, "vault-int.azure-int.net"},
1428+
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, "https://vault-int.azure-int.net/"}
14271429
}
14281430
};
14291431
azureAccount = new AzureAccount

src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,9 @@ private void SetMockData()
736736
{ AzureEnvironment.Endpoint.AdTenant, "https://login.windows-ppe.net/" },
737737
{ AzureEnvironment.Endpoint.ActiveDirectory, "https://login.windows-ppe.net/" },
738738
{ AzureEnvironment.Endpoint.Gallery, "https://current.gallery.azure-test.net" },
739-
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
739+
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
740+
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, "vault-int.azure-int.net" },
741+
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, "https://vault-int.azure-int.net/" },
740742
}
741743
};
742744
azureAccount = new AzureAccount

0 commit comments

Comments
 (0)