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
Copy file name to clipboardExpand all lines: articles/cosmos-db/table/how-to-dotnet-get-started.md
+2-59Lines changed: 2 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,10 +50,9 @@ dotnet build
50
50
51
51
## Connect to Azure Cosmos DB for Table
52
52
53
-
To connect to the API for Table of Azure Cosmos DB, create an instance of the [``TableServiceClient``](/dotnet/api/azure.data.tables.tableserviceclient) class. This class is the starting point to perform all operations against tables. There are two primary ways to connect to a API for Table account using the **TableServiceClient** class:
53
+
To connect to the API for Table of Azure Cosmos DB, create an instance of the [``TableServiceClient``](/dotnet/api/azure.data.tables.tableserviceclient) class. This class is the starting point to perform all operations against tables. There are two primary ways to connect to an API for Table account using the **TableServiceClient** class:
54
54
55
55
*[Connect with a API for Table connection string](#connect-with-a-connection-string)
56
-
*[Connect with Azure Active Directory](#connect-using-the-microsoft-identity-platform)
57
56
58
57
### Connect with a connection string
59
58
@@ -140,62 +139,6 @@ Create a new instance of the **TableServiceClient** class with the ``COSMOS_CONN
To connect to your API for Table account using the Microsoft Identity Platform and Azure AD, use a security principal. The exact type of principal will depend on where you host your application code. The table below serves as a quick reference guide.
146
-
147
-
| Where the application runs | Security principal
148
-
|--|--|---|
149
-
| Local machine (developing and testing) | User identity or service principal |
150
-
| Azure | Managed identity |
151
-
| Servers or clients outside of Azure | Service principal |
152
-
153
-
#### Import Azure.Identity
154
-
155
-
The **Azure.Identity** NuGet package contains core authentication functionality that is shared among all Azure SDK libraries.
156
-
157
-
Import the [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) NuGet package using the ``dotnet add package`` command.
158
-
159
-
```dotnetcli
160
-
dotnet add package Azure.Identity
161
-
```
162
-
163
-
Rebuild the project with the ``dotnet build`` command.
164
-
165
-
```dotnetcli
166
-
dotnet build
167
-
```
168
-
169
-
In your code editor, add using directives for ``Azure.Core`` and ``Azure.Identity`` namespaces.
#### Create TableServiceClient with default credential implementation
174
-
175
-
If you're testing on a local machine, or your application will run on Azure services with direct support for managed identities, obtain an OAuth token by creating a [``DefaultAzureCredential``](/dotnet/api/azure.identity.defaultazurecredential) instance.
176
-
177
-
For this example, we saved the instance in a variable of type [``TokenCredential``](/dotnet/api/azure.core.tokencredential) as that's a more generic type that's reusable across SDKs.
Create a new instance of the **TableServiceClient** class with the ``COSMOS_ENDPOINT`` environment variable and the **TokenCredential** object as parameters.
#### Create TableServiceClient with a custom credential implementation
186
-
187
-
If you plan to deploy the application out of Azure, you can obtain an OAuth token by using other classes in the [Azure.Identity client library for .NET](/dotnet/api/overview/azure/identity-readme). These other classes also derive from the ``TokenCredential`` class.
188
-
189
-
For this example, we create a [``ClientSecretCredential``](/dotnet/api/azure.identity.clientsecretcredential) instance by using client and tenant identifiers, along with a client secret.
You can obtain the client ID, tenant ID, and client secret when you register an application in Azure Active Directory (AD). For more information about registering Azure AD applications, see [Register an application with the Microsoft identity platform](../../active-directory/develop/quickstart-register-app.md).
194
-
195
-
Create a new instance of the **TableServiceClient** class with the ``COSMOS_ENDPOINT`` environment variable and the **TokenCredential** object as parameters.
0 commit comments