automation account add connection

%3CLINGO-SUB%20id%3D%22lingo-sub-121560%22%20slang%3D%22en-US%22%3Eautomation%20account%20add%20connection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-121560%22%20slang%3D%22en-US%22%3E%3CP%3Ehey%20%2C%20i%20am%20new%20to%20azure%2C%20i%20am%20facing%20a%20automation%20issue%2C%3C%2FP%3E%3CP%3Ei%20have%20success%20create%20a%20runbook%20and%20when%20i%20run%20it%2C%20it%20got%20error%2C%20the%20told%20me%3A%3C%2FP%3E%3CP%3EGet-AutomationConnection%20%3A%20Connections%20asset%20not%20found.%20To%20create%20this%20Connections%20asset%2C%20navigate%20to%20the%20Assets%20blade%20and%20create%20a%20Connections%20asset%20named%3A%20AzureRunAsConnection.%3C%2FP%3E%3CP%3Eso%20i%20go%20to%20automation%20account%20---%26gt%3B%20connection%20---%26gt%3Badd%20a%20connection%20(AzureRunAsConnection)%3C%2FP%3E%3CP%3EBUT%2C%20i%20am%20not%20sure%20which%20type%20i%20should%20choose%2C%20so%20i%20selected%20%22Azure%22%20and%20it%20need%20a%20AutomationCertificateName%2C%20i%20don't%20have%20any%20certificate%20on%20automation%20account.%20and%20it%20seems%20can't%20self%20sign.%20so%20i%20type%20AzureRunAsConnection%2C%20same%20with%20my%20connection%20name.%3C%2FP%3E%3CP%3Ethen%2C%20run%20the%20runbook%20again%2C%20got%3C%2FP%3E%3CP%3EAdd-AzureRmAccount%20%3A%20Cannot%20validate%20argument%20on%20parameter%20'TenantId'.%20The%20argument%20is%20null%20or%20empty.%20Provide%20an%20argument%20that%20is%20not%20null%20or%20empty%2C%20and%20then%20try%20the%20command%20again%3C%2FP%3E%3CP%3Ei%20check%20the%20runbook%20powershell%2C%20it's%20seems%20the%20AutomationConnection%20is%20not%20work%3F%20you%20can%20check%20the%20attachment%20which%20uploaded.%3C%2FP%3E%3CP%3Eas%20my%20analysis%2C%20i%20think%20it%20all%20about%20the%20i%20don't%20have%20available%20%22Connection%20%22%20on%20the%20automation%20account.%3C%2FP%3E%3CP%3Ehow%20to%20get%20it%20%3F%3F%3F%3F%3Fplease%20help%3C%2FP%3E%3CP%3Ethanks%3C%2FP%3E%3CP%3Ei%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-121560%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-121575%22%20slang%3D%22en-US%22%3ERe%3A%20automation%20account%20add%20connection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-121575%22%20slang%3D%22en-US%22%3E%3CP%3EI%20guess%20the%20problem%20might%20be%20that%20you%20need%20to%20distinguish%20between%20login%20to%20Azure%20and%20remoting%20to%20your%20server.%20I%20use%20below%20to%20login%20to%20Azure%3A%3C%2FP%3E%3CP%3E%24SubscriptionName%20%3D%20Get-AutomationVariable%20-Name%20'VAR-AUTO-SubscriptionName'%3C%2FP%3E%3CP%3E%24AzureAutomationCredential%20%3D%20Get-AutomationPSCredential%20-Name%20'CRE-AUTO-AutomationUser'%3CBR%20%2F%3E%24AzureAccount%20%3D%20Add-AzureRmAccount%20-Credential%20%24AzureAutomationCredential%20-SubscriptionName%20%24SubscriptionName%3C%2FP%3E%3CP%3EI'm%20not%20using%20Azure%20Connection%20Assets%20but%20retrieve%20credentials%20from%20Azure%20Credential%20Assets%20and%20then%20perform%20the%20remoting%20using%20that%20credential%20-%20same%20as%20you%20did.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

hey , i am new to azure, i am facing a automation issue,

i have success create a runbook and when i run it, it got error, the told me:

Get-AutomationConnection : Connections asset not found. To create this Connections asset, navigate to the Assets blade and create a Connections asset named: AzureRunAsConnection.

so i go to automation account ---> connection --->add a connection (AzureRunAsConnection)

BUT, i am not sure which type i should choose, so i selected "Azure" and it need a AutomationCertificateName, i don't have any certificate on automation account. and it seems can't self sign. so i type AzureRunAsConnection, same with my connection name.

then, run the runbook again, got

Add-AzureRmAccount : Cannot validate argument on parameter 'TenantId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again

i check the runbook powershell, it's seems the AutomationConnection is not work? you can check the attachment which uploaded.

as my analysis, i think it all about the i don't have available "Connection " on the automation account.

how to get it ?????please help

thanks

i

1 Reply
Highlighted

I guess the problem might be that you need to distinguish between login to Azure and remoting to your server. I use below to login to Azure:

$SubscriptionName = Get-AutomationVariable -Name 'VAR-AUTO-SubscriptionName'

$AzureAutomationCredential = Get-AutomationPSCredential -Name 'CRE-AUTO-AutomationUser'
$AzureAccount = Add-AzureRmAccount -Credential $AzureAutomationCredential -SubscriptionName $SubscriptionName

I'm not using Azure Connection Assets but retrieve credentials from Azure Credential Assets and then perform the remoting using that credential - same as you did.