Hi anonymous user
Thank you for asking this question on the **Microsoft Q&A Platform. **
To log in to Azure AD PowerShell with Admin Account, you can execute the following commands:
$connectionName="AzureRunAsConnection"
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName
# Now you can login to Azure PowerShell with your Service Principal and Certificate
Connect-AzureAD -TenantId $servicePrincipalConnection.TenantId -ApplicationId $servicePrincipalConnection.ApplicationId -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
To create a password credential via power shell you can use this command
$secret = New-AzureADApplicationPasswordCredential -ObjectId "3ddd22e7-a150-4bb3-b100-e410dea1cb84"
Write-Host $secret. Value
I this that with these two sets of commands you can complete your runbook.
Hope this helps!
----------
Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.
NOTE: To answer you as quickly as possible, please mention me in your reply.