src/Connect-cciAzAccount.ps1
function Connect-cciAzAccount { [CmdletBinding()] param ( $subscriptionName, $TenantId ) begin { Write-Verbose "Started running $($MyInvocation.MyCommand)" $cciConnectionParams = Get-cciConnectionParams if (!($subscriptionName)) { $subscriptionName = $cciConnectionParams.AzAccount_subscriptionName } if (!($TenantId)) { $TenantId = $cciConnectionParams.TenantId } $CciAZContext = @{ #'SubscriptionName' = $subscriptionName 'TenantId' = $TenantId } } process { while (!(Get-AzContext)) { Write-Verbose "Logging in to $($subscriptionName)..." Connect-AzAccount @CciAZContext -Verbose } } end { Write-Verbose "Finished running $($MyInvocation.MyCommand)" } } |