|
Azure::Core (azure-core
) provides shared primitives, abstractions, and helpers for modern Azure SDK client libraries written in the C++. These libraries follow the Azure SDK Design Guidelines for C++.
The library allows client libraries to expose common functionality in a consistent fashion. Once you learn how to use these APIs in one client library, you will know how to use them in other client libraries.
Typically, you will not need to download azure-core
; it will be downloaded for you as a dependency of the client libraries. In case you want to download it explicitly (to implement your own client library, for example), you can find the source in here, or use vcpkg to install the package azure-core-cpp
.
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 Core package via vcpkg:
Then, use in your CMake file:
The main shared concepts of Azure::Core
include:
BodyStream
along with its derived types.Response<T>
.Operation<T>
.RequestFailedException
.TokenCredential
).Some operations take a long time to complete and require polling for their status. Methods starting long-running operations return Operation<T>
types.
You can intermittently poll whether the operation has finished by using the Poll()
method on the returned Operation<T>
and track progress of the operation using Value()
. Alternatively, if you just want to wait until the operation completes, you can use PollUntilDone()
.
Out of the box, the Azure SDK for C++ supports the libcurl and WinHTTP libraries as HTTP stacks for communicating with Azure services over the network. The SDK also provides a mechanism for customer-implemented
HTTP transport adapter. You can learn more about the transport adapter in this doc.
Three main ways of troubleshooting failures are:
The simplest way to enable logs is to set AZURE_LOG_LEVEL
environment variable to one of the values:
AZURE_LOG_LEVEL | Azure::Core::Diagnostics::Logger::Level | Log message level |
---|---|---|
4 , or error , or err | Error | Logging level for failures that the application is unlikely to recover from. |
3 , or warning , or warn | Warning | Logging level when a function fails to perform its intended task. |
2 , or informational , or information , or info | Informational | Logging level when a function operates normally. |
1 , or verbose , or debug | Verbose | Logging level for detailed troubleshooting scenarios. |
Then, log messages will be printed to console (stderr
). Note that stderr
messages can be redirected into a log file like this:
On Windows:
On Linux or macOS:
In addition, log messages can be programmatically processed by providing a callback function, which can save them to a file, or display them in a desired custom way.
Note, the listener callback is executed on the same thread as the operation that triggered the log message. It is recommended implementation due the minimal amount of log message processing on the callback thread. Where message processing is required, consider implementing in a way that the callback pushes the message string into a thread-safe queue, so that another thread would pick the messages from that queue and handle them.
Explore and install available Azure SDK libraries.
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 the Contributor License Agreement.
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:
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secur.nosp@m.e@mi.nosp@m.croso.nosp@m.ft.c.nosp@m.om. 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.