Skip to content

Commit 6035d63

Browse files
committed
2 parents 72b931c + 10ec455 commit 6035d63

File tree

358 files changed

+221203
-178166
lines changed

Some content is hidden

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

358 files changed

+221203
-178166
lines changed

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

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

45+
[Fact]
46+
[Trait(Category.AcceptanceType, Category.CheckIn)]
47+
public void TestNewAccountWithInvalidName()
48+
{
49+
TestController.NewInstance.RunPsTest(traceInterceptor, "Test-NewAzureRmCognitiveServicesAccountInvalidName");
50+
}
51+
4552
[Fact]
4653
[Trait(Category.AcceptanceType, Category.CheckIn)]
4754
public void TestNewAccountWithCustomDomain()

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Test-NewAzureRmCognitiveServicesAccount
3131

3232
New-AzResourceGroup -Name $rgname -Location $loc;
3333

34-
$createdAccount = New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -Force;
34+
$createdAccount = New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc;
3535
Assert-NotNull $createdAccount;
3636
# Call create again, expect to get the same account
3737
$createdAccountAgain = New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc -Force;
@@ -48,6 +48,37 @@ function Test-NewAzureRmCognitiveServicesAccount
4848
}
4949
}
5050

51+
<#
52+
.SYNOPSIS
53+
Test New-AzCognitiveServicesAccountInvalidName
54+
#>
55+
function Test-NewAzureRmCognitiveServicesAccountInvalidName
56+
{
57+
# Setup
58+
$rgname = Get-CognitiveServicesManagementTestResourceName;
59+
60+
try
61+
{
62+
# Test
63+
$accountname = 'csa' + $rgname + ".invalid";
64+
$skuname = 'S2';
65+
$accounttype = 'TextAnalytics';
66+
$loc = Get-Location -providerNamespace "Microsoft.CognitiveServices" -resourceType "accounts" -preferredLocation "West US";
67+
68+
New-AzResourceGroup -Name $rgname -Location $loc;
69+
70+
Assert-ThrowsContains { New-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Type $accounttype -SkuName $skuname -Location $loc;
71+
Assert-NotNull $createdAccount; } 'Failed to create Cognitive Services account.'
72+
73+
Retry-IfException { Remove-AzCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
74+
}
75+
finally
76+
{
77+
# Cleanup
78+
Clean-ResourceGroup $rgname
79+
}
80+
}
81+
5182
<#
5283
.SYNOPSIS
5384
Test New-AzCognitiveServicesAccount

src/CognitiveServices/CognitiveServices.Test/SessionRecords/CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests/TestNewAccountWithInvalidName.json

Lines changed: 597 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Notice
2-
Microsoft will use data you send to Bing Search Services or the Translator Speech API to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).
2+
Microsoft will use data you send to Bing Search Services to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).

src/CognitiveServices/CognitiveServices/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Only display Bing disclaimer for Bing Search Services.
22+
* Improve error when create account failed.
2123

2224
## Version 1.1.0
2325
* Updated cmdlets with plural nouns to singular, and deprecated plural names.

src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.Azure.Management.CognitiveServices;
1919
using Microsoft.Azure.Management.CognitiveServices.Models;
2020
using Newtonsoft.Json.Linq;
21+
using System;
2122
using System.Collections;
2223
using System.Globalization;
2324
using System.Management.Automation;
@@ -118,23 +119,35 @@ public override void ExecuteCmdlet()
118119
if (ShouldProcess(
119120
Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, Name, Type, SkuName, Location)))
120121
{
121-
if (Force.IsPresent)
122+
if (Type.StartsWith("Bing.", StringComparison.InvariantCultureIgnoreCase))
122123
{
123-
WriteWarning(Resources.NewAccount_Notice);
124-
}
125-
else
126-
{
127-
bool yesToAll = false, noToAll = false;
128-
if (!ShouldContinue(Resources.NewAccount_Notice, "Notice", true, ref yesToAll, ref noToAll))
124+
if (Force.IsPresent)
125+
{
126+
WriteWarning(Resources.NewAccount_Notice);
127+
}
128+
else
129129
{
130-
return;
130+
bool yesToAll = false, noToAll = false;
131+
if (!ShouldContinue(Resources.NewAccount_Notice, "Notice", true, ref yesToAll, ref noToAll))
132+
{
133+
return;
134+
}
131135
}
132136
}
137+
try
138+
{
139+
CognitiveServicesAccount createAccountResponse = CognitiveServicesClient.Accounts.Create(
140+
ResourceGroupName,
141+
Name,
142+
createParameters);
143+
}
144+
catch (Exception ex)
145+
{
146+
// Give users a specific message says `Failed to create Cognitive Services account.`
147+
// Details should able be found in the exception.
148+
throw new Exception("Failed to create Cognitive Services account.", ex);
149+
}
133150

134-
CognitiveServicesAccount createAccountResponse = CognitiveServicesClient.Accounts.Create(
135-
ResourceGroupName,
136-
Name,
137-
createParameters);
138151
CognitiveServicesAccount cognitiveServicesAccount = CognitiveServicesClient.Accounts.GetProperties(ResourceGroupName, Name);
139152
WriteCognitiveServicesAccount(cognitiveServicesAccount);
140153
}

src/CognitiveServices/CognitiveServices/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<value>Regenerating Key {0} for account {1}.</value>
122122
</data>
123123
<data name="NewAccount_Notice" xml:space="preserve">
124-
<value>Microsoft will use data you send to Bing Search Services or the Translator Speech API to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).</value>
124+
<value>Microsoft will use data you send to Bing Search Services to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).</value>
125125
</data>
126126
<data name="NewAccount_ProcessMessage" xml:space="preserve">
127127
<value>Creating new Cognitive Services account {0} of type {1}, Sku {2} at location {3}.</value>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Notice
2-
Microsoft will use data you send to Bing Search Services or the Translator Speech API to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).
2+
Microsoft will use data you send to Bing Search Services to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account).

