Fixing certificate check logic.

This commit is contained in:
Shital Savekar 2016-03-07 19:06:14 +05:30
Родитель 477e3d0f15
Коммит fc410fa867
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -275,15 +275,16 @@ Function SetSubscription ($subscriptionID, $subscriptionName, $certificateThumbp
}
else
{
try
$myCert = $null
$myCert = Get-Item Cert:\CurrentUser\My\$certificateThumbprint -ErrorAction SilentlyContinue
if ( $myCert.Thumbprint -ne $certificateThumbprint )
{
$myCert = Get-Item cert:\CurrentUser\My\$certificateThumbprint
$myCert = Get-Item Cert:\LocalMachine\My\$certificateThumbprint -ErrorAction SilentlyContinue
}
catch
if ( $myCert.Thumbprint -ne $certificateThumbprint )
{
$myCert = Get-Item cert:\LocalMachine\My\$certificateThumbprint
Throw "Unable to load certificate from `"Cert:\LocalMachine\`" and `"Cert:\CurrentUser\`""
}
# For Azure Powershell Version >= 0.8.8, Environment is used in Set-AzureSubscription for replacing ManagementEndpoint
if (IsEnvironmentSupported)
{