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.