Azure Automation Powersell Runbook fails: 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet Azure Automation Powersell Runbook fails: 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet powershell powershell

Azure Automation Powersell Runbook fails: 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet


Follow that blog, I reproduced your error.

You can deploy sqlserver module via this page:

enter image description here

Here is my runbook:

$AzureSQLServerName = "jasonsql"$AzureSQLDatabaseName = "jasondatabase"$AzureSQLServerName = $AzureSQLServerName + ".database.windows.net"$Cred = Get-AutomationPSCredential -Name "SQLLogin"$SQLOutput = $(Invoke-Sqlcmd -ServerInstance $AzureSQLServerName -Username $Cred.UserName -Password $Cred.GetNetworkCredential().Password -Database $AzureSQLDatabaseName -Query "SELECT * FROM INFORMATION_SCHEMA.TABLES " -QueryTimeout 65535 -ConnectionTimeout 60 -Verbose) 4>&1Write-Output $SQLOutput

Here is the result:

enter image description here

Hope this helps.