Skip to content

Commit

Permalink
Merge pull request #5 from Azure/dev
Browse files Browse the repository at this point in the history
merge from azure/azure-powershell/dev
  • Loading branch information
jtlibing committed Jan 12, 2015
2 parents 82901a0 + b12da02 commit 5d3aa89
Show file tree
Hide file tree
Showing 122 changed files with 14,137 additions and 604 deletions.
8 changes: 8 additions & 0 deletions AzurePowershell.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SqlDatabaseTestDebug>.\src\ServiceManagement\Sql\Commands.SqlDatabase.Test\bin\Debug\Microsoft.WindowsAzure.Commands.SqlDatabase.Test.dll</SqlDatabaseTestDebug>
<HDInsightTestDebug>.\src\ServiceManagement\HDInsight\Commands.HDInsight.Test\bin\Debug\Microsoft.WindowsAzure.Commands.HDInsight.Test.dll</HDInsightTestDebug>
<StorageTestDebug>.\src\ServiceManagement\Storage\Commands.Storage.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Storage.Test.dll</StorageTestDebug>
<KeyVaultTestDebug>.\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll</KeyVaultTestDebug>
<TestFilter>"!Functional&#x26;!Scenario&#x26;!AzureRTScenario&#x26;!Sequential&#x26;!PIRTest&#x26;!Preview&#x26;!ADDomain"</TestFilter>
<ScenarioTestFilter>All</ScenarioTestFilter>
<OneSDKCITFilter>"OneSDK&#x26;CIT"</OneSDKCITFilter>
Expand Down Expand Up @@ -137,6 +138,13 @@
<Xunit.Runner.MSBuild.xunit Assemblies="$(SqlTestDebug)" Html="$(TestOutputDirectory)\SqlTests.xunit.dll.html" Verbose="false"
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />
</Target>

<!-- Run the KeyVault tests -->
<Target Name="KeyVaultTests">
<Message Importance="high" Text="Running KeyVault tests" />
<Xunit.Runner.MSBuild.xunit Assemblies="$(KeyVaultTestDebug)" Html="$(TestOutputDirectory)\KeyVaultTests.xunit.dll.html" Verbose="true"
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false"/>
</Target>

<!-- Run the scenario tests with Mocks -->
<Target Name="MockedScenarioTests">
Expand Down
14 changes: 14 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2015.01.08 version 0.8.13
* Key Vault Service - new cmdlets in AzureResourceManager mode:
* Keys:
* Add-AzureKeyVaultKey
* Get-AzureKeyVaultKey
* Set-AzureKeyVaultKey
* Backup-AzureKeyVaultKey
* Restore-AzureKeyVaultKey
* Remove-AzureKeyVaultKey
* Secrets:
* Get-AzureKeyVaultSecret
* Set-AzureKeyVaultSecret
* Remove-AzureKeyVaultSecret

2014.12.12 version 0.8.12
* StreamAnalytics
* New cmdlets in AzureResourceManager mode
Expand Down
2 changes: 1 addition & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<!-- Run checkin tests for each pull request -->
<Target Name="Test" DependsOnTargets="BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running check in tests..." />
<CallTarget Targets="SqlTests; CommonTests; TestManagement; TestHDInsight; TestManagedCache; TestServiceManagement; TestServiceManagementExtensions; TestSqlDatabase; TestStorage; TestResourceManager; MockedScenarioTests; TestDSCExtension_x64; TestBatch; TestDataFactoryManager; TestRecoveryServices; TestStreamAnalyticsManager"/>
<CallTarget Targets="KeyVaultTests; SqlTests; CommonTests; TestManagement; TestHDInsight; TestManagedCache; TestServiceManagement; TestServiceManagementExtensions; TestSqlDatabase; TestStorage; TestResourceManager; MockedScenarioTests; TestDSCExtension_x64; TestBatch; TestDataFactoryManager; TestRecoveryServices; TestStreamAnalyticsManager"/>
</Target>

<!-- Run Full switch with scenario tests -->
Expand Down
4 changes: 2 additions & 2 deletions setup/azurecmd.wxs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<?define productName="Microsoft Azure PowerShell - December 2014" ?>
<?define productName="Microsoft Azure PowerShell - January 2015" ?>
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>

<?define version="0.8.12" ?>
<?define version="0.8.13" ?>
<?define versionedStartMenuFolder="Microsoft Azure" ?>
<?define staleStartMenuFolder="Windows Azure" ?>

