Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"nostd",
"nread",
"NTSTATUS",
"Oaep",
"OIDC",
"okhttp",
"opentelemetry",
Expand Down
6 changes: 1 addition & 5 deletions samples/integration/vcpkg-all-smoke/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ using namespace Azure::Security::Attestation;

int main()
{
auto tenantId = std::getenv("AZURE_TENANT_ID");
auto clientId = std::getenv("AZURE_CLIENT_ID");
auto clientSecret = std::getenv("AZURE_CLIENT_SECRET");
const std::string leaseID = "leaseID";
const std::string smokeUrl = "https://blob.com";
// Creating an attestation service instance requires contacting the attestation service (to
// retrieve validation collateral). Use the West US Shared client (which should always be
// available) as an anonymous service instance.
const std::string attestationUrl = "https://sharedwus.wus.attest.azure.net";

auto credential
= std::make_shared<Azure::Identity::ClientSecretCredential>(tenantId, clientId, clientSecret);
auto credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();

// instantiate the clients
try
Expand Down
9 changes: 3 additions & 6 deletions sdk/attestation/azure-security-attestation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ authentication, the documentation for that API will reflect that the attestation

To interact with the authenticated APIs supported by the Azure Attestation service, your client must present an Azure Active Directory bearer token to the service.

The simplest way of providing a bearer token is to use the `ClientSecretCredential` authentication method by providing client secret credentials is being used in this
getting started section, but you can find more ways to authenticate with [azure-identity][azure_identity].
The simplest way of providing a bearer token is to use the `DefaultAzureCredential` authentication method is being used in this getting started section, but you can find more ways to authenticate with [azure-identity][azure_identity].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is awkward to read, probably because of a typo.

use the DefaultAzureCredential authentication method is being used in this getting started section

Did you mean this?

Suggested change
The simplest way of providing a bearer token is to use the `DefaultAzureCredential` authentication method is being used in this getting started section, but you can find more ways to authenticate with [azure-identity][azure_identity].
The simplest way of providing a bearer token is to use the `DefaultAzureCredential` authentication method which is being used in this getting started section, but you can find more ways to authenticate with [azure-identity][azure_identity].


## Key concepts

Expand Down Expand Up @@ -219,8 +218,7 @@ If the attestation APIs require authentication, use the following:
```cpp
std::string endpoint = std::getenv("ATTESTATION_AAD_URL");
std::shared_ptr<Azure::Core::Credentials::TokenCredential> credential
= std::make_shared<Azure::Identity::ClientSecretCredential>(
std::getenv("AZURE_TENANT_ID"), std::getenv("AZURE_CLIENT_ID"), std::getenv("AZURE_CLIENT_SECRET"));
= std::make_shared<Azure::Identity::DefaultAzureCredential>();
auto client = Azure::Security::Attestation::AttestationClient::Create(m_endpoint, credential);
```

Expand Down Expand Up @@ -265,8 +263,7 @@ All administrative clients are authenticated.
```cpp
std::string endpoint = std::getenv("ATTESTATION_AAD_URL");
std::shared_ptr<Azure::Core::Credentials::TokenCredential> credential
= std::make_shared<Azure::Identity::ClientSecretCredential>(
std::getenv("AZURE_TENANT_ID"), std::getenv("AZURE_CLIENT_ID"), std::getenv("AZURE_CLIENT_SECRET"));
= std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient adminClient(AttestationAdministrationClient::Create(m_endpoint, credential));
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account. Used for authenticated calls to the
* attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_SECRET: The client secret. Used for authenticated calls to the attestation
* service.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account. Used for authenticated calls to the
* attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_SECRET: The client secret. Used for authenticated calls to the attestation
* service.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account. Used for authenticated calls to the
* attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_SECRET: The client secret. Used for authenticated calls to the attestation
* service.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account. Used for authenticated calls to the
* attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_SECRET: The client secret. Used for authenticated calls to the attestation
* service.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account. Used for authenticated calls to the
* attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request. Used for authenticated calls to
* the attestation service.
* - AZURE_CLIENT_SECRET: The client secret. Used for authenticated calls to the attestation
* service.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
* - ATTESTATION_AAD_URL: Points to an Attestation Service Instance in AAD mode.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
* Note that the administration client MUST be authenticated.
*
Expand All @@ -35,10 +32,7 @@ int main()
try
{
// create client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient const adminClient(AttestationAdministrationClient::Create(
GetEnvHelper::GetEnv("ATTESTATION_AAD_URL"), credential));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@

/**
* @brief This sample provides the code implementation to use the Attestation SDK client
* for C++ to retrieve the OpenID metadata for an endpoint..
* for C++ to retrieve the OpenID metadata for an endpoint.
*
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_AAD_URL: Points to an Attestation Service Instance in AAD mode.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@

/**
* @brief This sample provides the code implementation to use the Attestation SDK client
* for C++ to retrieve the OpenID metadata for an endpoint..
* for C++ to retrieve the OpenID metadata for an endpoint.
*
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_AAD_URL: Points to an Attestation Service Instance in AAD mode.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
* - ISOLATED_SIGNING_CERTIFICATE: An X.509 certificate which wraps the ISOLATED_SIGNING_KEY.
* - POLICY_SIGNING_CERTIFICATE_0: An X.509 certificate which will be added to the set of policy
* management certificates.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand All @@ -46,10 +43,7 @@ int main()
try
{
// create an administration client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient adminClient(AttestationAdministrationClient::Create(
GetEnvHelper::GetEnv("ATTESTATION_ISOLATED_URL"), credential));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand All @@ -41,10 +38,7 @@ int main()
try
{
// create an administration client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient adminClient(AttestationAdministrationClient::Create(
GetEnvHelper::GetEnv("ATTESTATION_ISOLATED_URL"), credential));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_AAD_URL: Points to an Attestation Service Instance in AAD mode.
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand All @@ -35,10 +32,7 @@ int main()
try
{
// create an administration client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();

AttestationAdministrationClient adminClient(AttestationAdministrationClient::Create(
GetEnvHelper::GetEnv("ATTESTATION_AAD_URL"), credential));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand Down Expand Up @@ -50,10 +47,7 @@ int main()
clientOptions.TokenValidationOptions.TimeValidationSlack = 10s;

// create client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient const adminClient(
AttestationAdministrationClient::Create(endpoint, credential, clientOptions));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
*
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
* - ISOLATED_SIGNING_KEY: A Base64 encoded DER encoded RSA private key which matches the private
* key used when creating the ATTESTATION_ISOLATED_URL.
* - ISOLATED_SIGNING_CERTIFICATE: A Base64 encoded X.509 certificate wrapping the public key of the
Expand Down Expand Up @@ -53,10 +50,7 @@ int main()
clientOptions.TokenValidationOptions.TimeValidationSlack = 10s;

// create client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient const adminClient(
AttestationAdministrationClient::Create(endpoint, credential, clientOptions));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - LOCATION_SHORT_NAME: Specifies the short name of an Azure region to use for shared mode
* operations.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
*
*/

Expand Down Expand Up @@ -54,10 +51,7 @@ int main()
clientOptions.TokenValidationOptions.TimeValidationSlack = 10s;

// create client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient const adminClient(
AttestationAdministrationClient::Create(endpoint, credential, clientOptions));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
*
* @remark The following environment variables must be set before running the sample.
* - ATTESTATION_ISOLATED_URL: Points to an Attestation Service Instance in Isolated mode.
* - AZURE_TENANT_ID: Tenant ID for the Azure account.
* - AZURE_CLIENT_ID: The Client ID to authenticate the request.
* - AZURE_CLIENT_SECRET: The client secret.
* - ISOLATED_SIGNING_KEY: A Base64 encoded DER encoded RSA private key which matches the private
* key used when creating the ATTESTATION_ISOLATED_URL.
* - ISOLATED_SIGNING_CERTIFICATE: A Base64 encoded X.509 certificate wrapping the public key of the
Expand Down Expand Up @@ -59,10 +56,7 @@ int main()
clientOptions.TokenValidationOptions.TimeValidationSlack = 10s;

// create client
auto const credential = std::make_shared<Azure::Identity::ClientSecretCredential>(
GetEnvHelper::GetEnv("AZURE_TENANT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_ID"),
GetEnvHelper::GetEnv("AZURE_CLIENT_SECRET"));
auto const credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
AttestationAdministrationClient const adminClient(
AttestationAdministrationClient::Create(endpoint, credential, clientOptions));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <azure/core/amqp/internal/connection_string_credential.hpp>
#include <azure/core/amqp/internal/management.hpp>
#include <azure/core/amqp/internal/message_sender.hpp>
#include <azure/identity/client_secret_credential.hpp>
#include <azure/identity.hpp>

#include <chrono>
#include <iostream>
Expand Down Expand Up @@ -172,10 +172,7 @@ int main()

// Establish the connection to the eventhub.

auto credential{std::make_shared<Azure::Identity::ClientSecretCredential>(
std::getenv("SAMPLES_TENANT_ID"),
std::getenv("SAMPLES_CLIENT_ID"),
std::getenv("SAMPLES_CLIENT_SECRET"))};
auto credential{std::make_shared<Azure::Identity::DefaultAzureCredential>()};

Azure::Core::Amqp::_internal::ConnectionOptions connectionOptions;
connectionOptions.ContainerId = "some";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <azure/core/amqp/internal/connection_string_credential.hpp>
#include <azure/core/amqp/internal/message_sender.hpp>
#include <azure/core/credentials/credentials.hpp>
#include <azure/identity/client_secret_credential.hpp>
#include <azure/identity.hpp>

#include <chrono>
#include <iostream>
Expand All @@ -32,10 +32,7 @@ int main()
}

// Establish credentials for the eventhub client.
auto credential{std::make_shared<Azure::Identity::ClientSecretCredential>(
std::getenv("SAMPLES_TENANT_ID"),
std::getenv("SAMPLES_CLIENT_ID"),
std::getenv("SAMPLES_CLIENT_SECRET"))};
auto credential{std::make_shared<Azure::Identity::DefaultAzureCredential>()};

Azure::Core::Amqp::_internal::ConnectionOptions connectionOptions;
connectionOptions.ContainerId = "some";
Expand Down
6 changes: 0 additions & 6 deletions sdk/eventhubs/azure-messaging-eventhubs/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ variables have been set by the user:
* EVENTHUBS_CONNECTION_STRING - The service connection string for the eventhubs instance.
* EVENTHUB_NAME - Name of the eventhubs instance to communicate with.
* EVENTHUBS_HOST - Fully qualified domain name for the eventhubs instance.
* AZURE_TENANT_ID - The tenant ID for the user or service principal which has
been granted access to the eventhubs service instance.
* AZURE_CLIENT_ID - The client ID for the user or service principal which has been
granted access to the eventhubs service instance.
* AZURE_CLIENT_SECRET - The client secret for the user or service principal
which has been granted access to the eventhubs service instance.

The tests also assume that the currently logged on user is authorized to call
into the Event Hubs service instance because they use [Azure::Core::Credentials::TokenCredential](https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-core/1.3.1/class_azure_1_1_core_1_1_credentials_1_1_token_credential.html) for authorization.
Expand Down
Loading