Skip to content

Commit 7ab9ebf

Browse files
Merge pull request #251238 from ahsonkhan/patch-1
Update workload-identity-overview.md for C++ since it is now part of the default azure credential flow
2 parents 53697a8 + b3e6024 commit 7ab9ebf

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

articles/aks/workload-identity-overview.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use an Azure AD workload identity on Azure Kubernetes Service (AKS)
33
description: Learn about Azure Active Directory workload identity for Azure Kubernetes Service (AKS) and how to migrate your application to authenticate using this identity.
44
ms.topic: article
55
ms.custom: build-2023
6-
ms.date: 09/03/2023
6+
ms.date: 09/13/2023
77
---
88

99
# Use Azure AD workload identity with Azure Kubernetes Service (AKS)
@@ -25,7 +25,7 @@ This article helps you understand this new authentication feature, and reviews t
2525

2626
In the Azure Identity client libraries, choose one of the following approaches:
2727

28-
- Use `DefaultAzureCredential`, which will attempt to use the `WorkloadIdentityCredential`. †
28+
- Use `DefaultAzureCredential`, which will attempt to use the `WorkloadIdentityCredential`.
2929
- Create a `ChainedTokenCredential` instance that includes `WorkloadIdentityCredential`.
3030
- Use `WorkloadIdentityCredential` directly.
3131

@@ -34,15 +34,13 @@ The following table provides the **minimum** package version required for each l
3434
| Ecosystem | Library | Minimum version |
3535
|-----------|------------------------------------------------------------------------------------------------------------------|-----------------|
3636
| .NET | [Azure.Identity](/dotnet/api/overview/azure/identity-readme) | 1.9.0 |
37-
| C++ | [azure-identity-cpp](https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/identity/azure-identity/README.md) | 1.6.0-beta.1 |
37+
| C++ | [azure-identity-cpp](https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/identity/azure-identity/README.md) | 1.6.0-beta.2 |
3838
| Go | [azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) | 1.3.0 |
3939
| Java | [azure-identity](/java/api/overview/azure/identity-readme) | 1.9.0 |
4040
| Node.js | [@azure/identity](/javascript/api/overview/azure/identity-readme) | 3.2.0 |
4141
| Python | [azure-identity](/python/api/overview/azure/identity-readme) | 1.13.0 |
4242

43-
† In the C++ library, `WorkloadIdentityCredential` isn't part of the `DefaultAzureCredential` authentication flow.
44-
45-
In the following code samples, the credential type will use the environment variables injected by the Azure Workload Identity mutating webhook to authenticate with Azure Key Vault.
43+
In the following code samples, `DefaultAzureCredential` is used. This credential type will use the environment variables injected by the Azure Workload Identity mutating webhook to authenticate with Azure Key Vault.
4644

4745
## [.NET](#tab/dotnet)
4846

@@ -70,18 +68,11 @@ KeyVaultSecret secret = await client.GetSecretAsync(secretName);
7068
using namespace Azure::Identity;
7169
using namespace Azure::Security::KeyVault::Secrets;
7270

73-
// * AZURE_TENANT_ID: Tenant ID for the Azure account.
74-
// * AZURE_CLIENT_ID: The client ID to authenticate the request.
75-
std::string GetTenantId() { return std::getenv("AZURE_TENANT_ID"); }
76-
std::string GetClientId() { return std::getenv("AZURE_CLIENT_ID"); }
77-
std::string GetTokenFilePath() { return std::getenv("AZURE_FEDERATED_TOKEN_FILE"); }
78-
7971
int main()
8072
{
8173
const char* keyVaultUrl = std::getenv("KEYVAULT_URL");
8274
const char* secretName = std::getenv("SECRET_NAME");
83-
auto credential = std::make_shared<WorkloadIdentityCredential>(
84-
GetTenantId(), GetClientId(), GetTokenFilePath());
75+
auto credential = std::make_shared<DefaultAzureCredential>();
8576

8677
SecretClient client(keyVaultUrl, credential);
8778
Secret secret = client.GetSecret(secretName).Value;

0 commit comments

Comments
 (0)