Run Azure Automation Runbook Against DB Hosted on an Azure VM

  • Hi - has anyone created a PowerShell runbook which connects to a database hosted on an Azure VM?  This is a new environment, so we allow internal traffic to flow freely, so i dont think it is a firewall issue.  If i add the port number to the server name i receive an error 0.

    Here is a snippet of my script.

    Invoke-Sqlcmd -ServerInstance "azurevmname\utilities" `

    -Database "DBName" `

    -Query $sqlCmd `

    -Username $SqlUsername `

    -Password $SqlPass

    Receiving an error 26 when i try to run the above

    Invoke-Sqlcmd : A network-related or instance-specific error occurred while establishing a connection to SQL Server.

    The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is

    configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance

    Specified)

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply