Skip to content

Commit ddccf8d

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Azure/dev' into dev
2 parents 7c57eff + 7bb65be commit ddccf8d

File tree

490 files changed

+169104
-15528
lines changed

Some content is hidden

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

490 files changed

+169104
-15528
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@
517517
* DataFactory
518518
* Added new cmdlet for listing activity windows
519519
- Get-AzureRmDataFactoryActivityWindow
520+
* Fixed Get-AzureRmDataFactoryActivityWindow so it works for named pipeline and activity
520521
* DataLake
521522
* Changed parameter `Host` to `DatabaseHost` and added alias to `Host`
522523
- New-AzureRmDataLakeAnalyticsCatalogSecret

documentation/Using-Azure-TestFramework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ In order to Record/Playback a test, you need to setup a connection string that c
127127
1. The default mode is Playback mode, so no setting up of connection string is required.
128128

129129
#### Record Test with Interactive login using OrgId
130-
TEST_CSM_ORGID_AUTHENTICATION=SubsctiptionId={SubId};UserId={orgId};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
130+
TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId={SubId};UserId={orgId};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
131131

132132
#### Record Test with ServicePrincipal
133-
TEST_CSM_ORGID_AUTHENTICATION=SubsctiptionId={SubId};ServicePrincipal={clientId};ServicePrincipalSecret={clientSecret};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
133+
TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId={SubId};ServicePrincipal={clientId};ServicePrincipalSecret={clientSecret};AADTenant={tenantId};Environment={env};HttpRecorderMode=Record;
134134

135135
2. Run the test and make sure that you got a generated .json file that matches the test name in the bin folder under *SessionRecords folder
136136
3. Copy SessionRecords folder inside the test project and add all *.json files in Visual Studio setting "Copy to Output Directory" property to "Copy if newer"
@@ -149,4 +149,4 @@ In order to Record/Playback a test, you need to setup a connection string that c
149149
TestEnvironment.Endpoints.GraphUri = new Uri("https://newGraphUri.windows.net");
150150

151151
###Note:###
152-
Changing the above properties at run-time has the potential to hard code few things in your tests. Best practice would be to use these properties to change values at run-time from immediate window at run-time and avoid hard-coding certain values.
152+
Changing the above properties at run-time has the potential to hard code few things in your tests. Best practice would be to use these properties to change values at run-time from immediate window at run-time and avoid hard-coding certain values.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Management.Storage;
16+
using Microsoft.WindowsAzure.Commands.Common.Storage;
17+
18+
namespace Microsoft.Azure.Commands.Management.Storage.Models
19+
{
20+
public class ARMStorageProvider : IStorageServiceProvider
21+
{
22+
IStorageManagementClient _client;
23+
24+
public ARMStorageProvider(IStorageManagementClient client)
25+
{
26+
_client = client;
27+
}
28+
public IStorageService GetStorageService(string name, string resourceGroupName)
29+
{
30+
var account = _client.StorageAccounts.GetProperties(resourceGroupName, name);
31+
var keys = _client.StorageAccounts.ListKeys(resourceGroupName, name);
32+
return new ARMStorageService(account, keys.Keys[0].Value,
33+
keys.Keys[1].Value);
34+
}
35+
}
36+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.Common.Storage;
16+
using System;
17+
using System.Collections.Generic;
18+
19+
namespace Microsoft.Azure.Commands.Management.Storage.Models
20+
{
21+
public class ARMStorageService : IStorageService
22+
{
23+
Azure.Management.Storage.Models.StorageAccount _account;
24+
List<string> _authenticationKeys = new List<string>();
25+
public ARMStorageService(Azure.Management.Storage.Models.StorageAccount account,
26+
params string[] authenticationKeys)
27+
{
28+
_account = account;
29+
foreach (var key in authenticationKeys)
30+
{
31+
_authenticationKeys.Add(key);
32+
}
33+
}
34+
35+
public Uri BlobEndpoint
36+
{
37+
get { return GetUri(_account.PrimaryEndpoints.Blob); }
38+
}
39+
40+
public Uri FileEndpoint
41+
{
42+
get { return GetUri(_account.PrimaryEndpoints.File); }
43+
}
44+
45+
public Uri QueueEndpoint
46+
{
47+
get { return GetUri(_account.PrimaryEndpoints.Queue); }
48+
}
49+
50+
public Uri TableEndpoint
51+
{
52+
get { return GetUri(_account.PrimaryEndpoints.Table); }
53+
}
54+
55+
public string Name
56+
{
57+
get { return _account.Name; }
58+
}
59+
60+
public List<string> AuthenticationKeys
61+
{
62+
get { return _authenticationKeys; }
63+
}
64+
65+
/// <summary>
66+
/// Get the resource group name from a storage account resource Id
67+
/// </summary>
68+
/// <param name="resourceId">The resource Id for the storage account</param>
69+
/// <returns>The resource group containing the storage account</returns>
70+
public static string ParseResourceGroupFromId(string resourceId)
71+
{
72+
if (!string.IsNullOrEmpty(resourceId))
73+
{
74+
string[] tokens = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
75+
if (tokens == null || tokens.Length < 4)
76+
{
77+
throw new ArgumentOutOfRangeException("resourceId");
78+
}
79+
return tokens[3];
80+
}
81+
return null;
82+
}
83+
84+
public static Uri GetUri(string uriString)
85+
{
86+
return uriString == null ? null : new Uri(uriString);
87+
}
88+
}
89+
}

src/ResourceManager/CognitiveServices/CognitiveServices.Test/Commands.Management.CognitiveServices.Test.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
<Reference Include="Microsoft.Azure.Management.Authorization">
5151
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5252
</Reference>
53-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.1.0-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
53+
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.2.1-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
5555
<Private>True</Private>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -163,6 +163,9 @@
163163
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestAccountSkus.json">
164164
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
165165
</None>
166+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestCreateAllKindsOfAccounts.json">
167+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
168+
</None>
166169
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccountKeys.json">
167170
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
168171
</None>
@@ -195,4 +198,4 @@
195198
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
196199
</ItemGroup>
197200
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
198-
</Project>
201+
</Project>

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public void TestNewAccount()
4040
TestController.NewInstance.RunPsTest("Test-NewAzureRmCognitiveServicesAccount");
4141
}
4242

