### Example for installing requirements in JavaScript Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/instructions/azsdk-tools/verify-setup.instructions.md Example of running verify-setup to install specific requirements in the azure-sdk-for-js repository. ```bash azsdk_verify_setup(langs=javascript, packagePath=/azure-sdk-for-js), requirementsToInstall=['pnpm', 'tsp']) ``` -------------------------------- ### Example for Azure SDK for JavaScript Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/instructions/azsdk-tools/verify-setup.instructions.md Example of running verify-setup in the azure-sdk-for-js repository. ```bash azsdk_verify_setup(langs=javascript, packagePath=/azure-sdk-for-js) ``` -------------------------------- ### Install missing requirements Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/instructions/azsdk-tools/verify-setup.instructions.md Approve and use the tool again with the requirementsToInstall parameter to install specific missing requirements. ```bash azsdk_verify_setup(langs=, packagePath=, requirementsToInstall=['req', 'req2', ...]) ``` -------------------------------- ### Test Environment Setup Example Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/AGENTS.md Example environment variables for setting up tests, specifically for Storage tests. ```bash # Example for Storage tests export STANDARD_STORAGE_CONNECTION_STRING="..." export AZURE_STORAGE_ACCOUNT_URL="..." export AZURE_STORAGE_ACCOUNT_NAME="..." export AZURE_STORAGE_ACCOUNT_KEY="..." ``` -------------------------------- ### GetSettings API Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/README.md Example of how to get all available settings present on the Keyvault instance. ```cpp auto credential = std::make_shared(); // create client SettingsClient settingsClient(std::getenv("AZURE_KEYVAULT_HSM_URL"), credential); // Get all settings SettingsListResult settingsList = settingsClient.GetSettings().Value; ``` -------------------------------- ### GetSetting API Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/README.md Example of how to get a specific setting by its name. ```cpp Setting setting = settingsClient.GetSetting(settingsList.Value[0].Name).Value; ``` -------------------------------- ### Test Proxy Setup Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/AGENTS.md Instructions for setting up and starting the test proxy. ```bash # Start test proxy automatically export AZURE_TEST_USE_TEST_PROXY=ON # Or start manually dotnet tool install azure.sdk.tools.testproxy --global test-proxy start ``` -------------------------------- ### Asynchronous download example (v7.5) Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of performing an asynchronous download operation using the v7.5 SDK. ```cpp auto task = blob_client.download_text_async().then([](utility::string_t blob_content) { std::wcout << "blob content:" << blob_content << std::endl; }); // Do something else task.wait(); ``` -------------------------------- ### SampleAdministration3GetSettings Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/samples/sample1_administration.md Gets a list of all key vault settings stored in the HSM. ```cpp // Get all settings SettingsListResult settingsList = settingsClient.GetSettings().Value; std::cout << "Number of settings found : " << settingsList.Value.size(); ``` -------------------------------- ### Install the package Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/azure-storage-queues/README.md Install the Azure Storage Queues C++ SDK using vcpkg. ```batch vcpkg install azure-storage-queues-cpp ``` ```CMake find_package(azure-storage-queues-cpp CONFIG REQUIRED) target_link_libraries( PRIVATE Azure::azure-storage-queues) ``` -------------------------------- ### Install dependencies on Windows using vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/attestation/azure-security-attestation/README.md These commands install curl and openssl dependencies on Windows using vcpkg. ```BatchFile vcpkg.exe install curl:x64-windows-static vcpkg.exe install openssl:x64-windows-static ``` -------------------------------- ### Install Azure Core via vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core/README.md How to install the Azure Core package using the vcpkg package manager. ```cmd > vcpkg install azure-core-cpp ``` -------------------------------- ### Install the package Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/eventhubs/azure-messaging-eventhubs/README.md Install the Azure Event Hubs client package for C++ using vcpkg. ```bash vcpkg install azure-messaging-eventhubs-cpp ``` -------------------------------- ### Install Azure Storage packages via vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/attestation/azure-security-attestation/README.md This command installs Azure Storage packages via vcpkg. ```cmd > vcpkg install azure-security-attestation-cpp ``` -------------------------------- ### Install uAMQP on Windows Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-amqp/src/impl/uamqp/vendor/azure-uamqp-c/readme.md Command to install uAMQP on a Windows system after configuration. ```bash msbuild /m INSTALL.vcxproj ``` -------------------------------- ### Install Dependencies on Ubuntu Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-amqp/src/impl/uamqp/vendor/azure-uamqp-c/readme.md Recommended command to install all needed packages for uAMQP and its dependencies on an Ubuntu distribution. ```bash sudo apt-get update sudo apt-get install -y git cmake build-essential curl libcurl4-openssl-dev libssl-dev uuid-dev ``` -------------------------------- ### v12: Downloading blob and getting stored content hash property Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of downloading a blob and retrieving the stored content hash property using the v12 SDK. ```cpp // download whole blob and get stored content hash property auto response = blobClient.Download(); auto hashAlgorithm = response.Value.Details.HttpHeaders.ContentHash.Algorithm; // This is always MD5 auto md5 = response.Value.Details.HttpHeaders.ContentHash.Value; // validate stream against hash in your workflow ``` -------------------------------- ### BackupClient Initialization Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/README.md Example of how to create a BackupClient instance. ```cpp auto credential = std::make_shared(); // create client BackupClient client(std::getenv("AZURE_KEYVAULT_HSM_URL"), credential); ``` -------------------------------- ### Listing files and directories Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/faq.md This example shows how to list both files and directories within a given path using the C++ SDK. ```cpp for (auto page = directoryClient.ListFilesAndDirectories(); page.HasPage(); page.MoveToNextPage()) { for (const auto& d : page.Directories) { std::cout << "Directory: " << d.Name << std::endl; } for (const auto& f : page.Files) { std::cout << "File: " << f.Name << std::endl; } } ``` -------------------------------- ### Check missing requirements Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/instructions/azsdk-tools/verify-setup.instructions.md Call verify-setup with language and package path to identify missing requirements. ```bash azsdk_verify_setup(langs=, packagePath=) ``` -------------------------------- ### Table Service Operations Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/tables/azure-data-tables/README.md Examples of getting service properties, listing tables, and getting account statistics. ```cpp auto properties = tableServiceClient.GetProperties(); ``` ```cpp auto tables = tableServiceClient.ListTables(); ``` ```cpp auto statistics = tableServiceClient.GetStatistics(); ``` -------------------------------- ### Install v7.5 package with vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Command to install the v7.5 Azure Storage C++ package using vcpkg. ```bash vcpkg install azure-storage-cpp ``` -------------------------------- ### Link uAMQP in a Project Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-amqp/src/impl/uamqp/vendor/azure-uamqp-c/readme.md Example of how to link the installed uAMQP library in a CMake project. ```cmake find_package(uamqp REQUIRED CONFIG) target_link_library(yourlib uamqp) ``` -------------------------------- ### SampleAdministration1CreateCredential Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/samples/sample1_administration.md Creates a credential for authenticating with Azure Key Vault. ```cpp auto credential = std::make_shared(); ``` -------------------------------- ### Install the package using vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/README.md Commands to initialize a vcpkg project in manifest mode and add the necessary packages. ```batch vcpkg new --application ``` ```batch vcpkg add port azure-security-keyvault-administration-cpp azure-identity-cpp ``` -------------------------------- ### Install v12 package with vcpkg Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Command to install the v12 Azure Storage Blobs C++ package using vcpkg. ```bash vcpkg install azure-storage-blobs-cpp ``` -------------------------------- ### SampleAdministration2SettingsClient Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/samples/sample1_administration.md Creates a SettingsClient to access settings in Azure Key Vault. ```cpp // create client SettingsClient settingsClient(std::getenv("AZURE_KEYVAULT_HSM_URL"), credential); ``` -------------------------------- ### CMakeLists.txt for Queue Getting Started Sample Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/azure-storage-queues/samples/CMakeLists.txt This snippet shows the CMake configuration for the queue-getting-started sample. ```cmake cmake_minimum_required (VERSION 3.13) if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() add_executable(queue-getting-started queue_getting_started.cpp) target_link_libraries(queue-getting-started PRIVATE azure-storage-queues get-env-helper) create_per_service_target_build_for_sample(storage queue-getting-started) target_compile_definitions(queue-getting-started PRIVATE _azure_BUILDING_SAMPLES) ``` -------------------------------- ### Manual Broker Install - Launch Test Broker Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-amqp/src/impl/rust_amqp/rust_amqp/azure_core_amqp/README.md Launching the test broker using dotnet run. ```bash cd azure-amqp/test/TestAmqpBroker dotnet run -- $env:TEST_BROKER_ADDRESS ``` -------------------------------- ### Calling transition script against docker Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/testproxy/onboarding/README.md Example of calling the transition script against docker, given local clones of azure-sdk-for-java and azure-sdk-tools. ```powershell # calling transition script against docker, given local clones of azure-sdk-for-java and azure-sdk-tools $env:GIT_TOKEN="my git token" cd c:/src/azure-sdk-for-java/sdk/attestation /generate-assets-json.ps1 -TestProxyExe "docker" -InitialPush ``` -------------------------------- ### v12 SAS Authentication Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of constructing a BlobClient with a fully constructed SAS URI. ```cpp BlobClient blobClient(blobUrlWithSas); ``` -------------------------------- ### v7.5 SAS Authentication (storage_credentials) Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of constructing a cloud_blob_client with a SAS token using storage_credentials. ```cpp cloud_blob_client blob_client(storage_uri(blob_url), storage_credentials(sas_token)); ``` -------------------------------- ### Creating a Certificate Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-certificates/samples/certificate_get_certificates.md Shows how to start the certificate creation process and wait for it to complete. ```cpp std::string certificateName = "Sample1"; CertificateCreateOptions options ... // start the create process auto response = certificateClient.StartCreateCertificate(certificateName, options); // wait for complete to get the certificate auto pollResponse = response.PollUntilDone(defaultWait).Value; ``` -------------------------------- ### v7.5: Uploading metadata Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of how to download attributes, modify metadata, and upload it using the legacy v7.5 SDK. ```cpp blob_client.download_attributes(); blob_client.metadata()["foo"] = "bar"; blob_client.upload_metadata(); ``` -------------------------------- ### Calling transition script against tool Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/testproxy/onboarding/README.md Example of calling the transition script against a tool, given local clones of azure-sdk-for-java and azure-sdk-tools. ```powershell # calling transition script against tool, given local clones of azure-sdk-for-java and azure-sdk-tools cd c:/src/azure-sdk-for-java/sdk/attestation /generate-assets-json.ps1 -InitialPush ``` -------------------------------- ### v7.5 SAS Authentication (URL with SAS) Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of constructing a cloud_blob_client with a URL that already includes a SAS token. ```cpp cloud_blob_client blob_client(storage_uri(blob_url_with_sas)); ``` -------------------------------- ### Hello World main.cpp Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/samples/integration/cmake-vcpkg/README.md A simple C++ 'Hello World!' program to test the CMake setup. ```cpp #include int main() { std::cout << "Hello World!"<()); ``` -------------------------------- ### UpdateSetting API Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-administration/README.md Example of how to update the value of a setting. ```cpp UpdateSettingOptions options; options.Value = ; Setting updatedSetting = settingsClient.UpdateSetting(settingsList.Value[0].Name, options).Value; ``` -------------------------------- ### v12: Setting blob metadata Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of how to retrieve existing metadata, modify it, and set it on a blob using the v12 SDK. ```cpp auto metadata = blobClient.GetProperties().Value.Metadata; metadata["foo"] = "bar"; blobClient.SetMetadata(metadata); ``` -------------------------------- ### v12: Uploading with blob content hash property Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of uploading a blob with a pre-calculated content hash using the v12 SDK. ```cpp // upload with blob content hash property UploadBlockBlobOptions uploadOptions; uploadOptions.HttpHeaders.ContentHash.Algorithm = HashAlgorithm::Md5; uploadOptions.HttpHeaders.ContentHash.Value = precalculatedContentHash; blobClient.Upload(stream, uploadOptions); ``` -------------------------------- ### Troubleshooting - Key Not Found Example Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-keys/README.md Example demonstrating how to catch and handle a 'KeyNotFound' exception when interacting with the Azure Key Vault key client library. ```cpp try { KeyVaultKey key = client.GetKey("some_key").Value; } catch (const Azure::Core::RequestFailedException& ex) { std::cout << std::underlying_type::type(ex.StatusCode); } ``` -------------------------------- ### Efficiently Uploading Large Amount of Small Blobs Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/faq.md A skeleton example demonstrating how to use multiple threads to upload many small blobs concurrently. ```cpp const std::vector paths; // Files to be uploaded std::atomic curr{0}; auto upload_func = [&]() { while (true) { auto id = curr.fetch_add(1); if (id >= paths.size()) { break; } const std::string path = paths[id]; try { blobClient.UploadFrom(path); } catch (Azure::Storage::StorageException& e) { // exception handling } } }; std::vector thread_handles; for (size_t i = 0; i < num_threads; ++i) { thread_handles.push_back(std::thread(upload_func)); } for (auto& i : thread_handles) { i.join(); } ``` -------------------------------- ### Upload a block with transactional hash (v12) Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example of uploading a block with a pre-calculated transactional MD5 or CRC64 hash using v12 SDK. ```cpp // upload a block with transactional hash calculated by user StageBlockOptions stageBlockOptions; stageBlockOptions.TransactionalContentHash = ContentHash(); stageBlockOptions.TransactionalContentHash.Algorithm = HashAlgorithm::Md5; // HashAlgorithm::Crc64 to use CRC64. stageBlockOptions.TransactionalContentHash.Value = precalculatedContentHash; blobClient.StageBlock(blockId, blockContentStream, stageBlockOptions); // upload more blocks as needed // commit block list blobClient.CommitBlockList(blockList); // download any range of blob with transactional checksum requested (maximum 4 MB for downloads) DownloadBlobOptions downloadOptions; downloadOptions.RangeHashAlgorithm = HashAlgorithm::Md5; // HashAlgorithm::Crc64 to use CRC64. auto response = blobClient.Download(); auto hashAlgorithm = response.Value.Details.HttpHeaders.ContentHash.Algorithm; auto hashValue = response.Value.Details.HttpHeaders.ContentHash.Value; // validate stream against hash in your workflow ``` -------------------------------- ### CMakeLists.txt for Hello World Sample Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-keys/samples/sample1-hello-world/CMakeLists.txt This CMakeLists.txt file configures the build for the 'sample1-hello-world' executable, linking necessary Azure SDK libraries. ```cmake # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. cmake_minimum_required (VERSION 3.13) project (sample1-hello-world LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) add_executable ( sample1-hello-world sample1_hello_world.cpp ) target_compile_definitions(sample1-hello-world PRIVATE _azure_BUILDING_SAMPLES) create_per_service_target_build_for_sample(keyvault sample1-hello-world) target_link_libraries(sample1-hello-world PRIVATE azure-security-keyvault-keys azure-identity get-env-helper) ``` -------------------------------- ### Connection String Parsing (v7.5 vs v12) Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Demonstrates how to parse a connection string to get a blob client in v7.5 and v12 of the Azure Storage SDK for C++. ```cpp cloud_storage_account storage_account = cloud_storage_account::parse(storage_connection_string); cloud_blob_client service_client = storage_account.create_cloud_blob_client(); ``` ```cpp BlobServiceClient serviceClient = BlobServiceClient::CreateFromConnectionString(connectionString); ``` -------------------------------- ### v12: Uploading blob content while preserving metadata Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example showing how to download blob content and metadata, modify content, and re-upload with preserved metadata using the v12 SDK. ```cpp // download blob content and metadata auto response = blobClient.DownloadTo(localFilePath); auto metadata = response.Value.Metadata; // modify blob content // re-upload modified blob content while preserving metadata // not adding metadata is a metadata clear UploadBlockBlobFromOptions uploadOptions; uploadOptions.Metadata = metadata; blobClient.UploadFrom(localFilePath, uploadOptions); ``` -------------------------------- ### v7.5: Uploading blob content while preserving metadata Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md Example demonstrating how to download blob content and metadata, modify content, and re-upload while preserving metadata using the legacy v7.5 SDK. ```cpp // download blob content. blob metadata is fetched and cached on download blob_client.download_to_file(local_file_path); // modify blob content // re-upload modified blob content while preserving metadata blob_client.upload_from_file(local_file_path); ``` -------------------------------- ### Download the transition script using wget Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/testproxy/onboarding/README.md This command downloads the PowerShell script for migrating recording assets using wget. ```bash wget https://raw.githubusercontent.com/Azure/azure-sdk-tools/main/eng/common/testproxy/onboarding/generate-assets-json.ps1 -o generate-assets-json.ps1 ``` -------------------------------- ### SecretSample4GetDeletedSecret Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Call GetDeletedSecret to get information about a specific deleted secret. ```cpp // get one deleted secret auto deletedSecret = secretClient.GetDeletedSecret(secret1.Name); std::cout << "Deleted Secret with name: " << deletedSecret.Value.Name; ``` -------------------------------- ### Download the transition script using PowerShell Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/eng/common/testproxy/onboarding/README.md This command downloads the PowerShell script for migrating recording assets. ```powershell Invoke-WebRequest -OutFile "generate-assets-json.ps1" https://raw.githubusercontent.com/Azure/azure-sdk-tools/main/eng/common/testproxy/onboarding/generate-assets-json.ps1 ``` -------------------------------- ### SecretSample4PurgeSecrets Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Purge the secrets to cleanup. ```cpp // cleanup secretClient.PurgeDeletedSecret(secret1.Name); secretClient.PurgeDeletedSecret(secret2.Name); ``` -------------------------------- ### Getting the properties of all the secrets in the key vault Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Call GetPropertiesOfSecrets to get the properties of all the secrets in the key vault. The results of this call are paged to a maximum of 25 SecretProperties per page. ```cpp // get properties of secrets for (auto secrets = secretClient.GetPropertiesOfSecrets(); secrets.HasPage(); secrets.MoveToNextPage()) { // go through every secret of each page returned for (auto const& secret : secrets.Items) { std::cout << "Found Secret with name: " << secret.Name << std::endl; } } ``` -------------------------------- ### Run the application Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/samples/integration/vcpkg-all-smoke/README.md Instructions for running the compiled application from the build directory. ```bash # # Running the Application # Instructions from inside the build directory. # # Run binary (.exe on Windows) ./smoketest-vcpkg ``` -------------------------------- ### SecretSample4GetDeletedSecrets Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Call GetDeletedSecrets to get a list of properties of all deleted secrets. This is a paged response with the same limit of 25 items per response. ```cpp // get all the versions of a secret for (auto deletedSecrets = secretClient.GetDeletedSecrets(); deletedSecrets.HasPage(); deletedSecrets.MoveToNextPage()) { // go through each version of the secret for (auto const& deletedSecret : deletedSecrets.Items) { std::cout << "Found Secret with name: " << deletedSecret.Name << std::endl; } } ``` -------------------------------- ### Creating a CertificateClient Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-certificates/samples/certificate_get_certificates.md Demonstrates how to create a CertificateClient with default Azure credentials. ```cpp auto credential = std::make_shared(); ``` ```cpp auto const keyVaultUrl = std::getenv("AZURE_KEYVAULT_URL"); ... CertificateClient certificateClient(keyVaultUrl, credential); ``` -------------------------------- ### SecretSample4DeleteSecrets Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Call StartDeleteSecret to delete a secret. This is a long running operation. We shall not purge the secrets yet. ```cpp // start deleting the secret DeleteSecretOperation operation = secretClient.StartDeleteSecret(secret1.Name); // You only need to wait for completion if you want to purge or recover the secret. operation.PollUntilDone(2s); // start deleting the secret operation = secretClient.StartDeleteSecret(secret2.Name); // You only need to wait for completion if you want to purge or recover the secret. operation.PollUntilDone(2s); ``` -------------------------------- ### Creating a couple of Secrets Source: https://github.com/azure/azure-sdk-for-cpp/blob/main/sdk/keyvault/azure-security-keyvault-secrets/samples/sample4_get_secrets_deleted.md Call SetSecret to create a couple of new secret with names and secret values. ```cpp std::string secretName("MySampleSecret"); std::string secretName2("MySampleSecret2"); std::string secretValue("my secret value"); Secret secret1 = secretClient.SetSecret(secretName, secretValue).Value; Secret secret2 = secretClient.SetSecret(secretName2, secretValue).Value; ```