This page shows supported authentication methods and clients, and shows sample code you can use to connect Azure Table Storage to other cloud services using Service Connector. You might still be able to connect to Azure Table Storage in other programming languages without using Service Connector. This page also shows default environment variable names and values you get when you create the service connection.
Supported compute services
Service Connector can be used to connect the following compute services to Azure Table Storage:
- Azure App Service
- Azure Container Apps
- Azure Functions
- Azure Kubernetes Service (AKS)
- Azure Spring Apps
The table below shows which combinations of authentication methods and clients are supported for connecting your compute service to Azure Table Storage using Service Connector. A “Yes” indicates that the combination is supported, while a “No” indicates that it is not supported.
Client type |
System-assigned managed identity |
User-assigned managed identity |
Secret / connection string |
Service principal |
.NET |
Yes |
Yes |
Yes |
Yes |
Java |
Yes |
Yes |
Yes |
Yes |
Node.js |
Yes |
Yes |
Yes |
Yes |
Python |
Yes |
Yes |
Yes |
Yes |
This table indicates that all combinations of client types and authentication methods in the table are supported. All client types can use any of the authentication methods to connect to Azure Table Storage using Service Connector.
Default environment variable names or application properties and sample code
Use the connection details below to connect compute services to Azure Table Storage. For more information about naming conventions, check the Service Connector internals article.
System-assigned managed identity
Default environment variable name |
Description |
Example value |
AZURE_STORAGETABLE_RESOURCEENDPOINT |
Table Storage endpoint |
https://<storage-account-name>.table.core.windows.net/ |
Sample code
Refer to the steps and code below to connect to Azure Table Storage using a system-assigned managed identity.
Install dependencies.
dotnet add package Azure.Identity
dotnet add package Azure.Data.Tables
You can use azure-identity
to authenticate using a managed identity or a service principal. Get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
using Azure.Identity;
using Azure.Data.Tables;
// get Table endpoint
var tableEndpoint = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// system-assigned managed identity
// var credential = new DefaultAzureCredential();
// user-assigned managed identity
// var credential = new DefaultAzureCredential(
// new DefaultAzureCredentialOptions
// {
// ManagedIdentityClientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// });
// service principal
// var tenantId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_TENANTID");
// var clientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// var clientSecret = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTSECRET");
// var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var tableServiceClient = new TableServiceClient(
new Uri(tableEndpoint),
credential);
Add the following dependencies in your pom.xml file:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-tables</artifactId>
<version>12.3.15</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.5</version>
</dependency>
Authenticate using azure-identity
and get the endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
String url = System.getenv("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
// for user-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder()
// .managedIdentityClientId(System.getenv("AZURE_STORAGETABLE_CLIENTID"))
// .build();
// for service principal
// ClientSecretCredential defaultCredential = new ClientSecretCredentialBuilder()
// .clientId(System.getenv("<AZURE_STORAGETABLE_CLIENTID>"))
// .clientSecret(System.getenv("<AZURE_STORAGETABLE_CLIENTSECRET>"))
// .tenantId(System.getenv("<AZURE_STORAGETABLE_TENANTID>"))
// .build();
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
.endpoint(url)
.credential(defaultCredential)
.buildClient();
Install dependencies.
pip install azure-identity
pip install azure-data-tables
Authenticate using the azure-identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
from azure.identity import ManagedIdentityCredential, ClientSecretCredential
from azure.data.tables import TableServiceClient
import os
account_url = os.getenv('AZURE_STORAGETABLE_RESOURCEENDPOINT')
# Uncomment the following lines corresponding to the authentication type you want to use.
# system assigned managed identity
# cred = ManagedIdentityCredential()
# user assigned managed identity
# managed_identity_client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# cred = ManagedIdentityCredential(client_id=managed_identity_client_id)
# service principal
# tenant_id = os.getenv('AZURE_STORAGETABLE_TENANTID')
# client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# client_secret = os.getenv('AZURE_STORAGETABLE_CLIENTSECRET')
# cred = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=client_secret)
table_service_client = TableServiceClient(account_url, credential=cred)
Install dependencies.
npm install --save @azure/identity
npm install @azure/data-tables
Authenticate using the @azure/identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
import { DefaultAzureCredential,ClientSecretCredential } from "@azure/identity";
const { TableClient } = require("@azure/data-tables");
const account_url = process.env.AZURE_STORAGETABLE_RESOURCEENDPOINT;
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system assigned managed identity
// const credential = new DefaultAzureCredential();
// for user assigned managed identity
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const credential = new DefaultAzureCredential({
// managedIdentityClientId: clientId
// });
// for service principal
// const tenantId = process.env.AZURE_STORAGETABLE_TENANTID;
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const clientSecret = process.env.AZURE_STORAGETABLE_CLIENTSECRET;
// const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
const tableServiceClient = new TableServiceClient(account_url, credential);
For other languages, you can use the Azure Table Storage account URL and other properties that Service Connector sets to the environment variables to connect to Azure Table Storage. For environment variable details, see Integrate Azure Table Storage with Service Connector.
User-assigned managed identity
Default environment variable name |
Description |
Example value |
AZURE_STORAGETABLE_RESOURCEENDPOINT |
Table Storage endpoint |
https://<storage-account-name>.table.core.windows.net/ |
AZURE_STORAGETABLE_CLIENTID |
Your client ID |
<client-ID> |
Sample code
Refer to the steps and code below to connect to Azure Table Storage using a user-assigned managed identity.
Install dependencies.
dotnet add package Azure.Identity
dotnet add package Azure.Data.Tables
You can use azure-identity
to authenticate using a managed identity or a service principal. Get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
using Azure.Identity;
using Azure.Data.Tables;
// get Table endpoint
var tableEndpoint = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// system-assigned managed identity
// var credential = new DefaultAzureCredential();
// user-assigned managed identity
// var credential = new DefaultAzureCredential(
// new DefaultAzureCredentialOptions
// {
// ManagedIdentityClientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// });
// service principal
// var tenantId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_TENANTID");
// var clientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// var clientSecret = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTSECRET");
// var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var tableServiceClient = new TableServiceClient(
new Uri(tableEndpoint),
credential);
Add the following dependencies in your pom.xml file:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-tables</artifactId>
<version>12.3.15</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.5</version>
</dependency>
Authenticate using azure-identity
and get the endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
String url = System.getenv("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
// for user-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder()
// .managedIdentityClientId(System.getenv("AZURE_STORAGETABLE_CLIENTID"))
// .build();
// for service principal
// ClientSecretCredential defaultCredential = new ClientSecretCredentialBuilder()
// .clientId(System.getenv("<AZURE_STORAGETABLE_CLIENTID>"))
// .clientSecret(System.getenv("<AZURE_STORAGETABLE_CLIENTSECRET>"))
// .tenantId(System.getenv("<AZURE_STORAGETABLE_TENANTID>"))
// .build();
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
.endpoint(url)
.credential(defaultCredential)
.buildClient();
Install dependencies.
pip install azure-identity
pip install azure-data-tables
Authenticate using the azure-identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
from azure.identity import ManagedIdentityCredential, ClientSecretCredential
from azure.data.tables import TableServiceClient
import os
account_url = os.getenv('AZURE_STORAGETABLE_RESOURCEENDPOINT')
# Uncomment the following lines corresponding to the authentication type you want to use.
# system assigned managed identity
# cred = ManagedIdentityCredential()
# user assigned managed identity
# managed_identity_client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# cred = ManagedIdentityCredential(client_id=managed_identity_client_id)
# service principal
# tenant_id = os.getenv('AZURE_STORAGETABLE_TENANTID')
# client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# client_secret = os.getenv('AZURE_STORAGETABLE_CLIENTSECRET')
# cred = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=client_secret)
table_service_client = TableServiceClient(account_url, credential=cred)
Install dependencies.
npm install --save @azure/identity
npm install @azure/data-tables
Authenticate using the @azure/identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
import { DefaultAzureCredential,ClientSecretCredential } from "@azure/identity";
const { TableClient } = require("@azure/data-tables");
const account_url = process.env.AZURE_STORAGETABLE_RESOURCEENDPOINT;
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system assigned managed identity
// const credential = new DefaultAzureCredential();
// for user assigned managed identity
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const credential = new DefaultAzureCredential({
// managedIdentityClientId: clientId
// });
// for service principal
// const tenantId = process.env.AZURE_STORAGETABLE_TENANTID;
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const clientSecret = process.env.AZURE_STORAGETABLE_CLIENTSECRET;
// const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
const tableServiceClient = new TableServiceClient(account_url, credential);
For other languages, you can use the Azure Table Storage account URL and other properties that Service Connector sets to the environment variables to connect to Azure Table Storage. For environment variable details, see Integrate Azure Table Storage with Service Connector.
Connection string
Warning
Microsoft recommends that you use the most secure authentication flow available. The authentication flow described in this procedure requires a very high degree of trust in the application, and carries risks that are not present in other flows. You should only use this flow when other more secure flows, such as managed identities, aren't viable.
Default environment variable name |
Description |
Example value |
AZURE_STORAGETABLE_CONNECTIONSTRING |
Table Storage connection string |
DefaultEndpointsProtocol=https;AccountName=<account-name>;AccountKey=<account-key>;EndpointSuffix=core.windows.net |
Sample code
Refer to the steps and code below to connect to Azure Table Storage using a connection string.
Install dependencies.
dotnet add package Azure.Data.Tables
Get the Azure Table Storage connection string from the environment variable added by Service Connector.
using Azure.Data.Tables;
var connectionString = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CONNECTIONSTRING");
TableServiceClient tableServiceClient = new TableServiceClient(connectionString);
Add the following dependencies in your pom.xml file:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-tables</artifactId>
<version>12.2.1</version>
</dependency>
Get the Azure Table Storage connection string from the environment variable added by service connector.
String connectionStr = System.getenv("AZURE_STORAGETABLE_CONNECTIONSTRING");
TableServiceClient tableServiceClient = new TableServiceClientBuilder()
.connectionString(connectionStr)
.buildClient();
- Install dependencies.
pip install azure-data-tables
- Get the Azure Table Storage connection string from the environment variable added by Service Connector.
from azure.data.tables import TableServiceClient
import os
conn_str = os.getenv("AZURE_STORAGETABLE_CONNECTIONSTRING")
table_service = TableServiceClient.from_connection_string(self.conn_str)
- Install dependencies.
npm install @azure/data-tables
- Get the Azure Table Storage connection string from the environment variable added by Service Connector.
const { TableClient } = require("@azure/data-tables");
const connection_str = process.env.AZURE_STORAGETABLE_CONNECTIONSTRING;
const serviceClient = TableServiceClient.fromConnectionString(connection_str);
For other languages, you can use the Azure Table Storage account URL and other properties that Service Connector sets to the environment variables to connect to Azure Table Storage. For environment variable details, see Integrate Azure Table Storage with Service Connector.
Service principal
Default environment variable name |
Description |
Example value |
AZURE_STORAGETABLE_RESOURCEENDPOINT |
Table Storage endpoint |
https://<storage-account-name>.table.core.windows.net/ |
AZURE_STORAGETABLE_CLIENTID |
Your client ID |
<client-ID> |
AZURE_STORAGETABLE_CLIENTSECRET |
Your client secret |
<client-secret> |
AZURE_STORAGETABLE_TENANTID |
Your tenant ID |
<tenant-ID> |
Sample code
Refer to the steps and code below to connect to Azure Table Storage using a service principal.
Install dependencies.
dotnet add package Azure.Identity
dotnet add package Azure.Data.Tables
You can use azure-identity
to authenticate using a managed identity or a service principal. Get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
using Azure.Identity;
using Azure.Data.Tables;
// get Table endpoint
var tableEndpoint = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// system-assigned managed identity
// var credential = new DefaultAzureCredential();
// user-assigned managed identity
// var credential = new DefaultAzureCredential(
// new DefaultAzureCredentialOptions
// {
// ManagedIdentityClientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// });
// service principal
// var tenantId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_TENANTID");
// var clientId = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTID");
// var clientSecret = Environment.GetEnvironmentVariable("AZURE_STORAGETABLE_CLIENTSECRET");
// var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var tableServiceClient = new TableServiceClient(
new Uri(tableEndpoint),
credential);
Add the following dependencies in your pom.xml file:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-tables</artifactId>
<version>12.3.15</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.1.5</version>
</dependency>
Authenticate using azure-identity
and get the endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
String url = System.getenv("AZURE_STORAGETABLE_RESOURCEENDPOINT");
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
// for user-assigned managed identity
// DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder()
// .managedIdentityClientId(System.getenv("AZURE_STORAGETABLE_CLIENTID"))
// .build();
// for service principal
// ClientSecretCredential defaultCredential = new ClientSecretCredentialBuilder()
// .clientId(System.getenv("<AZURE_STORAGETABLE_CLIENTID>"))
// .clientSecret(System.getenv("<AZURE_STORAGETABLE_CLIENTSECRET>"))
// .tenantId(System.getenv("<AZURE_STORAGETABLE_TENANTID>"))
// .build();
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
.endpoint(url)
.credential(defaultCredential)
.buildClient();
Install dependencies.
pip install azure-identity
pip install azure-data-tables
Authenticate using the azure-identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
from azure.identity import ManagedIdentityCredential, ClientSecretCredential
from azure.data.tables import TableServiceClient
import os
account_url = os.getenv('AZURE_STORAGETABLE_RESOURCEENDPOINT')
# Uncomment the following lines corresponding to the authentication type you want to use.
# system assigned managed identity
# cred = ManagedIdentityCredential()
# user assigned managed identity
# managed_identity_client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# cred = ManagedIdentityCredential(client_id=managed_identity_client_id)
# service principal
# tenant_id = os.getenv('AZURE_STORAGETABLE_TENANTID')
# client_id = os.getenv('AZURE_STORAGETABLE_CLIENTID')
# client_secret = os.getenv('AZURE_STORAGETABLE_CLIENTSECRET')
# cred = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=client_secret)
table_service_client = TableServiceClient(account_url, credential=cred)
Install dependencies.
npm install --save @azure/identity
npm install @azure/data-tables
Authenticate using the @azure/identity
library and get the Azure Table Storage endpoint URL from the environment variable added by Service Connector. When using the code below, uncomment the part of the code snippet for the authentication type you want to use.
import { DefaultAzureCredential,ClientSecretCredential } from "@azure/identity";
const { TableClient } = require("@azure/data-tables");
const account_url = process.env.AZURE_STORAGETABLE_RESOURCEENDPOINT;
// Uncomment the following lines corresponding to the authentication type you want to use.
// for system assigned managed identity
// const credential = new DefaultAzureCredential();
// for user assigned managed identity
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const credential = new DefaultAzureCredential({
// managedIdentityClientId: clientId
// });
// for service principal
// const tenantId = process.env.AZURE_STORAGETABLE_TENANTID;
// const clientId = process.env.AZURE_STORAGETABLE_CLIENTID;
// const clientSecret = process.env.AZURE_STORAGETABLE_CLIENTSECRET;
// const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
const tableServiceClient = new TableServiceClient(account_url, credential);
For other languages, you can use the Azure Table Storage account URL and other properties that Service Connector sets to the environment variables to connect to Azure Table Storage. For environment variable details, see Integrate Azure Table Storage with Service Connector.
Next steps
Follow the tutorials listed below to learn more about Service Connector.