43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestCreateAllKindsOfAccounts()
46+
{
47+
TestController.NewInstance.RunPsTest("Test-NewAzureRmAllKindsOfCognitiveServicesAccounts");
48+
}
49+
4350
[Fact]
4451
[Trait(Category.AcceptanceType, Category.CheckIn)]
4552
public void TestRemoveAccount()

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@ function Test-NewAzureRmCognitiveServicesAccount
4848
}
4949
}
5050

51+
<#
52+
.SYNOPSIS
53+
Test New-AzureRmCognitiveServicesAccount
54+
#>
55+
function Test-NewAzureRmAllKindsOfCognitiveServicesAccounts
56+
{
57+
# Setup
58+
$rgname = Get-CognitiveServicesManagementTestResourceName;
59+
60+
try
61+
{
62+
New-AzureRmResourceGroup -Name $rgname -Location 'West US';
63+
64+
# Create all known kinds of Cognitive Services accounts.
65+
Test-CreateCognitiveServicesAccount $rgname 'AcademicTest' 'Academic' 'S0' 'West US'
66+
Test-CreateCognitiveServicesAccount $rgname 'BingAutosuggestTest' 'Bing.Autosuggest' 'S1' 'Global'
67+
Test-CreateCognitiveServicesAccount $rgname 'BingSearchTest' 'Bing.Search' 'S1' 'Global'
68+
Test-CreateCognitiveServicesAccount $rgname 'BingSpeechTest' 'Bing.Speech' 'S0' 'Global'
69+
Test-CreateCognitiveServicesAccount $rgname 'BingSpellCheckTest' 'Bing.SpellCheck' 'S1' 'Global'
70+
Test-CreateCognitiveServicesAccount $rgname 'ComputerVisionTest' 'ComputerVision' 'S0' 'West US'
71+
Test-CreateCognitiveServicesAccount $rgname 'ContentModeratorTest' 'ContentModerator' 'S0' 'West US'
72+
Test-CreateCognitiveServicesAccount $rgname 'EmotionTest' 'Emotion' 'S0' 'West US'
73+
Test-CreateCognitiveServicesAccount $rgname 'FaceTest' 'Face' 'S0' 'West US'
74+
Test-CreateCognitiveServicesAccount $rgname 'LUISTest' 'LUIS' 'S0' 'West US'
75+
Test-CreateCognitiveServicesAccount $rgname 'RecommendationsTest' 'Recommendations' 'S1' 'West US'
76+
Test-CreateCognitiveServicesAccount $rgname 'SpeakerRecognitionTest' 'SpeakerRecognition' 'S0' 'West US'
77+
Test-CreateCognitiveServicesAccount $rgname 'SpeechTest' 'Speech' 'S0' 'West US'
78+
Test-CreateCognitiveServicesAccount $rgname 'SpeechTranslationTest' 'SpeechTranslation' 'S1' 'Global'
79+
Test-CreateCognitiveServicesAccount $rgname 'TextAnalyticsTest' 'TextAnalytics' 'S1' 'West US'
80+
Test-CreateCognitiveServicesAccount $rgname 'TextTranslationTest' 'TextTranslation' 'S1' 'Global'
81+
Test-CreateCognitiveServicesAccount $rgname 'WebLMTest' 'WebLM' 'S0' 'West US'
82+
}
83+
finally
84+
{
85+
# Cleanup
86+
Clean-ResourceGroup $rgname
87+
}
88+
}
89+
5190
<#
5291
.SYNOPSIS
5392
Test Remove-AzureRmCognitiveServicesAccount

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/Common.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ function Retry-IfException
8181
$ErrorActionPreference = $oldErrorActionPreferenceValue;
8282
}
8383

84+
<#
85+
.SYNOPSIS
86+
Create a Cognitive Services account
87+
#>
88+
function Test-CreateCognitiveServicesAccount
89+
{
90+
param([string] $rgname, [string] $accountname, [string] $accounttype, [string] $skuname, [string] $loc)
91+
92+
# Action: create
93+
$createdAccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -Force;
94+
95+
# Assert
96+
Assert-NotNull $createdAccount;
97+
98+
# Cleanup
99+
Retry-IfException { Remove-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
100+
}
101+
84102
<#
85103
.SYNOPSIS
86104
Gets random resource name

0 commit comments

Comments
 (0)