Private/Test-IsRmOldConnected.ps1
<#
.SYNOPSIS Test if the AzureRm.Profile olded than v3.0 is already connected to Azure .DESCRIPTION Test if the AzureRm.Profile olded than v3.0 is already connected to Azure #> function Test-IsRmOldConnected{ [CmdLetBinding()] [Outputtype("Boolean")] $ErrorActionPreference = 'Stop' Write-Debug '-- begin - Test-IsRmOldConnected --' if (-not (Get-Module AzureRm.Profile)) { Import-Module AzureRm.Profile } [Boolean] $toReturn = $false # AzureRm.Profile < v3.0 $azureRmProfile = [Microsoft.WindowsAzure.Commands.Common.AzureRmProfileProvider]::Instance.Profile if (-not $azureRmProfile.Context.Account.Count) { $toReturn = $false } else { $toReturn = $true } Write-Debug '-- end - Test-IsRmOldConnected --' return $toReturn } |