Skip to content

Commit ca7b18c

Browse files
committed
Merge pull request #61 from huangpf/vmss
Vmss
2 parents 7bf9d2c + 92f1406 commit ca7b18c

File tree

324 files changed

+205352
-193155
lines changed

Some content is hidden

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

324 files changed

+205352
-193155
lines changed

ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* Azure SQL Database: new cmdlets for managing database threat detection policies:
2+
* Get-AzureRmSqlDatabaseThreatDetectionPolicy
3+
* Set-AzureRmSqlDatabaseThreatDetectionPolicy
4+
* Remove-AzureRmSqlDatabaseThreatDetectionPolicy
5+
* Azure RemoteApp: New cmdlets for managing stale machine accounts in AD:
6+
* Get-AzureRemoteAppVmStaleAdObject
7+
* Clear-AzureRemoteAppVmStaleAdObject
8+
19
## 2015.11.09 version 1.0.1
210
* Azure Compute
311
* Added cmdlets for managing VM DiskEncryption extension

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@
215215
<Compile Include="ScenarioTests\FileTests.cs" />
216216
<Compile Include="ScenarioTests\JobTests.cs" />
217217
<Compile Include="ScenarioTests\PoolTests.cs" />
218+
<Compile Include="ScenarioTests\ScenarioTestContext.cs" />
218219
<Compile Include="ScenarioTests\ScenarioTestHelpers.cs" />
219220
<Compile Include="ScenarioTests\SubscriptionTests.cs" />
220221
<Compile Include="ScenarioTests\TaskTests.cs" />
@@ -274,7 +275,7 @@
274275
</None>
275276
<None Include="ScenarioTests\SubscriptionTests.ps1">
276277
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
277-
</None>
278+
</None>
278279
<None Include="ScenarioTests\TaskTests.ps1">
279280
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
280281
</None>
@@ -568,7 +569,7 @@
568569
</None>
569570
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.SubscriptionTests\TestGetSubscriptionQuotas.json">
570571
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
571-
</None>
572+
</None>
572573
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.TaskTests\TestCreateTask.json">
573574
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
574575
</None>

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/CertificateTests.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public void TestGetCertificateByThumbprint()
4343
{
4444
BatchController controller = BatchController.NewInstance;
4545
BatchAccountContext context = null;
46-
string thumbprintAlgorithm = null;
4746
string thumbprint = null;
4847
controller.RunPsTestWorkflow(
4948
() => { return new string[] { string.Format("Test-GetCertificateByThumbprint '{0}' '{1}' '{2}'", accountName, BatchTestHelpers.TestCertificateAlgorithm, thumbprint) }; },
@@ -218,45 +217,4 @@ public void TestCancelCertificateDelete()
218217
TestUtilities.GetCurrentMethodName());
219218
}
220219
}
221-
222-
// Cmdlets that use the HTTP Recorder interceptor for use with scenario tests
223-
[Cmdlet(VerbsCommon.Get, "AzureBatchCertificate_ST", DefaultParameterSetName = Constants.ODataFilterParameterSet)]
224-
public class GetBatchCertificateScenarioTestCommand : GetBatchCertificateCommand
225-
{
226-
protected override void ProcessRecord()
227-
{
228-
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
229-
base.ProcessRecord();
230-
}
231-
}
232-
233-
[Cmdlet(VerbsCommon.New, "AzureBatchCertificate_ST", DefaultParameterSetName = FileParameterSet)]
234-
public class NewBatchCertificateScenarioTestCommand : NewBatchCertificateCommand
235-
{
236-
protected override void ProcessRecord()
237-
{
238-
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
239-
base.ProcessRecord();
240-
}
241-
}
242-
243-
[Cmdlet(VerbsCommon.Remove, "AzureBatchCertificate_ST")]
244-
public class RemoveBatchCertificateScenarioTestCommand : RemoveBatchCertificateCommand
245-
{
246-
protected override void ProcessRecord()
247-
{
248-
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
249-
base.ProcessRecord();
250-
}
251-
}
252-
253-
[Cmdlet(VerbsLifecycle.Stop, "AzureBatchCertificateDeletion_ST")]
254-
public class StopBatchCertificateDeletionScenarioTestCommand : StopBatchCertificateDeletionCommand
255-
{
256-
protected override void ProcessRecord()
257-
{
258-
AdditionalBehaviors = new List<BatchClientBehavior>() { ScenarioTestHelpers.CreateHttpRecordingInterceptor() };
259-
base.ProcessRecord();
260-
}
261-
}
262220
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/CertificateTests.ps1

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,52 @@ Tests adding certificates to a Batch account
1818
#>
1919
function Test-AddCertificate
2020
{
21-
param([string]$accountName)
22-
23-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
24-
25-
# Load certificates so thumbprints can be compared later
26-
$localDir = ($pwd).Path # Use $pwd to get the local directory. If $pwd is not used, paths are relative to [Environment]::CurrentDirectory, which can be different
27-
$cer2Path = $localDir + "\Resources\BatchTestCert02.cer"
28-
$cer3Path = $localDir + "\Resources\BatchTestCert03.cer"
29-
$pfx4Path = $localDir + "\Resources\BatchTestCert04.pfx"
30-
$pfx5Path = $localDir + "\Resources\BatchTestCert05.pfx"
31-
32-
$password = "Passw0rd"
33-
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
34-
35-
$cer2 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $cer2Path
36-
$cer3 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $cer3Path
37-
$pfx4 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($pfx4Path,$securePassword)
38-
$pfx5 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($pfx5Path,$securePassword)
39-
$pfx5Bytes = [System.IO.File]::ReadAllBytes($pfx5Path)
40-
41-
try
42-
{
43-
# .cer by file path
44-
New-AzureBatchCertificate_ST $cer2Path -BatchContext $context
45-
$cert = Get-AzureBatchCertificate_ST "sha1" $cer2.Thumbprint -BatchContext $context
46-
Assert-AreEqual $cer2.Thumbprint $cert.Thumbprint
47-
48-
# .cer by raw data
49-
$cer3 | New-AzureBatchCertificate_ST -BatchContext $context
50-
$cert = Get-AzureBatchCertificate_ST "sha1" $cer3.Thumbprint -BatchContext $context
51-
Assert-AreEqual $cer3.Thumbprint $cert.Thumbprint
52-
53-
# .pfx by file path
54-
New-AzureBatchCertificate_ST $pfx4Path -Password $password -BatchContext $context
55-
$cert = Get-AzureBatchCertificate_ST "sha1" $pfx4.Thumbprint -BatchContext $context
56-
Assert-AreEqual $pfx4.Thumbprint $cert.Thumbprint
57-
58-
# .pfx by raw data
59-
New-AzureBatchCertificate_ST $pfx5Bytes -Password $password -BatchContext $context
60-
$cert = Get-AzureBatchCertificate_ST "sha1" $pfx4.Thumbprint -BatchContext $context
61-
Assert-AreEqual $pfx4.Thumbprint $cert.Thumbprint
62-
}
63-
finally
64-
{
65-
Get-AzureBatchCertificate_ST -BatchContext $context | Remove-AzureBatchCertificate_ST -Force -BatchContext $context
66-
}
21+
param([string]$accountName)
22+
23+
$context = Get-ScenarioTestContext $accountName
24+
25+
# Load certificates so thumbprints can be compared later
26+
$localDir = ($pwd).Path # Use $pwd to get the local directory. If $pwd is not used, paths are relative to [Environment]::CurrentDirectory, which can be different
27+
$cer2Path = $localDir + "\Resources\BatchTestCert02.cer"
28+
$cer3Path = $localDir + "\Resources\BatchTestCert03.cer"
29+
$pfx4Path = $localDir + "\Resources\BatchTestCert04.pfx"
30+
$pfx5Path = $localDir + "\Resources\BatchTestCert05.pfx"
31+
32+
$password = "Passw0rd"
33+
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
34+
35+
$cer2 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $cer2Path
36+
$cer3 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $cer3Path
37+
$pfx4 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($pfx4Path,$securePassword)
38+
$pfx5 = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($pfx5Path,$securePassword)
39+
$pfx5Bytes = [System.IO.File]::ReadAllBytes($pfx5Path)
40+
41+
try
42+
{
43+
# .cer by file path
44+
New-AzureBatchCertificate $cer2Path -BatchContext $context
45+
$cert = Get-AzureBatchCertificate "sha1" $cer2.Thumbprint -BatchContext $context
46+
Assert-AreEqual $cer2.Thumbprint $cert.Thumbprint
47+
48+
# .cer by raw data
49+
$cer3 | New-AzureBatchCertificate -BatchContext $context
50+
$cert = Get-AzureBatchCertificate "sha1" $cer3.Thumbprint -BatchContext $context
51+
Assert-AreEqual $cer3.Thumbprint $cert.Thumbprint
52+
53+
# .pfx by file path
54+
New-AzureBatchCertificate $pfx4Path -Password $password -BatchContext $context
55+
$cert = Get-AzureBatchCertificate "sha1" $pfx4.Thumbprint -BatchContext $context
56+
Assert-AreEqual $pfx4.Thumbprint $cert.Thumbprint
57+
58+
# .pfx by raw data
59+
New-AzureBatchCertificate $pfx5Bytes -Password $password -BatchContext $context
60+
$cert = Get-AzureBatchCertificate "sha1" $pfx4.Thumbprint -BatchContext $context
61+
Assert-AreEqual $pfx4.Thumbprint $cert.Thumbprint
62+
}
63+
finally
64+
{
65+
Get-AzureBatchCertificate -BatchContext $context | Remove-AzureBatchCertificate -Force -BatchContext $context
66+
}
6767
}
6868

