diff --git a/Azure_ICA_all.xml b/Azure_ICA_all.xml
index 8490dc0..0fd74ac 100644
--- a/Azure_ICA_all.xml
+++ b/Azure_ICA_all.xml
@@ -3696,7 +3696,7 @@
ICA-CUSTOM-SCRIPT-EXTENSION-TEST.ps1
ExtensionTest
CustomScriptTouchCommand
- AzureServiceManagement
+ AzureServiceManagement,AzureResourceManager
P0
@@ -3705,7 +3705,7 @@
ICA-OS-PATCHING-EXTENSION-TEST.ps1
OsPatching
ExtensionTest
- AzureServiceManagement
+ AzureServiceManagement,AzureResourceManager
P0
@@ -3714,7 +3714,7 @@
ICA-VM-DIAGNOSTIC-EXTENSION-TEST.ps1
LinuxDiagnosticDefaultDataSet
ExtensionTest
- AzureServiceManagement
+ AzureServiceManagement,AzureResourceManager
P0
diff --git a/TestLibs/ARMLibrary.psm1 b/TestLibs/ARMLibrary.psm1
index fadc620..df794ac 100644
--- a/TestLibs/ARMLibrary.psm1
+++ b/TestLibs/ARMLibrary.psm1
@@ -216,6 +216,36 @@ $apiVersion = "2015-05-01-preview"
$PublicIPName = $($RGName -replace '[^a-zA-Z]') + "PublicIP"
$sshPath = '/home/' + $user + '/.ssh/authorized_keys'
$sshKeyData = ""
+if ( $CurrentTestData.ProvisionTimeExtensions )
+{
+ $extensionString = (Get-Content .\XML\Extensions.xml)
+ foreach ($line in $extensionString.Split("`n"))
+ {
+ if ($line -imatch ">$($CurrentTestData.ProvisionTimeExtensions)<")
+ {
+ $ExecutePS = $true
+ }
+ if ($line -imatch '')
+ {
+ $ExecutePS = $false
+ }
+ if ( ($line -imatch "EXECUTE-PS-" ) -and $ExecutePS)
+ {
+ $PSoutout = ""
+ $line = $line.Trim()
+ $line = $line.Replace("EXECUTE-PS-","")
+ $line = $line.Split(">")
+ $line = $line.Split("<")
+ LogMsg "Executing Powershell command from Extensions.XML file : $($line[2])..."
+ $PSoutout = Invoke-Expression -Command $line[2]
+ $extensionString = $extensionString.Replace("EXECUTE-PS-$($line[2])",$PSoutout)
+ sleep -Milliseconds 1
+ }
+ }
+ $extensionXML = [xml]$extensionString
+}
+
+
LogMsg "ARM Storage Account : $StorageAccountName"
LogMsg "Using API VERSION : $apiVersion "
@@ -940,6 +970,77 @@ if ( $numberOfVMs -eq 1)
LogMsg "Added Virtual Machine $vmName"
Add-Content -Value "$($indents[2])}" -Path $jsonFile
#endregion
+
+ #region Extensions
+if ( $CurrentTestData.ProvisionTimeExtensions)
+{
+ foreach ( $extension in $CurrentTestData.ProvisionTimeExtensions.Split(",") )
+ {
+ $extension = $extension.Trim()
+ foreach ( $newExtn in $extensionXML.Extensions.Extension )
+ {
+ if ($newExtn.Name -eq $extension)
+ {
+ Add-Content -Value "$($indents[2])," -Path $jsonFile
+ Add-Content -Value "$($indents[2]){" -Path $jsonFile
+ Add-Content -Value "$($indents[3])^apiVersion^: ^$apiVersion^," -Path $jsonFile
+ Add-Content -Value "$($indents[3])^type^: ^Microsoft.Compute/virtualMachines/extensions^," -Path $jsonFile
+ Add-Content -Value "$($indents[3])^name^: ^$vmName/$extension^," -Path $jsonFile
+ Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
+ Add-Content -Value "$($indents[3])^dependsOn^: " -Path $jsonFile
+ Add-Content -Value "$($indents[3])[" -Path $jsonFile
+ Add-Content -Value "$($indents[4])^[concat('Microsoft.Compute/virtualMachines/', '$vmName')]^" -Path $jsonFile
+ Add-Content -Value "$($indents[3])]," -Path $jsonFile
+
+ Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
+ Add-Content -Value "$($indents[3]){" -Path $jsonFile
+ Add-Content -Value "$($indents[4])^publisher^:^$($newExtn.Publisher)^," -Path $jsonFile
+ Add-Content -Value "$($indents[4])^type^:^$($newExtn.OfficialName)^," -Path $jsonFile
+ Add-Content -Value "$($indents[4])^typeHandlerVersion^:^$($newExtn.LatestVersion)^" -Path $jsonFile
+ if ($newExtn.PublicConfiguration)
+ {
+ Add-Content -Value "$($indents[4])," -Path $jsonFile
+ Add-Content -Value "$($indents[4])^settings^:" -Path $jsonFile
+ Add-Content -Value "$($indents[4]){" -Path $jsonFile
+ $isConfigAdded = $false
+ foreach ($extnConfig in $newExtn.PublicConfiguration.ChildNodes)
+ {
+ if ( $isConfigAdded )
+ {
+ Add-Content -Value "$($indents[5])," -Path $jsonFile
+ }
+ Add-Content -Value "$($indents[5])^$($extnConfig.Name)^ : ^$($extnConfig.'#text')^" -Path $jsonFile
+ LogMsg "Added $extension Extension : Public Configuration : $($extnConfig.Name) = $($extnConfig.'#text')"
+ $isConfigAdded = $true
+ }
+ Add-Content -Value "$($indents[4])}" -Path $jsonFile
+
+ }
+ if ( $newExtn.PrivateConfiguration )
+ {
+ Add-Content -Value "$($indents[4])," -Path $jsonFile
+ Add-Content -Value "$($indents[4])^protectedSettings^:" -Path $jsonFile
+ Add-Content -Value "$($indents[4]){" -Path $jsonFile
+ $isConfigAdded = $false
+ foreach ($extnConfig in $newExtn.PrivateConfiguration.ChildNodes)
+ {
+ if ( $isConfigAdded )
+ {
+ Add-Content -Value "$($indents[5])," -Path $jsonFile
+ }
+ Add-Content -Value "$($indents[5])^$($extnConfig.Name)^ : ^$($extnConfig.'#text')^" -Path $jsonFile
+ LogMsg "Added $extension Extension : Private Configuration : $($extnConfig.Name) = $( ( ( $extnConfig.'#text' -replace "\w","*") -replace "\W","*" ) )"
+ $isConfigAdded = $true
+ }
+ Add-Content -Value "$($indents[4])}" -Path $jsonFile
+ }
+ Add-Content -Value "$($indents[3])}" -Path $jsonFile
+ }
+ }
+ }
+}
+ #endregion extension
+ Add-Content -Value "$($indents[2])}" -Path $jsonFile
Add-Content -Value "$($indents[1])]" -Path $jsonFile
#endregion
}
diff --git a/TestLibs/RDFELibs.psm1 b/TestLibs/RDFELibs.psm1
index 0c12cc9..30c4019 100644
--- a/TestLibs/RDFELibs.psm1
+++ b/TestLibs/RDFELibs.psm1
@@ -6235,7 +6235,32 @@ Function RetryOperation($operation, $description, $expectResult=$null, $maxRetry
} while ($True)
return $null
-}#endregion
+}
+
+Function GetStorageAccountKey ($xmlConfig)
+{
+ if ( $UseAzureResourceManager )
+ {
+ $storageAccountName = $xmlConfig.config.Azure.General.ARMStorageAccount
+ $StorageAccounts = Get-AzureStorageAccount
+ foreach ($SA in $StorageAccounts)
+ {
+ if ( $SA.Name -eq $storageAccountName )
+ {
+ LogMsg "Getting $storageAccountName storage account key..."
+ $storageAccountKey = (Get-AzureStorageAccountKey -ResourceGroupName $SA.ResourceGroupName -Name $SA.Name).Key1
+ }
+ }
+ }
+ else
+ {
+ $storageAccountName = $xmlConfig.config.Azure.General.StorageAccount
+ LogMsg "Getting $storageAccountName storage account key..."
+ $storageAccountKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary
+ }
+ return $storageAccountKey
+}
+#endregion
#region LinuxUtilities
Function GetFilePathsFromLinuxFolder ([string]$folderToSearch, $IpAddress, $SSHPort, $username, $password, $maxRetryCount=20)
diff --git a/XML/Extensions.xml b/XML/Extensions.xml
index 4d4b2aa..1c1e6c8 100644
--- a/XML/Extensions.xml
+++ b/XML/Extensions.xml
@@ -3,18 +3,18 @@
CustomScriptTouchCommand
CustomScriptForLinux
- "Microsoft.OSTCExtensions"
+ Microsoft.OSTCExtensions
EXECUTE-PS-(Get-Date).ticks
-
touch /var/log/CustomExtensionSuccessful
1.*
+ 1.3
OsPatching
OSPatchingForLinux
- "Microsoft.OSTCExtensions"
+ Microsoft.OSTCExtensions
EXECUTE-PS-(Get-Date).ticks
Auto
@@ -28,16 +28,18 @@
$false
2.*
+ 2.0
LinuxDiagnosticDefaultDataSet
LinuxDiagnostic
- "Microsoft.OSTCExtensions"
+ Microsoft.OSTCExtensions
- EXECUTE-PS-$xmlConfig.config.Azure.General.StorageAccount
- EXECUTE-PS-(Get-AzureStorageKey -StorageAccountName $xmlConfig.config.Azure.General.StorageAccount).Primary
+ EXECUTE-PS-if($UseAzureResourceManager){$xmlConfig.config.Azure.General.ARMStorageAccount}else{$xmlConfig.config.Azure.General.StorageAccount}
+ EXECUTE-PS-GetStorageAccountKey -xmlConfig $xmlConfig
2.*
+ 2.0
diff --git a/remote-scripts/ICA-CUSTOM-SCRIPT-EXTENSION-TEST.ps1 b/remote-scripts/ICA-CUSTOM-SCRIPT-EXTENSION-TEST.ps1
index def3e77..78e1615 100644
--- a/remote-scripts/ICA-CUSTOM-SCRIPT-EXTENSION-TEST.ps1
+++ b/remote-scripts/ICA-CUSTOM-SCRIPT-EXTENSION-TEST.ps1
@@ -42,24 +42,44 @@ if ($isDeployed)
{
$extensionVerified = $false
}
-
- $ConfirmExtensionScriptBlock = {
+ $ExtensionName = "CustomScriptForLinux"
+ if ( $UseAzureResourceManager )
+ {
+ $ConfirmExtensionScriptBlock = {
+ $ExtensionStatus = Get-AzureResource -OutputObjectFormat New -ResourceGroupName $isDeployed -ResourceType "Microsoft.Compute/virtualMachines/extensions" -ExpandProperties
+ if ( ($ExtensionStatus.Properties.ProvisioningState -eq "Succeeded") -and ( $ExtensionStatus.Properties.Type -eq $ExtensionName ) )
+ {
+ LogMsg "$ExtensionName extension status is Succeeded in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $true
+ }
+ else
+ {
+ LogErr "$ExtensionName extension status is Failed in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $false
+ }
+ return $ExtensionVerfiedWithPowershell
+ }
+ }
+ else
+ {
+ $ConfirmExtensionScriptBlock = {
- $vmDetails = Get-AzureVM -ServiceName $isDeployed
- if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch "CustomScriptForLinux" ))
- {
- $ExtensionVerfiedWithPowershell = $true
- LogMsg "CustomScriptForLinux extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ $vmDetails = Get-AzureVM -ServiceName $isDeployed
+ if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch $ExtensionName ))
+ {
+ $ExtensionVerfiedWithPowershell = $true
+ LogMsg "$ExtensionName extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ else
+ {
+ $ExtensionVerfiedWithPowershell = $false
+ LogErr "$ExtensionName extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ return $ExtensionVerfiedWithPowershell
}
- else
- {
- $ExtensionVerfiedWithPowershell = $false
- LogErr "CustomScriptForLinux extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
- }
- return $ExtensionVerfiedWithPowershell
}
- $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming CustomScript extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
+ $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming $ExtensionName extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
if ( $ExtensionVerfiedWithPowershell -and $extensionVerified )
{
@@ -85,10 +105,8 @@ if ($isDeployed)
$testResult = "Aborted"
}
$resultArr += $testResult
-#$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
}
-
else
{
$testResult = "Aborted"
@@ -98,7 +116,7 @@ else
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
-DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed
+DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result
diff --git a/remote-scripts/ICA-OS-PATCHING-EXTENSION-TEST.ps1 b/remote-scripts/ICA-OS-PATCHING-EXTENSION-TEST.ps1
index 50639ef..5843e31 100644
--- a/remote-scripts/ICA-OS-PATCHING-EXTENSION-TEST.ps1
+++ b/remote-scripts/ICA-OS-PATCHING-EXTENSION-TEST.ps1
@@ -98,24 +98,43 @@ if ($isDeployed)
LogErr "No Extension logs are available."
$extensionVerified = $false
}
-
- $ConfirmExtensionScriptBlock = {
-
- $vmDetails = Get-AzureVM -ServiceName $isDeployed
- if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch "OSPatchingForLinux" ))
- {
- $ExtensionVerfiedWithPowershell = $true
- LogMsg "OSPatchingForLinux extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
- }
- else
- {
- $ExtensionVerfiedWithPowershell = $false
- LogErr "OSPatchingForLinux extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ $ExtensionName = "OSPatchingForLinux"
+ if ( $UseAzureResourceManager )
+ {
+ $ConfirmExtensionScriptBlock = {
+ $ExtensionStatus = Get-AzureResource -OutputObjectFormat New -ResourceGroupName $isDeployed -ResourceType "Microsoft.Compute/virtualMachines/extensions" -ExpandProperties
+ if ( ($ExtensionStatus.Properties.ProvisioningState -eq "Succeeded") -and ( $ExtensionStatus.Properties.Type -eq $ExtensionName ) )
+ {
+ LogMsg "$ExtensionName extension status is Succeeded in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $true
+ }
+ else
+ {
+ LogErr "$ExtensionName extension status is Failed in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $false
+ }
}
return $ExtensionVerfiedWithPowershell
}
-
- $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming OS PATCHING extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
+ else
+ {
+ $ConfirmExtensionScriptBlock = {
+
+ $vmDetails = Get-AzureVM -ServiceName $isDeployed
+ if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch $ExtensionName ))
+ {
+ $ExtensionVerfiedWithPowershell = $true
+ LogMsg "$ExtensionName extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ else
+ {
+ $ExtensionVerfiedWithPowershell = $false
+ LogErr "$ExtensionName extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ return $ExtensionVerfiedWithPowershell
+ }
+ }
+ $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming $ExtensionName extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
if ( $ExtensionVerfiedWithPowershell -and $extensionVerified )
{
$testResult = "PASS"
@@ -153,7 +172,7 @@ else
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
-DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed
+DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result
diff --git a/remote-scripts/ICA-VM-DIAGNOSTIC-EXTENSION-TEST.ps1 b/remote-scripts/ICA-VM-DIAGNOSTIC-EXTENSION-TEST.ps1
index 26f7605..08b0eb2 100644
--- a/remote-scripts/ICA-VM-DIAGNOSTIC-EXTENSION-TEST.ps1
+++ b/remote-scripts/ICA-VM-DIAGNOSTIC-EXTENSION-TEST.ps1
@@ -51,6 +51,7 @@ if ($isDeployed)
LogMsg "Extension Agent not started in Linux VM"
$waitForExtension = $true
$extensionVerified = $false
+ WaitFor -Seconds 30
}
}
else
@@ -69,22 +70,44 @@ if ($isDeployed)
LogErr "No Extension logs are available."
$extensionVerified = $false
}
-
- $ConfirmExtensionScriptBlock = {
- $vmDetails = Get-AzureVM -ServiceName $isDeployed
- if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch "Microsoft.OSTCExtensions.LinuxDiagnostic" ))
- {
- $ExtensionVerfiedWithPowershell = $true
- LogMsg "LinuxDiagnostic extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ $ExtensionName = "LinuxDiagnostic"
+ if ( $UseAzureResourceManager )
+ {
+ $ConfirmExtensionScriptBlock = {
+ $ExtensionStatus = Get-AzureResource -OutputObjectFormat New -ResourceGroupName $isDeployed -ResourceType "Microsoft.Compute/virtualMachines/extensions" -ExpandProperties
+ if ( ($ExtensionStatus.Properties.ProvisioningState -eq "Succeeded") -and ( $ExtensionStatus.Properties.Type -eq $ExtensionName ) )
+ {
+ LogMsg "$ExtensionName extension status is Succeeded in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $true
+ }
+ else
+ {
+ LogErr "$ExtensionName extension status is Failed in Properties.ProvisioningState"
+ $ExtensionVerfiedWithPowershell = $false
+ }
+ return $ExtensionVerfiedWithPowershell
}
- else
- {
- $ExtensionVerfiedWithPowershell = $false
- LogErr "LinuxDiagnostic extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
- }
- return $ExtensionVerfiedWithPowershell
}
- $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming VM DIAGNOSTICS extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
+ else
+ {
+ $ConfirmExtensionScriptBlock = {
+
+ $vmDetails = Get-AzureVM -ServiceName $isDeployed
+ if ( ( $vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Status -eq "Success" ) -and ($vmDetails.ResourceExtensionStatusList.ExtensionSettingStatus.Name -imatch $ExtensionName ))
+ {
+ $ExtensionVerfiedWithPowershell = $true
+ LogMsg "$ExtensionName extension status is SUCCESS in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ else
+ {
+ $ExtensionVerfiedWithPowershell = $false
+ LogErr "$ExtensionName extension status is FAILED in (Get-AzureVM).ResourceExtensionStatusList.ExtensionSettingStatus"
+ }
+ return $ExtensionVerfiedWithPowershell
+ }
+ }
+ $ExtensionVerfiedWithPowershell = RetryOperation -operation $ConfirmExtensionScriptBlock -description "Confirming $ExtensionName extension from Azure side." -expectResult $true -maxRetryCount 10 -retryInterval 10
+
if ( $ExtensionVerfiedWithPowershell -and $extensionVerified)
{
$testResult = "PASS"
@@ -122,7 +145,7 @@ else
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
-DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed
+DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result