if you do not want any prompt to connect to Azure
you can create a script and pass a connection parameter (this is generally not accepted as a safe method
but if you think you can save these files in a secure way you can insert connection parameters to the script as follows)
# Define your service principal credentials
$azureAppId="<Your Azure App ID>"
$azurePassword="<Your Azure Password>"
$azureTenantId="<Your Azure Tenant ID>"
# Create a PS credential object
$psCred = New-Object System.Management.Automation.PSCredential($azureAppId, (ConvertTo-SecureString $azurePassword -AsPlainText -Force))
# Login to Azure
Connect-AzAccount -Credential $psCred -Tenant $azureTenantId -ServicePrincipal
# Get all web apps
Get-AzWebApp