Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,195 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Could anyone help on how to write the function script in PowerShell to verify If my azure session is logged in?
Using Connect-AzAccount
will not log automatically I believe.
Hi @HKPR , Thanks for reaching out Microsoft Q&A.
Here is the function snippet that will help you to check if have a valid session or not.
function Login()
{
$context = Get-AzContext
if (!$context)
{
Connect-AzAccount
}
else
{
Write-Host " Already connected"
}
}