SSDT Changing Scoped Credentials for different environments

220 views Asked by At

I am looking to use continuous integration to deploy my SSDT project to a UAT and production environments and use external tables which point to azure data lake. The following statements need to be changed depending on the environment:-

CREATE DATABASE SCOPED CREDENTIAL [ScopeCredential]
    WITH IDENTITY = N'KeyDetails'    , 
        Secret = 'secretsuff';

CREATE EXTERNAL DATA SOURCE [DS1]
    WITH (
    TYPE = BLOB_STORAGE,
    LOCATION = N'https://BlobDataDev.blob.core.windows.net/dir/MyProject/',
    CREDENTIAL = [AzureStorageCredential]
    );

I understand command variables cant be used in this context. What is the best way to ensure these change automatically between environments and work best with the CI/CD release deployment of the DACPAC.

This needs to be changed prior to the object creates as the create statements will hang if the credentials are wrong.

Thanks

1

There are 1 answers

0
Paul On

The solution I came up with was to exclude these items from the deployment, using params on the sqlpackage.exe command line. Of course these need to be created initially.

As these items remain constant this method seems to work reasonably well.