Can we get examples of connecting using nothing but Az Modules? I think it's Connect-AzAutomationConnection but it would be nice to see that spelled out properly.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@Rabbit994 Thanks for bringing this to our attention. Your feedback has been shared with the content owner for further review.
This worked for me:
$connection = Get-AutomationConnection -Name AzureRunAsConnection
Connect-AzAccount -ServicePrincipal `
-Tenant $connection.TenantId `
-ApplicationID $connection.ApplicationId `
-CertificateThumbprint $connection.CertificateThumbprint
Get-AzContext
@Rabbit994 Sorry for the delay in responding, I must have note pressed the Comment button correctly when I submitted it shortly after you asked. In regards to asking how to use the Az modules, by default Azure Automation only imports the AzureRM cmdlets. You must purposely import the Az cmdlets for them to exist. That said we do not want to update an example meant to target beginners to the service with capability that is not found in the Automation Account by default. For that reason this article will continue to just have the AzureRM cmdlets. Until this behavior changes the examples will continue to have AzureRM cmdlets. The example by @dedickinson is absolutely correct and thank you for sharing that example. You can go to Azure PowerShell cmdlets reference docs to learn all about the Az commands. We do have a article on how to manage AZ modules in your Automation Account, that would be beneficial to read to understand some of the caveats to using them in Azure Automation. For now unfortunately I am not going to update the examples. I will keep your suggestion a consideration in the future, but it is important to note that the cmdlet names only differ from AzureRM to Az for almost all of the cmdlets. Any exceptions are shown here cmdlet name changes @MicrosoftDocs/azure-cxp-triage #please-close
@georgewallace, Thank you!
@Rabbit994, We will close this out, but if you feel you need more information please just let us know.
Most helpful comment
@Rabbit994 Sorry for the delay in responding, I must have note pressed the Comment button correctly when I submitted it shortly after you asked. In regards to asking how to use the Az modules, by default Azure Automation only imports the AzureRM cmdlets. You must purposely import the Az cmdlets for them to exist. That said we do not want to update an example meant to target beginners to the service with capability that is not found in the Automation Account by default. For that reason this article will continue to just have the AzureRM cmdlets. Until this behavior changes the examples will continue to have AzureRM cmdlets. The example by @dedickinson is absolutely correct and thank you for sharing that example. You can go to Azure PowerShell cmdlets reference docs to learn all about the Az commands. We do have a article on how to manage AZ modules in your Automation Account, that would be beneficial to read to understand some of the caveats to using them in Azure Automation. For now unfortunately I am not going to update the examples. I will keep your suggestion a consideration in the future, but it is important to note that the cmdlet names only differ from AzureRM to Az for almost all of the cmdlets. Any exceptions are shown here cmdlet name changes @MicrosoftDocs/azure-cxp-triage #please-close