6969
<#
@@ -72,13 +72,13 @@ Tests querying for a certificate by its thumbprint
7272
#>
7373
function Test-GetCertificateByThumbprint
7474
{
75-
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
75+
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
7676

77-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
78-
$cert = Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context
77+
$context = Get-ScenarioTestContext $accountName
78+
$cert = Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context
7979

80-
Assert-AreEqual $thumbprint $cert.Thumbprint
81-
Assert-AreEqual $thumbprintAlgorithm $cert.ThumbprintAlgorithm
80+
Assert-AreEqual $thumbprint $cert.Thumbprint
81+
Assert-AreEqual $thumbprintAlgorithm $cert.ThumbprintAlgorithm
8282
}
8383

8484
<#
@@ -87,21 +87,21 @@ Tests querying for Batch certs using a filter
8787
#>
8888
function Test-ListCertificatesByFilter
8989
{
90-
param([string]$accountName, [string]$state, [string]$toDeleteThumbprint, [string]$matches)
90+
param([string]$accountName, [string]$state, [string]$toDeleteThumbprint, [string]$matches)
9191

92-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
93-
$filter = "state eq '$state'"
92+
$context = Get-ScenarioTestContext $accountName
93+
$filter = "state eq '$state'"
9494

95-
# Put a cert in the 'deleting' state
96-
Remove-AzureBatchCertificate_ST "sha1" $toDeleteThumbprint -Force -BatchContext $context
95+
# Put a cert in the 'deleting' state
96+
Remove-AzureBatchCertificate "sha1" $toDeleteThumbprint -Force -BatchContext $context
9797

98-
$certs = Get-AzureBatchCertificate_ST -Filter $filter -BatchContext $context
98+
$certs = Get-AzureBatchCertificate -Filter $filter -BatchContext $context
9999

100-
Assert-AreEqual $matches $certs.Length
101-
foreach($cert in $certs)
102-
{
103-
Assert-AreEqual $state $cert.State
104-
}
100+
Assert-AreEqual $matches $certs.Length
101+
foreach($cert in $certs)
102+
{
103+
Assert-AreEqual $state $cert.State
104+
}
105105
}
106106

