question

TimJaszdziewski-8791 avatar image
0 Votes"
TimJaszdziewski-8791 asked krish-gh edited

I get "error: 40 - Could not open a connection to SQL Server" when trying to create a new database on my azure sql server via the devops pipeline

As stated in the title, I get the error: 40 when I run my devops pipeline that is supposed to create a new sql database on my azure sql server. The deploy part of my pipeline yaml file looks like this:

 - stage: Deploy
   displayName: 'Deploy Web App'
   dependsOn: Build
   condition: succeeded()
   jobs:
   - deployment: DeploymentJob
     pool:
       vmImage: $(vmImageName)
     environment: $(environmentName)
     strategy:
       runOnce:
         deploy:
           steps:
           - task: AzureWebApp@1
             displayName: 'Deploy Azure Web App : webapp'
             inputs:
               azureSubscription: $(azureSubscription)
               appName: $(webAppName)
               package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
           - task: SqlAzureDacpacDeployment@1
             inputs:
               azureSubscription: 'Azure-Abonnement 1 (xxxx)'
               AuthenticationType: 'server'
               ServerName: 'server.mysql.database.azure.com'
               DatabaseName: 'db'
               SqlUsername: 'user'
               SqlPassword: 'pw'
               deployType: 'SqlTask'
               SqlFile: '$(Pipeline.Workspace)/**/db.sql'
               IpDetectionMethod: 'AutoDetect'

I don't know if that is important but the content of my SQL file looks like this: "CREATE DATABASE IF NOT EXISTS db", "CREATE TABLE TBL()" and so on.
I already checked for errors in the credentials.
I allowed every Ip adress in the firewall configuration of my Azure SQL Server and also allowed full access of Azure services.
I know there are a lot of questions regarding this error but I'm really new to Azure and every solution I found so far didn't work for me.

azure-sql-databaseazure-webapps
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is this Azure SQL Server or an Azure MySQL deployment? Are you mixing the two? Your server name indicates that it is a MySQL instance - but is your task specific to a SQL Server instance?

0 Votes 0 ·

@TimJaszdziewski-8791 Please post more details for us to troubleshoot further.

0 Votes 0 ·

0 Answers