You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Create a Snowflake DB connection that uses OAuth
157
+
158
+
The information in this section describe how to create a Snowflake DB connection that uses OAuth to authenticate.
159
+
160
+
> [!IMPORTANT]
161
+
> Before following the steps in this section, you must first [Configure Azure to issue OAuth tokens on behalf of the client](https://community.snowflake.com/s/article/Create-External-OAuth-Token-Using-Azure-AD-For-The-OAuth-Client-Itself). This configuration creates a service principal, which is required for the OAuth connection. You need the following information to create the connection:
162
+
>
163
+
> - Client ID: The ID of the service principal
164
+
> - Client Secret: The secret of the service principal
165
+
> - Tenant ID: The ID of the Microsoft Entra ID tenant
166
+
167
+
168
+
# [Azure CLI](#tab/cli)
169
+
170
+
This YAML file creates a Snowflake DB connection that uses OAuth. Be sure to update the appropriate values:
171
+
172
+
```yaml
173
+
# my_snowflakedb_connection.yaml
174
+
name: snowflake_service_principal_connection
175
+
type: snowflake
176
+
# Add the Snowflake account, database, warehouse name, and role name here. If no role name is provided, it will default to PUBLIC.
client_id: <client-id> # The service principal's client id
181
+
client_secret: <client-secret> # The service principal's client secret
182
+
tenant_id: <tenant-id> # The Microsoft Entra ID tenant id
183
+
```
184
+
185
+
Create the Azure Machine Learning connection in the CLI:
186
+
187
+
```azurecli
188
+
az ml connection create --file my_snowflakedb_connection.yaml
189
+
```
190
+
191
+
You can also override the information in the YAML file at the command line:
192
+
193
+
```azurecli
194
+
az ml connection create --file my_snowflakedb_connection.yaml --set credentials.client_id="my-client-id" credentials.client_secret="my-client-secret" credentials.tenant_id="my-tenant-id"
195
+
```
196
+
197
+
# [Python SDK](#tab/python)
198
+
199
+
With the Python SDK, you can create a connection by loading the connection information stored in the YAML file. You can optionally override the values:
200
+
201
+
```python
202
+
from azure.ai.ml import MLClient, load_workspace_connection
0 commit comments