107107
<#
@@ -110,29 +110,29 @@ Tests querying for Batch certs using a select clause
110110
#>
111111
function Test-GetAndListCertificatesWithSelect
112112
{
113-
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
113+
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
114114

115-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
116-
$filter = "state eq 'active'"
117-
$selectClause = "thumbprint,state"
115+
$context = Get-ScenarioTestContext $accountName
116+
$filter = "state eq 'active'"
117+
$selectClause = "thumbprint,state"
118118

119-
# Test with Get cert API
120-
$cert = Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context
121-
Assert-AreNotEqual $null $cert.Url
122-
Assert-AreEqual $thumbprint $cert.Thumbprint
119+
# Test with Get cert API
120+
$cert = Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context
121+
Assert-AreNotEqual $null $cert.Url
122+
Assert-AreEqual $thumbprint $cert.Thumbprint
123123

124-
$cert = Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -Select $selectClause -BatchContext $context
125-
Assert-AreEqual $null $cert.Url
126-
Assert-AreEqual $thumbprint $cert.Thumbprint
124+
$cert = Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -Select $selectClause -BatchContext $context
125+
Assert-AreEqual $null $cert.Url
126+
Assert-AreEqual $thumbprint $cert.Thumbprint
127127

128-
# Test with List certs API
129-
$cert = Get-AzureBatchCertificate_ST -Filter $filter -BatchContext $context
130-
Assert-AreNotEqual $null $cert.Url
131-
Assert-AreEqual $thumbprint $cert.Thumbprint
128+
# Test with List certs API
129+
$cert = Get-AzureBatchCertificate -Filter $filter -BatchContext $context
130+
Assert-AreNotEqual $null $cert.Url
131+
Assert-AreEqual $thumbprint $cert.Thumbprint
132132

133-
$cert = Get-AzureBatchCertificate_ST -Filter $filter -Select $selectClause -BatchContext $context
134-
Assert-AreEqual $null $cert.Url
135-
Assert-AreEqual $thumbprint $cert.Thumbprint
133+
$cert = Get-AzureBatchCertificate -Filter $filter -Select $selectClause -BatchContext $context
134+
Assert-AreEqual $null $cert.Url
135+
Assert-AreEqual $thumbprint $cert.Thumbprint
136136
}
137137

