PowerShell method of provisioning the Azure Automation RunAs account fails.
When I attempt to automate the provisioning of the Azure Automation Run As account using the attached script, the RunAs Certificate and RunAs Connection assets are created successfully, however the RunAs account does not import the thumbprint, name and expiration dates for the RunAs certificate in it's properties. As a workaround, I have to manually create the RunAs account in the portal. This is ok as a manual process, but I was hoping to automate the deployment of a lab or dev/test environment, then immediately provision a run as account for the automation account so that I can schedule startup and shutdown runbooks.
Also, this is how I'm calling the function:
New-RunAsServicePrincipal -rgName $resourceGroupName `
-AutomationAccountName $AutomationAccountName `
-ApplicationDisplayName $ApplicationDisplayName `
-SubscriptionId $subscriptionId `
-SelfSignedCertPlainPassword $SelfSignedCertPlainPassword `
I've also attached the screenshots showing the RunAs Account and the certificate asset.
Thanks in advance. Microsoft rules!
Fixed! I was using a custom name for the certificate asset. Once I changed it to "AzureRunAsCertificate", which is the default name when created in the portal, it works! :-) See, I told you Microsoft rules!