Skip to content

Commit b338e56

Browse files
alpetrichcourdent
andauthored
aad support for ms sql server (windmill-labs#874)
Co-authored-by: Henri Courdent <[email protected]>
1 parent a43e6f0 commit b338e56

12 files changed

+42
-7
lines changed
Loading
Binary file not shown.

docs/getting_started/0_scripts_quickstart/5_sql_quickstart/index.mdx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,21 @@ Fill out the form with the information of your MS SQL instance and "Test connect
147147

148148
![Paste in Resource Values](./fill_mssql.png.webp)
149149

150-
| Property | Type | Description | Default | Required | Where to Find |
151-
| -------- | ------ | --------------- | ------- | -------- | ------------------------------------------------------------------------------------- |
152-
| host | string | Instance host | | true | Your hosting provider's control panel or in your server's MS SQL configuration file |
153-
| port | number | Instance port | | false | Your hosting provider's control panel or in your server's MS SQL configuration file |
154-
| user | string | Username | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
155-
| dbname | string | Database name | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
156-
| password | string | User's password | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
150+
| Property | Type | Description | Default | Required | Where to Find |
151+
| -------- | ------ | --------------- | ------- | -------- | ------------------------------------------------------------------------------------- |
152+
| host | string | Instance host | | true | Your hosting provider's control panel or in your server's MS SQL configuration file |
153+
| port | number | Instance port | | false | Your hosting provider's control panel or in your server's MS SQL configuration file |
154+
| user | string | Username | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
155+
| dbname | string | Database name | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
156+
| password | string | User's password | | true | Created in MS SQL (e.g., via SQL Server Management Studio) or provided by your hosting |
157+
| aad_token| object | OAuth token AD | | true | Either username/password or aad_token should be provided. Requires OAuth setup in Windmill |
157158

158159
To specify the application intent for read-only requests, add `-- ApplicationIntent=ReadOnly` to the script.
159160

161+
:::info
162+
When using domain credentials via Entra (Azure Active Directory) you need to add the scope `https://database.windows.net//.default` to the [Windmill OAuth instance setting](../../misc/setup_oauth#azure).
163+
:::
164+
160165
### BigQuery
161166

162167
To be able to connect to a [BigQuery](https://cloud.google.com/bigquery) instance, we'll need to define a Resource with the `BigQuery` Resource Type first.
78.7 KB
Loading
29.7 KB
Binary file not shown.
Loading
Binary file not shown.
60.6 KB
Loading
19.7 KB
Binary file not shown.
69.7 KB
Loading
Binary file not shown.

docs/misc/2_setup_oauth/index.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,36 @@ SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME() AS org_accou
494494

495495
Take a look at [this guide](../../misc/9_guides/snowflake_app_with_user_roles/index.mdx#sample-app-setup) to learn more about how to build an App with the Snowflake OAuth integration.
496496

497+
### Azure OAuth
498+
499+
Go to your [Azure AAD App registrations](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps) and create a new registration.
500+
501+
Select a name set the rediredct url to: `https://<YOUR WINDMILL BASE URL>/oauth/callback/azure_oauth` and application type to "Web".
502+
503+
![Azure OAuth Setup](./azure_oauth.png.webp)
504+
505+
Next in "Certificates and secrets" create a new client secret and copy the **Secret Value** as this is the client secret you'll set later in the Windmill OAuth settings (the Secret ID is not required).
506+
507+
Then under "API permissions" you have to select the appropriate permissions that the OAuth application shall be able to access:
508+
509+
**Example MSSQL**:
510+
- select "Add a permission"
511+
- Type "Delegated"
512+
- select "Azure SQL Database" -> "user_impersonation"
513+
514+
![Azure Oauth API permissions](./azure_oauth_api_permissions.png.webp)
515+
516+
Next create a new OAuth client in the [Windmill instance settings](../advanced/instance_settings#authoauth) and fill in
517+
- the "Client ID" corresponding to the "Application (client) ID" in Azure "Overview" menu item
518+
- the "Client Secret" corresponding to the Secret Value from client secret you created earlier
519+
- the "Tenant ID" from the "Overview" menu item
520+
521+
![Azure IDs](./azure_oauth_ids.png.webp)
522+
523+
Now depending on which application you're trying to use you, you will need to as extra "scopes" such as `https://database.windows.net//.default` for [MS SQL Server](../getting_started/scripts_quickstart/sql#ms-sql).
524+
525+
![Azure Windmill](./azure_oauth_windmill.png.webp)
526+
497527
### Custom OAuth
498528

499529
Under [Enterprise Edition](/pricing), you can add a completely custom OAuth without requiring a dev setup. The item accepts an extra optional field: `connect_config` or `login_config` of type OAuthConfig:

0 commit comments

Comments
 (0)