Skip to content

Commit 5ed2f4b

Browse files
committed
Merge branch 'master' of https://github.com/dbt-msft/dbt-sqlserver into one-point-oh
2 parents 5aad05d + 3bd8655 commit 5ed2f4b

File tree

9 files changed

+208
-63
lines changed

9 files changed

+208
-63
lines changed

.circleci/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,27 @@ jobs:
109109
command: |
110110
cd test/integration
111111
dbt compile --target azuresql_azcli
112+
- run:
113+
name: cnxn -- Azure SQL - AZ CLI auto
114+
command: |
115+
cd test/integration
116+
dbt compile --target azuresql_azauto
117+
- run:
118+
name: az logout
119+
command: az logout
120+
- run:
121+
name: cnxn -- Azure SQL - AZ SP auto
122+
command: |
123+
export AZURE_CLIENT_ID="$DBT_AZURE_SP_NAME"
124+
export AZURE_CLIENT_SECRET="$DBT_AZURE_SP_SECRET"
125+
export AZURE_TENANT_ID="$DBT_AZURE_TENANT"
126+
cd test/integration
127+
dbt compile --target azuresql_azauto
128+
- run:
129+
name: cnxn -- Azure SQL - AZ SP env
130+
command: |
131+
cd test/integration
132+
dbt compile --target azuresql_azenv
112133
113134
workflows:
114135
main:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
#### Under the Hood
1010

