Hi @Mohamed Guendouzi , Yes, you should modify only that part. It's explained in the same document that I have shared earlier i.e., in this section of the document.
Please follow the document from the start i.e., create managed identity, assign role, migrate run as account to managed identity and use code in the sample scripts section to modify connection part.
So, your runbook might look something like below if you have created system assigned managed identity.
try
{
#Flag for CSP subs
$enableClassicVMs = Get-AutomationVariable -Name 'External_EnableClassicVMs'
"Logging in to Azure..."
Connect-AzAccount -Identity
}
catch {
Write-Error -Message $_.Exception
throw $_.Exception
}