You can use the below command for Az automation to connect :
Connect-AzAccount -Identity -SubscriptionName $SubscriptionNm
And execute any powershell commands to database directly :
ex:
$Sourcedatabase = Get-AzSqlDatabase -ResourceGroupName $sourceRG -ServerName $sourceServernm -DatabaseName $sourcedbnm