1111
- re-organize macros to match new structure [#184](https://github.com/dbt-msft/dbt-sqlserver/pull/184)
12+
### v0.21.1
13+
14+
#### features
15+
16+
- Added support for more authentication methods: automatic, environment variables, managed identity. All of them are documented in the readme. [#178](https://github.com/dbt-msft/dbt-sqlserver/pull/178) contributed by [@sdebruyn](https://github.com/sdebruyn)
17+
18+
#### fixes
19+
20+
- fix for [#186](https://github.com/dbt-msft/dbt-sqlserver/issues/186) and [#177](https://github.com/dbt-msft/dbt-sqlserver/issues/177) where new columns weren't being added when snapshotting or incrementing [#188](https://github.com/dbt-msft/dbt-sqlserver/pull/188)
21+
1222
### v0.21.0
1323

1424
Please see [dbt-core v0.21.0 release notes](https://github.com/dbt-labs/dbt-core/releases/tag/v0.21.0) for upstream changes

README.md

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,35 @@ trusted_connection: True
5959
```
6060
### Azure SQL-specific auth
6161
The following [`pyodbc`-supported ActiveDirectory methods](https://docs.microsoft.com/en-us/sql/connect/odbc/using-azure-active-directory?view=sql-server-ver15#new-andor-modified-dsn-and-connection-string-keywords) are available to authenticate to Azure SQL:
62+
- Auto
6263
- Azure CLI
64+
- Environment-based authentication
6365
- ActiveDirectory Password
6466
- ActiveDirectory Interactive
6567
- ActiveDirectory Integrated
6668
- Service Principal (a.k.a. AAD Application)
67-
- ~~ActiveDirectory MSI~~ (not implemented)
69+
- Managed Identity
6870
69-
However, the Azure CLI is the ideal way to authenticate instead of using the built-in ODBC ActiveDirectory methods, for reasons detailed below.
71+
Usually the automatic option is the easiest one to use since it will work with any configuration already present in your environment, as explained below.
72+
73+
#### Auto
74+
75+
This will try to authenticate by using the following methods one by one until it finds a valid way to authenticate:
76+
77+
1. Read credentials from environment variables (see environment-based authentication below)
78+
2. Use the managed identity of the system (see MSI below)
79+
3. VS Code: use the account used to log in to the VS Code Azure extension if installed
80+
4. Use the logged account in the Azure CLI if installed (see below)
81+
5. Azure PowerShell: use the account used with `Connect-AzAccount` in the Azure PowerShell module if installed
82+
83+
To use automatic authentication, set `authentication` in `profiles.yml` to `Auto`:
84+
85+
```yaml
86+
authentication: Auto
87+
```
88+
89+
This is the recommended way for authenticating to databases on Azure because it avoids storing credentials in your
90+
profile and can resort to different authentication mechanisms depending on the system you're running dbt on.
7091

7192
#### Azure CLI
7293
Use the authentication of the Azure command line interface (CLI). First, [install the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), then, log in:
@@ -77,47 +98,72 @@ az login
7798

7899
Then, set `authentication` in `profiles.yml` to `CLI`:
79100

80-
```
101+
```yaml
81102
authentication: CLI
82103
```
83104
84-
This is also the preferred route for using a service principal:
105+
#### Environment-based authentication
106+
You can let dbt dynamically use credentials from your environment variables by configuring
107+
your profile with environment-based authentication:
85108
86-
```
87-
az login --service-principal --username $CLIENTID --password $SECRET --tenant $TENANTID
109+
```yaml
110+
authenticaton: environment
88111
```
89112
90-
This avoids storing a secret as plain text in `profiles.yml`.
113+
You can configure the following environment variables:
91114
92-
Source: https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli#sign-in-using-a-service-principal
115+
**Service principal authentication**:
116+
* AZURE_CLIENT_ID
117+
* AZURE_TENANT_ID
118+
* AZURE_CLIENT_SECRET or AZURE_CLIENT_CERTIFICATE_PATH
119+
120+
**User authenticaton**:
121+
* AZURE_USERNAME
122+
* AZURE_PASSWORD
123+
* AZURE_CLIENT_ID
93124
94125
#### ActiveDirectory Password
95126
Definitely not ideal, but available
96-
```
127+
128+
```yaml
97129
authentication: ActiveDirectoryPassword
98130
99131
password: i<3opensource?
100132
```
133+
101134
#### ActiveDirectory Interactive (*Windows only*)
102-
brings up the Azure AD prompt so you can MFA if need be. The downside to this approach is that you must log in each time you run a dbt command!
103-
```
135+
Brings up the Azure AD prompt so you can MFA if need be. The downside to this approach is that you must log in each time you run a dbt command!
136+
137+
```yaml
104138
authentication: ActiveDirectoryInteractive
105139
106140
```
141+
107142
#### ActiveDirectory Integrated (*Windows only*)
108-
uses your machine's credentials (might be disabled by your AAD admins), also requires that you have Active Directory Federation Services (ADFS) installed and running, which is only the case if you have an on-prem Active Directory linked to your Azure AD...
109-
```
143+
Uses your machine's credentials (might be disabled by your AAD admins), also requires that you have Active Directory Federation Services (ADFS) installed and running, which is only the case if you have an on-prem Active Directory linked to your Azure AD...
144+
145+
```yaml
110146
authentication: ActiveDirectoryIntegrated
111147
```
148+
112149
##### Service Principal
113-
`client_*` and `app_*` can be used interchangeably. Again, it is not recommended to store a service principal secret in plain text in your `dbt_profile.yml`. The CLI auth method is preferred.
114-
```
150+
`client_*` and `app_*` can be used interchangeably. Again, it is not recommended to store a service principal secret in plain text in your `dbt_profile.yml`. The auto, environment or CLI auth methods are preferred over this one.
151+
152+
```yaml
115153
authentication: ServicePrincipal
116154
tenant_id: tenatid
117155
client_id: clientid
118156
client_secret: clientsecret
119157
```
120158

159+
#### Managed Identity
160+
161+
If the system you're running dbt on has a [managed identity](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview),
162+
then you can configure the authentication like so:
163+
164+
```yaml
165+
authentication: MSI
166+
```
121167

122168
## Supported features
123169

dbt/adapters/sqlserver/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '1.0.0rc1'
1+
version = '1.0.0rc2'

0 commit comments

Comments
 (0)