Expand Down
202 changes: 202 additions & 0 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/AzurePowershell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network", "Service
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network.Test", "ServiceManagement\Network\Commands.Network.Test\Commands.Network.Test.csproj", "{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.KeyVault", "ResourceManager\KeyVault\Commands.KeyVault\Commands.KeyVault.csproj", "{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.KeyVault.Test", "ResourceManager\KeyVault\Commands.KeyVault.Test\Commands.KeyVault.Test.csproj", "{080B0477-7E52-4455-90AB-23BD13D1B1CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices", "ServiceManagement\RecoveryServices\Commands.RecoveryServices\Commands.RecoveryServices.csproj", "{98B10548-DF97-4FB1-8D82-2A12945D4F21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.Test", "ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\Commands.RecoveryServices.Test.csproj", "{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}"
Expand Down Expand Up @@ -347,6 +351,10 @@ Global
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737}.Release|Any CPU.Build.0 = Release|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.Build.0 = Release|Any CPU
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98B10548-DF97-4FB1-8D82-2A12945D4F21}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -355,6 +363,10 @@ Global
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.Build.0 = Release|Any CPU
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{080B0477-7E52-4455-90AB-23BD13D1B1CE}.Release|Any CPU.Build.0 = Release|Any CPU
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -396,6 +408,7 @@ Global
{F4ABAD68-64A5-4B23-B09C-42559A7524DE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{FDB897BD-FCB4-44A1-8D66-AC99F22EC737} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{A415F75B-EB6A-49A6-934E-5BA71B83D6EB} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ internal static IList<string> RequiredProvidersForResourceManager<T>() where T :
"microsoft.visualstudio",
"microsoft.insights",
"successbricks.cleardb",
"microsoft.cache" };
"microsoft.cache",
"Microsoft.KeyVault"};
}
if (typeof(T).FullName.EndsWith("BatchManagementClient"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ public AuthenticationFactory()
}

public ITokenProvider TokenProvider { get; set; }


public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior)
public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId)
{
var token = TokenProvider.GetAccessToken(GetAdalConfiguration(environment, tenant), promptBehavior, account.Id, password, account.Type);
var token = TokenProvider.GetAccessToken(GetAdalConfiguration(environment, tenant, resourceId), promptBehavior, account.Id, password, account.Type);
account.Id = token.UserId;
return token;
}

public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context)
{
if (context.Subscription == null)
Expand Down Expand Up @@ -77,20 +78,21 @@ public SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext
throw new ArgumentException(Resources.InvalidSubscriptionState, ex);
}
}

private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId)


private AdalConfiguration GetAdalConfiguration(AzureEnvironment environment, string tenantId,
AzureEnvironment.Endpoint resourceId)
{
if (environment == null)
{
throw new ArgumentNullException("environment");
}
var adEndpoint = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectory];
var adResourceId = environment.Endpoints[AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId];


return new AdalConfiguration
{
AdEndpoint = adEndpoint,
ResourceClientUri = adResourceId,
ResourceClientUri = environment.Endpoints[resourceId],
AdDomain = tenantId
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public interface IAuthenticationFactory
/// <param name="tenant"></param>
/// <param name="password"></param>
/// <param name="promptBehavior"></param>
/// <returns></returns>
IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior);
/// <returns></returns>
IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId);

SubscriptionCloudCredentials GetSubscriptionCloudCredentials(AzureContext context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private string StorageFileEndpointFormat()
{ AzureEnvironment.Endpoint.SqlDatabaseDnsSuffix, AzureEnvironmentConstants.AzureSqlDatabaseDnsSuffix },
{ AzureEnvironment.Endpoint.Graph, AzureEnvironmentConstants.AzureGraphEndpoint },
{ AzureEnvironment.Endpoint.TrafficManagerDnsSuffix, AzureEnvironmentConstants.AzureTrafficManagerDnsSuffix },
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, AzureEnvironmentConstants.AzureKeyVaultDnsSuffix },
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, AzureEnvironmentConstants.AzureKeyVaultServiceEndpointResourceId },
}
}
},
Expand Down Expand Up @@ -254,7 +256,7 @@ public string GetPublishSettingsFileUrlWithRealm(string realm = null)

public enum Endpoint
{
ActiveDirectoryServiceEndpointResourceId,
ActiveDirectoryServiceEndpointResourceId,

AdTenant,

Expand All @@ -277,6 +279,10 @@ public enum Endpoint
Graph,

TrafficManagerDnsSuffix,

AzureKeyVaultDnsSuffix,

AzureKeyVaultServiceEndpointResourceId,
}
}

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

public const string ChinaTrafficManagerDnsSuffix = "trafficmanager.cn";

public const string AzureKeyVaultDnsSuffix = "vault.azure.net";

