Azure automation account and SQL Server VM

sakuraime 2,321 Reputation points
2021-02-18T04:07:41.183+00:00

Suppose I have a SQL Server VM and Azure which is domain join and I have an Azure automation account.
How can I connect to this SQL Server VM from Azure automation account using Windows AD authen ?

I know there is a concept of creating a credential .
https://learn.microsoft.com/en-us/azure/automation/shared-resources/credentials?tabs=azure-powershell

$user = "MyDomain\MyUser"
$pw = ConvertTo-SecureString "PassWord!" -AsPlainText -Force
$cred = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $user, $pw
New-AzureAutomationCredential -AutomationAccountName "MyAutomationAccount" -Name "MyCredential" -Value $cred

just that the above ? Any more setting for Azure automation account to authen with domain ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,736 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,118 questions
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,381 Reputation points
    2021-02-20T11:19:26.053+00:00

    Hi @sakuraime ,

    I hope the issue is resolved! If that's not the case then as you did here, go with the Invoke-SqlCmd cmdlet way. If the focus is on Windows Authentication then you could leverage Hybrid Runbook Worker and see if it helps. Let me know if you need any further clarification.