In Azure automation account - how to use already existing service principal for login in powershell runbook instead of run as account ?
we dont get privilege to create service principal at our organisation .. so would like to use already existing service principal.
Just use the command below.
$azureAplicationId ="<client-id>"
$azureTenantId= "<tenant-id>"
$azurePassword = ConvertTo-SecureString "<client-secret>" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($azureAplicationId , $azurePassword)
Connect-AzAccount -Credential $psCred -TenantId $azureTenantId -ServicePrincipal