What are the challenges you face when working across database platforms? Take the survey
Options

New-DatabaseConnection Login Error when just using connection string

I am trying to convert an existing script to be a PowerShell workflow so that I can run deployments in parallel (use case is multiple instances of the same database).

When using New-DatabaseConnection, the object returned doesn't work when running -parallel (for whatever reason) when passing to New-DatabaseReleaseArtifact.  But, passing the connection string doesn't throw the error I was seeing so my thought was that will work.

But, I'm getting an failed login when using the $dbConn.ConnectionString ($dbConn being the object returned above).  It looks fine (can see the username, so it's not like it's empty).  Removing Workflow and a parallel all together, I have the same problem, so it has nothing to do with that.

If I switch it back to $dbConn when not in workflow/parallel it works fine, so the credentials are correct (and also verified by logging into SSMS with it).

This is connecting to Azure SQL.

Any idea why the connection string doesn't work but the connection object does in New-DatabaseReleaseArtifact?  Documentation says the connection string is supported. 

-Target <System.Object>

A database schema you want to update from. This can be:

- a Database Connection object created by the New-DatabaseConnection cmdlet

- a database connection string

- a path for a NuGet package or .zip file. This must contain a scripts folder located at db\state

- a Database Build Artifact object produced by the New-DatabaseBuildArtifact cmdlet

- a path for a scripts folder, created by SQL Compare or from your SQL Source Control database repository

- a list containing one or more of the above

Tagged:

Answers

  • Options
    davehahndavehahn Posts: 4 New member
    I figured it out.....$dbConn.ConnectionString.UnmaskedValue needs to be referenced, without the additional property, it defaults to the masked value (I wrote out the password and noticed it was *******)

  • Options
    David_DDavid_D Posts: 26 Bronze 2
    Hi @davehahn,

    Database strings are supported.

    I'm glad you figured it out. Please don't hesitate to reach out if you have any other questions.

    Kind regards,
    David Dang | Product Support Engineer
  • Options
    davehahndavehahn Posts: 4 New member
    @David_D thanks.  I was able to get this working.   It appears AZDO caps -parallel on foreach to 5 (but I don't see that locally), regardless was able to cut deployment time down by 75% for multi-tenant databases.
Sign In or Register to comment.