diff --git a/scripts/templates/kubernetes/create_aks_settingsfile_fromprefix.ps1 b/scripts/templates/kubernetes/create_aks_settingsfile_fromprefix.ps1 index ea1af7ec..522ef0d6 100644 --- a/scripts/templates/kubernetes/create_aks_settingsfile_fromprefix.ps1 +++ b/scripts/templates/kubernetes/create_aks_settingsfile_fromprefix.ps1 @@ -50,3 +50,8 @@ Write-Host "Using keyvault name: '$keyVaultName'" -ForegroundColor DarkGreen $scriptDir = Split-Path $script:MyInvocation.MyCommand.Path .$scriptDir/create_aks_settingsfile.ps1 -sbmExe $sbmExe -path $path -resourceGroupName $resourceGroupName -storageAccountName $storageAccountName -eventHubNamespaceName $eventHubNamespaceName -serviceBusNamespaceName $serviceBusNamespaceName -sqlUserName $sqlUserName -sqlPassword $sqlPassword -acrName $containerRegistryName -keyVaultName $keyVaultName -serviceAccount $serviceAccountName -podCount $podCount +$yaml = Join-Path -Path $scriptDir -ChildPath "runnerpod.yaml" +$destYaml = Join-Path -Path $path -ChildPath "runnerpod.yaml" +(Get-Content $yaml) | foreach-object { $_ -replace "<>", $prefix } | Set-Content $destYaml + + diff --git a/scripts/templates/kubernetes/runnerpod.yaml b/scripts/templates/kubernetes/runnerpod.yaml new file mode 100644 index 00000000..e9c93294 --- /dev/null +++ b/scripts/templates/kubernetes/runnerpod.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Pod +metadata: + name: sbm-runner + namespace: sqlbuildmanager + labels: + azure.workload.identity/use: 'true' +spec: + nodeSelector: + kubernetes.io/os: linux + serviceAccountName: <>serviceaccount + containers: + - name: sbm-runner + image: <>containerregistry.azurecr.io/sqlbuildmanager:latest-vNext + imagePullPolicy: Always + resources: + limits: + memory: 512M + cpu: 500m + command: + - sh + - -c + - tail -f /dev/null + restartPolicy: Always + + +#kubectl get pods -n sqlbuildmanager +#kubectl exec --stdin --tty sbm-runner -n sqlbuildmanager -- /bin/bash diff --git a/src/SqlSync.Connection/ConnectionHelper.cs b/src/SqlSync.Connection/ConnectionHelper.cs index 8129cd76..c1a044a4 100644 --- a/src/SqlSync.Connection/ConnectionHelper.cs +++ b/src/SqlSync.Connection/ConnectionHelper.cs @@ -106,6 +106,7 @@ public static string GetConnectionString(string dbName, string serverName, strin builder.Password = pw; break; } + log.LogDebug($"Database Connection string: {builder.ConnectionString}"); return builder.ConnectionString; } diff --git a/src/SqlSync.SqlBuild/DacPacHelper.cs b/src/SqlSync.SqlBuild/DacPacHelper.cs index c304f9a8..3e0518dc 100644 --- a/src/SqlSync.SqlBuild/DacPacHelper.cs +++ b/src/SqlSync.SqlBuild/DacPacHelper.cs @@ -33,18 +33,24 @@ public static bool ExtractDacPac(string sourceDatabase, string sourceServer, Aut connData.AuthenticationType = authType; if (!string.IsNullOrWhiteSpace(userName)) connData.UserId = userName; if (!string.IsNullOrWhiteSpace(password)) connData.Password = password; + if (!string.IsNullOrWhiteSpace(managedIdentityClientId)) connData.ManagedIdentityClientId = managedIdentityClientId; //Pre-test the connection. the DacServices can hang for a long time if the connection is bad + log.LogInformation($"Testing connection to {sourceServer}/{sourceDatabase} using authentication type {authType}"); if (!ConnectionHelper.TestDatabaseConnection(sourceDatabase, sourceServer, userName, password,authType, timeouts, managedIdentityClientId)) { - log.LogError($"Unable to create Dacpac for {sourceServer}.{sourceDatabase}. Database connection test failed."); + log.LogError($"Unable to create Dacpac for {sourceServer}/{sourceDatabase}. Database connection test failed."); return false; } + else + { + log.LogInformation($"Connection to {sourceServer}/{sourceDatabase} with authentication type {authType} was successful"); + } var connString = ConnectionHelper.GetConnectionString(connData); Version ver = Assembly.GetExecutingAssembly().GetName().Version; DacServices service = new DacServices(connString); service.Extract(dacPacFileName, sourceDatabase, "Sql Build Manager", ver, "Sql Build Manager",null, opts); - log.LogInformation($"dacpac from {sourceServer}.{sourceDatabase} saved to {dacPacFileName}"); + log.LogInformation($"DACPAC from {sourceServer}.{sourceDatabase} saved to {dacPacFileName}"); return true; } catch (Exception exe)