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 `
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