Merge pull request #26 from AbelHu/master
On behalf of Jianbin: Support Azure PowerShell after version 0.8.8.
This commit is contained in:
Коммит
19f9ccc13a
|
@ -231,12 +231,37 @@ Function InstallPackages ($VMIpAddress, $VMSshPort, $VMUserName, $VMPassword)
|
||||||
return $retValue
|
return $retValue
|
||||||
}
|
}
|
||||||
|
|
||||||
Function SetSubscription ($subscriptionID, $subscriptionName, $certificateThumbprint, $managementEndpoint, $storageAccount)
|
Function IsEnvironmentSupported()
|
||||||
{
|
{
|
||||||
$myCert = Get-Item cert:\CurrentUser\My\$certificateThumbprint
|
$version = (Get-Module -Name "Azure").Version
|
||||||
Set-AzureSubscription -SubscriptionName $subscriptionName -Certificate $myCert -SubscriptionID $subscriptionID -ServiceEndpoint $managementEndpoint
|
If ($version.Major -GT 0 -OR
|
||||||
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccountName $storageAccount
|
$version.Minor -GT 8 -OR
|
||||||
Select-AzureSubscription -Current $subscriptionName
|
(($version.Minor -EQ 8) -And ($version.Build -GE 8)))
|
||||||
|
{
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function SetSubscription ($subscriptionID, $subscriptionName, $certificateThumbprint, $managementEndpoint, $storageAccount, $environment = "AzureCloud")
|
||||||
|
{
|
||||||
|
$myCert = Get-Item cert:\CurrentUser\My\$certificateThumbprint
|
||||||
|
|
||||||
|
# For Azure Powershell Version >= 0.8.8, Environment is used in Set-AzureSubscription for replacing ManagementEndpoint
|
||||||
|
if (IsEnvironmentSupported)
|
||||||
|
{
|
||||||
|
Set-AzureSubscription -SubscriptionName $subscriptionName -Certificate $myCert -SubscriptionID $subscriptionID `
|
||||||
|
-CurrentStorageAccountName $storageAccount -Environment $environment
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
Set-AzureSubscription -SubscriptionName $subscriptionName -Certificate $myCert -SubscriptionID $subscriptionID `
|
||||||
|
-CurrentStorageAccountName $storageAccount -ServiceEndpoint $managementEndpoint
|
||||||
|
}
|
||||||
|
Select-AzureSubscription -Current $subscriptionName
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
Загрузка…
Ссылка в новой задаче