Skip to content

Commit afcd2b7

Browse files
Merge pull request #33860 from dlevy-msft-sql/patch-1
Update sqlcmd-authentication.md
2 parents 10659b7 + 98ef372 commit afcd2b7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/tools/sqlcmd/sqlcmd-authentication.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Authenticating with Microsoft Entra ID in the new standalone sqlcmd
44
author: dlevy-msft
55
ms.author: dlevy
66
ms.reviewer: randolphwest
7-
ms.date: 12/13/2023
7+
ms.date: 04/18/2025
88
ms.service: sql
99
ms.subservice: tools-other
1010
ms.topic: how-to
@@ -68,18 +68,22 @@ Use this method when running **sqlcmd** (Go) on an Azure VM that has either a sy
6868
This example shows how to connect using a Service Assigned Managed Identity (SAMI):
6969

7070
```console
71-
-S testsrv.database.windows.net -d Target_DB_or_DW --authentication-method ActiveDirectoryManagedIdentity
71+
sqlcmd -S testsrv.database.windows.net -d Target_DB_or_DW --authentication-method ActiveDirectoryManagedIdentity
7272
```
7373

7474
This example shows how to connect with a User Assigned Managed Identity (UAMI) by adding the Client Id of the user assigned managed identity:
7575

7676
```console
77-
-S testsrv.database.windows.net -d Target_DB_or_DW --authentication-method ActiveDirectoryManagedIdentity -U <user-assigned-managed-identity-client-id>
77+
sqlcmd -S testsrv.database.windows.net -d Target_DB_or_DW --authentication-method ActiveDirectoryManagedIdentity -U <user-assigned-managed-identity-client-id>
7878
```
7979

8080
#### ActiveDirectoryServicePrincipal
8181

82-
This method authenticates the provided user name as a service principal ID and the password as the client secret for the service principal. Provide a user name in the form `<service principal id>@<tenant id>`. Set `SQLCMDPASSWORD` variable to the client secret. If using a certificate instead of a client secret, set `AZURE_CLIENT_CERTIFICATE_PATH` environment variable to the path of the certificate file.
82+
This method authenticates the provided user name as a service principal ID and the password as the client secret for the service principal. Provide a user name in the form `<application (client) ID>`. Set `SQLCMDPASSWORD` variable to the client secret. If using a certificate instead of a client secret, set `AZURE_CLIENT_CERTIFICATE_PATH` environment variable to the path of the certificate file.
83+
84+
```console
85+
sqlcmd -S testsrv.database.windows.net -d Target_DB_or_DW --authentication-method ActiveDirectoryServicePrincipal -U <Application (client) ID> -P <client secret>
86+
```
8387

8488
### Environment variables for Microsoft Entra authentication
8589

0 commit comments

Comments
 (0)