src/Compute/Compute.Test/Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
1515
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="25.0.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
17-
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.10.0-preview" />
17+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.11.0-preview" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

src/DataLakeStore/DataLakeStore.Test/DataLakeStore.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Management.DataLake.Store" Version="2.4.2-preview" />
15-
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.10.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.11.0-preview" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/Dns/Dns.Test/Dns.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Management.Dns" Version="3.0.1" />
15-
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.10.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.11.0-preview" />
1616
</ItemGroup>
1717

1818
</Project>

src/Dns/Dns.Test/ScenarioTests/ZoneTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ public void TestZoneCrud()
3535
DnsTestsBase.NewInstance.RunPowerShellTest(_logger, "Test-ZoneCrud");
3636
}
3737

38+
[Fact]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
public void TestZoneWithDelegation()
41+
{
42+
DnsTestsBase.NewInstance.RunPowerShellTest(_logger, "Test-ZoneWithDelegation");
43+
}
44+
3845
[Fact]
3946
[Trait(Category.AcceptanceType, Category.CheckIn)]
4047
public void TestPrivateZoneCrud()

src/Dns/Dns.Test/ScenarioTests/ZoneTests.ps1

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,65 @@ function Test-ZoneCrud
8080
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
8181
}
8282

83+
<#
84+
.SYNOPSIS
85+
Zone creation with delegation
86+
#>
87+
function Test-ZoneWithDelegation
88+
{
89+
#Parent zone creation
90+
$parentZoneName = Get-RandomZoneName
91+
$resourceGroup = TestSetup-CreateResourceGroup
92+
93+
try
94+
{
95+
$createdParentZone = New-AzDnsZone -Name $parentZoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Tags @{tag1="value1"}
96+
97+
Assert-NotNull $createdParentZone
98+
Assert-NotNull $createdParentZone.Etag
99+
Assert-AreEqual $parentZoneName $createdParentZone.Name
100+
Assert-AreEqual $resourceGroup.ResourceGroupName $createdParentZone.ResourceGroupName
101+
Assert-AreEqual 1 $createdParentZone.Tags.Count
102+
Assert-AreEqual 2 $createdParentZone.NumberOfRecordSets
103+
Assert-AreNotEqual $createdParentZone.NumberOfRecordSets $createdParentZone.MaxNumberOfRecordSets
104+
Assert-Null $createdParentZone.Type
105+
106+
#Child zone creation , pass ParentZoneName to set up delegation
107+
$childZoneNamePrefix = Get-RandomZoneName
108+
$childZoneName = $childZoneNamePrefix + '.' + $parentZoneName
109+
$createdChildZone = New-AzDnsZone -Name $childZoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Tags @{tag1="value1"} -ParentZoneName $parentZoneName
110+
111+
Assert-NotNull $createdChildZone
112+
Assert-NotNull $createdChildZone.Etag
113+
Assert-AreEqual $childZoneName $createdChildZone.Name
114+
Assert-AreEqual $resourceGroup.ResourceGroupName $createdChildZone.ResourceGroupName
115+
Assert-AreEqual 1 $createdChildZone.Tags.Count
116+
Assert-AreEqual 2 $createdChildZone.NumberOfRecordSets
117+
Assert-AreNotEqual $createdChildZone.NumberOfRecordSets $createdChildZone.MaxNumberOfRecordSets
118+
Assert-Null $createdChildZone.Type
119+
120+
# retrieve the delegation record set in parent with name prefix of the child zone created above
121+
$delegationRecordSet = Get-AzDnsRecordSet -Name $childZoneNamePrefix -RecordType NS -ZoneName $parentZoneName -ResourceGroupName $resourceGroup.ResourceGroupName
122+
123+
Assert-NotNull $delegationRecordSet
124+
Assert-NotNull $delegationRecordSet.Records
125+
Assert-AreEqual $createdChildZone.NameServers.Count $delegationRecordSet.Records.Count
126+
127+
#clean up - deleting resources created as part of the test
128+
$removedParent = Remove-AzDnsZone -Name $parentZoneName -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Confirm:$false
129+
$removedChild = Remove-AzDnsZone -Name $childZoneName -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Confirm:$false
130+
131+
Assert-True { $removedParent }
132+
Assert-True { $removedChild }
133+
134+
Assert-Throws { Get-AzDnsZone -Name $parentZoneName -ResourceGroupName $resourceGroup.ResourceGroupName }
135+
Assert-Throws { Get-AzDnsZone -Name $childZoneName -ResourceGroupName $resourceGroup.ResourceGroupName }
136+
}
137+
finally
138+
{
139+
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
140+
}
141+
}
83142
<#
84143
.SYNOPSIS
85144
Full Private Zone CRUD cycle with both registration and resolution virtual networks

src/Dns/Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestPrivateZoneCrud.json

Lines changed: 340 additions & 430 deletions
Large diffs are not rendered by default.

src/Dns/Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestPrivateZoneCrudByVirtualNetworkIds.json

Lines changed: 337 additions & 1054 deletions
Large diffs are not rendered by default.

src/Dns/Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestPrivateZoneCrudByVirtualNetworkObjects.json

Lines changed: 449 additions & 368 deletions
Large diffs are not rendered by default.

src/Dns/Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestPrivateZoneCrudRegistrationVirtualNetwork.json

Lines changed: 250 additions & 739 deletions
Large diffs are not rendered by default.

src/Dns/Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestPrivateZoneCrudResolutionVirtualNetwork.json

Lines changed: 291 additions & 934 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)