138138
<#
@@ -141,12 +141,12 @@ Tests querying for Batch certs and supplying a max count
141141
#>
142142
function Test-ListCertificatesWithMaxCount
143143
{
144-
param([string]$accountName, [string]$maxCount)
144+
param([string]$accountName, [string]$maxCount)
145145

146-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
147-
$certs = Get-AzureBatchCertificate_ST -MaxCount $maxCount -BatchContext $context
146+
$context = Get-ScenarioTestContext $accountName
147+
$certs = Get-AzureBatchCertificate -MaxCount $maxCount -BatchContext $context
148148

149-
Assert-AreEqual $maxCount $certs.Length
149+
Assert-AreEqual $maxCount $certs.Length
150150
}
151151

152152
<#
@@ -155,12 +155,12 @@ Tests querying for all certs under an account
155155
#>
156156
function Test-ListAllCertificates
157157
{
158-
param([string]$accountName, [string]$count)
158+
param([string]$accountName, [string]$count)
159159

160-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
161-
$certs = Get-AzureBatchCertificate_ST -BatchContext $context
160+
$context = Get-ScenarioTestContext $accountName
161+
$certs = Get-AzureBatchCertificate -BatchContext $context
162162

163-
Assert-AreEqual $count $certs.Length
163+
Assert-AreEqual $count $certs.Length
164164
}
165165

166166
<#
@@ -169,21 +169,21 @@ Tests deleting a cert
169169
#>
170170
function Test-DeleteCertificate
171171
{
172-
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
172+
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
173173

174-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
174+
$context = Get-ScenarioTestContext $accountName
175175

176-
# Verify the cert exists
177-
$cert = Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context
178-
Assert-AreEqual $thumbprint $cert.Thumbprint
176+
# Verify the cert exists
177+
$cert = Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context
178+
Assert-AreEqual $thumbprint $cert.Thumbprint
179179

180-
Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context | Remove-AzureBatchCertificate_ST -Force -BatchContext $context
180+
Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context | Remove-AzureBatchCertificate -Force -BatchContext $context
181181

182-
# Verify the cert was deleted. Use the List API since the Get Certificate API will return a 404 if the cert isn't found.
183-
$filter = "state eq 'deleting'"
184-
$cert = Get-AzureBatchCertificate_ST -Filter $filter -BatchContext $context
185-
186-
Assert-True { $cert -eq $null -or $cert.Thumbprint -eq $thumbprint }
182+
# Verify the cert was deleted. Use the List API since the Get Certificate API will return a 404 if the cert isn't found.
183+
$filter = "state eq 'deleting'"
184+
$cert = Get-AzureBatchCertificate -Filter $filter -BatchContext $context
185+
186+
Assert-True { $cert -eq $null -or $cert.Thumbprint -eq $thumbprint }
187187
}
188188

189189
<#
@@ -192,19 +192,19 @@ Tests canceling a cert deletion
192192
#>
193193
function Test-TestCancelCertificateDelete
194194
{
195-
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
195+
param([string]$accountName, [string]$thumbprintAlgorithm, [string]$thumbprint)
196196

197-
$context = Get-AzureRmBatchAccountKeys -Name $accountName
197+
$context = Get-ScenarioTestContext $accountName
198198

199-
# Verify the cert is in the deletefailed state
200-
$cert = Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context
201-
Assert-AreEqual 'deletefailed' $cert.State.ToString().ToLower()
199+
# Verify the cert is in the deletefailed state
200+
$cert = Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context
201+
Assert-AreEqual 'deletefailed' $cert.State.ToString().ToLower()
202202

203-
Get-AzureBatchCertificate_ST $thumbprintAlgorithm $thumbprint -BatchContext $context | Stop-AzureBatchCertificateDeletion_ST -BatchContext $context
203+
Get-AzureBatchCertificate $thumbprintAlgorithm $thumbprint -BatchContext $context | Stop-AzureBatchCertificateDeletion -BatchContext $context
204204

205-
# Verify the cert went back to the active state
206-
$filter = "state eq 'active'"
207-
$cert = Get-AzureBatchCertificate_ST -Filter $filter -BatchContext $context
208-
209-
Assert-AreEqual $thumbprint $cert.Thumbprint
205+
# Verify the cert went back to the active state
206+
$filter = "state eq 'active'"
207+
$cert = Get-AzureBatchCertificate -Filter $filter -BatchContext $context
208+
209+
Assert-AreEqual $thumbprint $cert.Thumbprint
210210
}

0 commit comments

Comments
 (0)