@@ -229,23 +229,45 @@ function Test-NegativeAnalysisServicesServer
229
229
<#
230
230
. SYNOPSIS
231
231
Test log exporting from Azure Analysis Service server.
232
+ In order to run this test successfully, Following environment variables need to be set.
233
+ ASAZURE_TEST_ROLLOUT e.x. value 'aspaaswestusloop1.asazure-int.windows.net'
234
+ ASAZURE_TESTUSER_PWD e.x. value 'samplepwd'
232
235
#>
233
236
function Test-AnalysisServicesServerLogExport
234
237
{
238
+ param
239
+ (
240
+ $rolloutEnvironment = $env.ASAZURE_TEST_ROLLOUT
241
+ )
235
242
try
236
243
{
244
+ $location = Get-Location
245
+ $resourceGroupName = Get-ResourceGroupName
246
+ $serverName = Get-AnalysisServicesServerName
247
+ New-AzureRmResourceGroup - Name $resourceGroupName - Location $location
248
+
249
+ $serverCreated = New-AzureRmAnalysisServicesServer - ResourceGroupName
$resourceGroupName - Name
$serverName - Location
$location - Sku
' S1' - Administrators
' [email protected] ,[email protected] '
250
+ Assert-True {$serverCreated.ProvisioningState -like " Succeeded" }
251
+ Assert-True {$serverCreated.State -like " Succeeded" }
252
+
253
+ $secpasswd = ConvertTo-SecureString $env.ASAZURE_TESTUSER_PWD - AsPlainText - Force
254
+ $cred = New-Object System.Management.Automation.PSCredential (
' [email protected] ' , $secpasswd )
255
+ $asAzureProfile = Login- AzureAsAccount - RolloutEnvironment $rolloutEnvironment - Credential $cred
256
+ Assert-NotNull $asAzureProfile " Login-AzureAsAccount $rolloutEnvironment must not return null"
257
+
237
258
$tempFile = [System.IO.Path ]::GetTempFileName()
238
- Login- AzureAsAccount
239
- Export-AzureAnalysisServicesInstanceLog - Instance asazure:// westus.asazure.windows.net/ oratest - OutputPath $tempFile
259
+ Export-AzureAnalysisServicesInstanceLog - Instance $serverName - OutputPath $tempFile
240
260
Assert-Exists $tempFile
241
261
$logContent = [System.IO.File ]::ReadAllText($tempFile )
242
- Assert-False ( [string ]::IsNullOrEmpty($logContent ))
262
+ Assert-False { [string ]::IsNullOrEmpty($logContent ); }
243
263
}
244
264
finally
245
265
{
246
266
if (Test-Path $tempFile ) {
247
267
Remove-Item $tempFile
248
268
}
269
+ Invoke-HandledCmdlet - Command {Remove-AzureRmAnalysisServicesServer - ResourceGroupName $resourceGroupName - Name $serverName - Force - ErrorAction SilentlyContinue} - IgnoreFailures
270
+ Invoke-HandledCmdlet - Command {Remove-AzureRmResourceGroup - Name $resourceGroupName - Force - ErrorAction SilentlyContinue} - IgnoreFailures
249
271
}
250
272
}
251
273
0 commit comments