public const string AzureKeyVaultServiceEndpointResourceId = "https://vault.azure.net";
}
}
2 changes: 2 additions & 0 deletions src/Common/Commands.Common.Test/Common/ProfileClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,8 @@ private void SetMockData()
{ AzureEnvironment.Endpoint.ActiveDirectory, "https://login.windows-ppe.net/" },
{ AzureEnvironment.Endpoint.Gallery, "https://current.gallery.azure-test.net" },
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, "vault-int.azure-int.net"},
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, "https://vault-int.azure-int.net/"}
}
};
azureAccount = new AzureAccount
Expand Down
4 changes: 3 additions & 1 deletion src/Common/Commands.Common.Test/Common/ProfileCmdltsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ private void SetMockData()
{ AzureEnvironment.Endpoint.AdTenant, "https://login.windows-ppe.net/" },
{ AzureEnvironment.Endpoint.ActiveDirectory, "https://login.windows-ppe.net/" },
{ AzureEnvironment.Endpoint.Gallery, "https://current.gallery.azure-test.net" },
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
{ AzureEnvironment.Endpoint.ResourceManager, "https://api-current.resources.windows-int.net/" },
{ AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix, "vault-int.azure-int.net" },
{ AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId, "https://vault-int.azure-int.net/" },
}
};
azureAccount = new AzureAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public MockCertificateAuthenticationFactory(string userId, X509Certificate2 cert
Certificate = certificate;
}

public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior)
public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId)
{
if (account.Id == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public MockTokenAuthenticationFactory(string userId, string accessToken)
};
}

public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior)
public IAccessToken Authenticate(AzureAccount account, AzureEnvironment environment, string tenant, SecureString password, ShowDialog promptBehavior,
AzureEnvironment.Endpoint resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId)
{
if (account.Id == null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Commands.Common/AzurePowerShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class AzurePowerShell

public const string AssemblyCopyright = "Copyright © Microsoft";

public const string AssemblyVersion = "0.8.12";
public const string AssemblyVersion = "0.8.13";

public const string AssemblyFileVersion = "0.8.12";
public const string AssemblyFileVersion = "0.8.13";

public const string ProfileFile = "AzureProfile.json";

Expand Down
127 changes: 127 additions & 0 deletions src/Common/Commands.Common/Common/ManagementConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Net.Http.Headers;
using Microsoft.WindowsAzure.Commands.Common;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common
{
public static class ApiConstants
{
public const string AuthorizationHeaderName = "Authorization";

public const string BasicAuthorization = "Basic";

public const string UserAgentHeaderName = "User-Agent";

public const string UserAgentHeaderValue = "AzurePowershell/v" + AzurePowerShell.AssemblyVersion;

public static ProductInfoHeaderValue UserAgentValue = new ProductInfoHeaderValue(
"AzurePowershell",
string.Format("v{0}", AzurePowerShell.AssemblyVersion));

public const string VSDebuggerCausalityDataHeaderName = "VSDebuggerCausalityData";

public const string OperationTrackingIdHeader = "x-ms-request-id";

public const string VersionHeaderContentLatest = "2013-08-01";

public const string VersionHeaderName = "x-ms-version";

}

public class SDKVersion
{
public const string Version180 = "1.8.0";

public const string Version200 = "2.0.0";

public const string Version220 = "2.2.0";

public const string Version230 = "2.3.0";

public const string Version240 = "2.4.0";

public const string Version250 = "2.5.0";
}

public enum DevEnv
{
Local,
Cloud
}

public enum RoleType
{
WebRole,
WorkerRole
}

public enum RuntimeType
{
IISNode,
Node,
PHP,
Cache,
Null
}

public static class EnvironmentName
{
public const string AzureCloud = "AzureCloud";

public const string AzureChinaCloud = "AzureChinaCloud";
}

public static class AzureEnvironmentConstants
{
public const string AzureServiceEndpoint = "https://management.core.windows.net/";

public const string ChinaServiceEndpoint = "https://management.core.chinacloudapi.cn/";

public const string AzureResourceManagerEndpoint = "https://management.azure.com/";

public const string GalleryEndpoint = "https://gallery.azure.com/";

public const string AzurePublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301775";

public const string ChinaPublishSettingsFileUrl = "http://go.microsoft.com/fwlink/?LinkID=301776";

public const string AzureManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=254433";

public const string ChinaManagementPortalUrl = "http://go.microsoft.com/fwlink/?LinkId=301902";

public const string AzureStorageEndpointSuffix = "core.windows.net";

public const string ChinaStorageEndpointSuffix = "core.chinacloudapi.cn";

public const string AzureSqlDatabaseDnsSuffix = ".database.windows.net";

public const string ChinaSqlDatabaseDnsSuffix = ".database.chinacloudapi.cn";

public const string AzureActiveDirectoryEndpoint = "https://login.windows.net/";

public const string ChinaActiveDirectoryEndpoint = "https://login.chinacloudapi.cn/";

public const string AzureGraphEndpoint = "https://graph.windows.net/";

public const string AzureTrafficManagerDnsSuffix = "trafficmanager.net";

public const string ChinaTrafficManagerDnsSuffix = "trafficmanager.cn";

public const string AzureKeyVaultDnsSuffix = "vault.azure.net";

public const string AzureKeyVaultServiceEndpointResourceId = "https://vault.azure.net";
}
}
Loading

0 comments on commit 5d3aa89

Please sign in to comment.