azure-sdk-for-cpp/sdk/identity/azure-identity
Daniel Jurek fda88bf7b8
Update for "master" -> "main" branch rename (#2455)
* vcpkg.json -- update all links to point to "main" .. This is hardcoded and will go out in future releases.
* ci.yml -- add `- main` to trigger criteria near `- master` ... This adds forward compatilbitiy when we rename the branch in the repo
* archetype-cpp-release.yml use a script which evaluates a repo's default branch and sets that in a global variable, then use that variable instead. When vcpkg updates their branch the publishing scripts will work transparently.
* Collect-Changelogs.ps1 -- Add default hardcoded branch name for use with future releases. This can be optionally overridden with a parameter when invoking the script.
* eng/pipelines/client.yml -- Delete this file. It is no longer in use.
2021-06-18 09:09:27 -07:00
..
inc/azure Core: Doxygen: Constructors, destructors, operators, and context parameter (#2378) 2021-06-03 10:57:37 -07:00
src Increment package version after release of azure-identity (#2403) 2021-06-09 00:38:50 -07:00
test adding Test file sufix to all tests (#2337) 2021-05-25 11:15:30 -07:00
vcpkg Update for "master" -> "main" branch rename (#2455) 2021-06-18 09:09:27 -07:00
cgmanifest.json Update Notice and add cgmanifest.json (#839) 2020-11-18 11:44:22 -08:00
CHANGELOG.md Increment package version after release of azure-identity (#2403) 2021-06-09 00:38:50 -07:00
CMakeLists.txt Add final specifier (#2237) 2021-05-10 11:57:40 -07:00
NOTICE.txt Update Notice and add cgmanifest.json (#839) 2020-11-18 11:44:22 -08:00
README.md Update readme for Identity (#2241) 2021-05-10 11:31:12 -07:00

Azure Identity client library for C++

The Azure Identity library provides Azure Active Directory token authentication support across the Azure SDK. It provides a set of TokenCredential implementations which can be used to construct Azure SDK clients which support AAD token authentication. This library follows the Azure SDK Design Guidelines for C++.

Source code | API reference documentation | Azure Active Directory documentation

Getting started

Include the package

The easiest way to acquire the C++ SDK is leveraging vcpkg package manager. See the corresponding Azure SDK for C++ readme section.

To install Azure Identity package via vcpkg:

> vcpkg install azure-identity-cpp

Then, use in your CMake file:

find_package(azure-identity-cpp CONFIG REQUIRED)
target_link_libraries(<your project name> PRIVATE Azure::azure-identity)

Key concepts

Credentials

A credential is a class which contains or can obtain the data needed for a service client to authenticate requests. Service clients across Azure SDK accept credentials when they are constructed, and service clients use those credentials to authenticate requests to the service.

The Azure Identity library focuses on OAuth authentication with Azure Active directory, and it offers a variety of credential classes capable of acquiring an AAD token to authenticate service requests. All of the credential classes in this library are implementations of the TokenCredential abstract class in azure-core, and any of them can be used by to construct service clients capable of authenticating with a TokenCredential.

Authenticating Service Principals

credential class usage configuration
ClientSecretCredential authenticates a service principal using a secret Service principal authentication

Environment Variables

EnvironmentCredential can be configured with environment variables.

Service principal with secret

variable name value
AZURE_CLIENT_ID id of an Azure Active Directory application
AZURE_TENANT_ID id of the application's Azure Active Directory tenant
AZURE_CLIENT_SECRET one of the application's client secrets

Troubleshooting

Credentials raise exceptions either when they fail to authenticate or cannot execute authentication. When credentials fail to authenticate, the AuthenticationException is thrown and it has the what() functions returning the description why authentication failed.

Contributing

For details on contributing to this repository, see the contributing guide.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Many people all over the world have helped make this project better. You'll want to check out:

Reporting security issues and security bugs

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

License

Azure SDK for C++ is licensed under the MIT license.