dotnet add package Azure.Core --version 1.49.0
NuGet\Install-Package Azure.Core -Version 1.49.0
<PackageReference Include="Azure.Core" Version="1.49.0" />
<PackageVersion Include="Azure.Core" Version="1.49.0" />
<PackageReference Include="Azure.Core" />
paket add Azure.Core --version 1.49.0
#r "nuget: Azure.Core, 1.49.0"
#:package Azure.Core@1.49.0
#addin nuget:?package=Azure.Core&version=1.49.0
#tool nuget:?package=Azure.Core&version=1.49.0
Azure.Core provides shared primitives, abstractions, and helpers for modern .NET Azure SDK client libraries.
These libraries follow the Azure SDK Design Guidelines for .NET
and can be easily identified by package and namespaces names starting with 'Azure', e.g. Azure.Storage.Blobs
.
A more complete list of client libraries using Azure.Core can be found here.
Azure.Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries.
Source code | Package (NuGet) | API reference documentation
Typically, you will not need to install Azure.Core; it will be installed for you when you install one of the client libraries using it. In case you want to install it explicitly (to implement your own client library, for example), you can find the NuGet package here.
The main shared concepts of Azure.Core (and so Azure SDK libraries using Azure.Core) include:
ClientOptions
).Response
, Response<T>
).Operation<T>
).AsyncPageable<T>
).RequestFailedException
).RequestContext
).TokenCredentials
).Below, you will find sections explaining these shared concepts in more detail.
We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime
NOTE: Samples in this file apply only to packages that follow Azure SDK Design Guidelines. Names of such packages usually start with Azure
.
ClientOptions
Azure SDK client libraries typically expose one or more service client types that
are the main starting points for calling corresponding Azure services.
You can easily find these client types as their names end with the word Client.
For example, BlockBlobClient
can be used to call blob storage service,
and KeyClient
can be used to access Key Vault service cryptographic keys.
These client types can be instantiated by calling a simple constructor,
or its overload that takes various configuration options.
These options are passed as a parameter that extends ClientOptions
class exposed by Azure.Core.
Various service specific options are usually added to its subclasses, but a set of SDK-wide options are
available directly on ClientOptions
.
SecretClientOptions options = new SecretClientOptions()
{
Retry =
{
Delay = TimeSpan.FromSeconds(2),
MaxRetries = 10,
Mode = RetryMode.Fixed
},
Diagnostics =
{
IsLoggingContentEnabled = true,
ApplicationId = "myApplicationId"
}
};
SecretClient client = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential(), options);
More on client configuration in client configuration samples.
Response<T>
Service clients have methods that can be used to call Azure services. We refer to these client methods service methods.
Service methods return a shared Azure.Core type Response<T>
(in rare cases its non-generic sibling, a raw Response
).
This type provides access to both the deserialized result of the service call,
and to the details of the HTTP response returned from the server.
// create a client
var client = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential());
// call a service method, which returns Response<T>
Response<KeyVaultSecret> response = await client.GetSecretAsync("SecretName");
// Response<T> has two main accessors.
// Value property for accessing the deserialized result of the call
KeyVaultSecret secret = response.Value;
// .. and GetRawResponse method for accessing all the details of the HTTP response
Response http = response.GetRawResponse();
// for example, you can access HTTP status
int status = http.Status;
// or the headers
foreach (HttpHeader header in http.Headers)
{
Console.WriteLine($"{header.Name} {header.Value}");
}
More on response types in response samples.
To create an Azure SDK log listener that outputs messages to console use AzureEventSourceListener.CreateConsoleLogger
method.
// Setup a listener to monitor logged events.
using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger();
More on logging in diagnostics samples.
RequestFailedException
When a service call fails Azure.RequestFailedException
would get thrown. The exception type provides a Status property with an HTTP status code and an ErrorCode property with a service-specific error code.
try
{
KeyVaultSecret secret = client.GetSecret("NonexistentSecret");
}
// handle exception with status code 404
catch (RequestFailedException e) when (e.Status == 404)
{
// handle not found error
Console.WriteLine("ErrorCode " + e.ErrorCode);
}
More on handling responses in response samples.
AsyncPageable<T>
If a service call returns multiple values in pages, it would return Pageable<T>/AsyncPageable<T>
as a result. You can iterate over AsyncPageable
directly or in pages.
// call a service method, which returns AsyncPageable<T>
AsyncPageable<SecretProperties> allSecretProperties = client.GetPropertiesOfSecretsAsync();
await foreach (SecretProperties secretProperties in allSecretProperties)
{
Console.WriteLine(secretProperties.Name);
}
For more information on paged responses, see Pagination with the Azure SDK for .NET.
Operation<T>
Some operations take long time to complete and require polling for their status. Methods starting long-running operations return *Operation<T>
types.
The WaitForCompletionAsync
method is an easy way to wait for operation completion and get the resulting value.
// create a client
SecretClient client = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential());
// Start the operation
DeleteSecretOperation operation = await client.StartDeleteSecretAsync("SecretName");
Response<DeletedSecret> response = await operation.WaitForCompletionAsync();
DeletedSecret value = response.Value;
Console.WriteLine(value.Name);
Console.WriteLine(value.ScheduledPurgeDate);
More on long-running operations in long-running operation samples.
RequestContext
Besides general configuration of service clients through ClientOptions
, it is possible to customize the requests sent by service clients
using protocol methods or convenience APIs that expose RequestContext
as a parameter.
var context = new RequestContext();
context.AddClassifier(404, isError: false);
Response response = await client.GetPetAsync("pet1", context);
More on request customization in RequestContext samples.
One of the most important cross-cutting features of our new client libraries using Azure.Core is that they are designed for mocking. Mocking is enabled by:
SecretModelFactory
.For example, the ConfigurationClient.Get method can be mocked (with Moq) as follows:
// Create a mock response
var mockResponse = new Mock<Response>();
// Create a mock value
var mockValue = SecretModelFactory.KeyVaultSecret(
SecretModelFactory.SecretProperties(new Uri("http://example.com"))
);
// Create a client mock
var mock = new Mock<SecretClient>();
// Setup client method
mock.Setup(c => c.GetSecret("Name", null, default))
.Returns(Response.FromValue(mockValue, mockResponse.Object));
// Use the client mock
SecretClient client = mock.Object;
KeyVaultSecret secret = client.GetSecret("Name");
More on mocking in Unit testing and mocking with the Azure SDK for .NET.
Azure SDKs are instrumented for distributed tracing using OpenTelemetry. Distributed tracing allows to follow request through multiple services, record how long network or logical call take along with structured properties describing such operations.
More on diagnostics in diagnostics samples.
To setup distributed tracing for your application follow your observability vendor documentation. If you use Azure Monitor, follow the Start Monitoring Application guide.
Three main ways of troubleshooting failures are inspecting exceptions, enabling logging, and distributed tracing
Explore and install available Azure SDK libraries.
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 repositories 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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
.NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
.NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
MonoAndroid | monoandroid monoandroid was computed. |
MonoMac | monomac monomac was computed. |
MonoTouch | monotouch monotouch was computed. |
Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
Xamarin.iOS | xamarinios xamarinios was computed. |
Xamarin.Mac | xamarinmac xamarinmac was computed. |
Xamarin.TVOS | xamarintvos xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Azure.Core:
Package | Downloads |
---|---|
Azure.Identity
Provides APIs for authenticating to Microsoft Entra ID |
|
Microsoft.Data.SqlClient
The current data provider for SQL Server and Azure SQL databases. This has replaced System.Data.SqlClient. These classes provide access to SQL and encapsulate database-specific protocols, including tabular data stream (TDS). Commonly Used Types: Microsoft.Data.SqlClient.SqlConnection Microsoft.Data.SqlClient.SqlException Microsoft.Data.SqlClient.SqlParameter Microsoft.Data.SqlClient.SqlDataReader Microsoft.Data.SqlClient.SqlCommand Microsoft.Data.SqlClient.SqlTransaction Microsoft.Data.SqlClient.SqlParameterCollection Microsoft.Data.SqlClient.SqlClientFactory When using NuGet 3.x this package requires at least version 3.4. |
|
Azure.Storage.Common
This client library enables working with the Microsoft Azure Storage services which include the blob and file services for storing binary and text data, and the queue service for storing messages that may be accessed by a client. For this release see notes - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/README.md and https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/CHANGELOG.md in addition to the breaking changes https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/BreakingChanges.txt Microsoft Azure Storage quickstarts and tutorials - https://docs.microsoft.com/en-us/azure/storage/ Microsoft Azure Storage REST API Reference - https://docs.microsoft.com/en-us/rest/api/storageservices/ |
|
Azure.Storage.Blobs
This client library enables working with the Microsoft Azure Storage Blob service for storing binary and text data. For this release see notes - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/README.md and https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/CHANGELOG.md in addition to the breaking changes https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs/BreakingChanges.txt Microsoft Azure Storage quickstarts and tutorials - https://docs.microsoft.com/en-us/azure/storage/ Microsoft Azure Storage REST API Reference - https://docs.microsoft.com/en-us/rest/api/storageservices/ REST API Reference for Blob Service - https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api |
|
Azure.Security.KeyVault.Secrets
This is the Microsoft Azure Key Vault Secrets client library |
Showing the top 20 popular GitHub repositories that depend on Azure.Core:
Repository | Stars |
---|---|
dotnet/orleans
Cloud Native application framework for .NET
|
|
Azure/azure-powershell
Microsoft Azure PowerShell
|
|
microsoft/perfview
PerfView is a CPU and memory performance-analysis tool
|
|
Azure-Samples/cognitive-services-speech-sdk
Sample code for the Microsoft Cognitive Services Speech SDK
|
|
dotnet/interactive
.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
|
|
dotnet/extensions
This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
|
|
netwrix/pingcastle
PingCastle - Get Active Directory Security at 80% in 20% of the time
|
|
Azure/azure-functions-host
The host/runtime that powers Azure Functions
|
|
microsoft/mcp
Catalog of official Microsoft MCP (Model Context Protocol) server implementations for AI-powered data access and tool integration
|
|
microsoft/azure-pipelines-agent
Azure Pipelines Agent 🚀
|
|
NuGet/NuGetGallery
NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
|
|
webprofusion/certify
Professional ACME Client for Windows. Certificate Management UI, powered by Let's Encrypt and compatible with all ACME v2 CAs. Used by over 150,000 organisations. Remember to Star us! Download from certifytheweb.com
|
|
ariacom/Seal-Report
Database Reporting Tool and Tasks (.Net)
|
|
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
|
|
VirtoCommerce/vc-platform
Virto Commerce B2B Innovation Platform
|
|
Azure/azure-mcp
The Azure MCP Server, bringing the power of Azure to your agents.
|
|
dotnet/SqlClient
Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
|
|
mixcore/mix.core
🚀 A future-proof enterprise web CMS supporting both headless and decoupled approaches. Build any type of app with customizable APIs on ASP.NET Core/.NET Core. Completely open-source and designed for flexibility.
|
|
MicrosoftLearning/AI-102-AIEngineer
Lab files for AI-102 - AI Engineer
|
|
Azure/azure-cosmos-dotnet-v3
.NET SDK for Azure Cosmos DB for the core SQL API
|
Version | Downloads | Last Updated | |
---|---|---|---|
1.49.0 | 389,360 | 9/23/2025 | |
1.48.0 | 342,620 | 9/9/2025 | |
1.47.3 | 3,014,074 | 8/20/2025 | |
1.47.2 | 288,586 | 8/12/2025 | |
1.47.1 | 6,845,161 | 7/15/2025 | |
1.45.0 | 3,914,123 | 2/6/2025 | |
1.44.1 | 120,027,340 | 10/9/2024 | |
1.44.0 | 23,385,577 | 10/3/2024 | |
1.43.0 | 20,025,134 | 9/13/2024 | |
1.42.0 | 37,784,506 | 8/1/2024 | |
1.41.0 | 50,760,572 | 7/11/2024 | |
1.40.0 | 82,460,824 | 6/6/2024 | |
1.39.0 | 33,644,044 | 4/19/2024 | |
1.38.0 | 193,614,091 | 2/26/2024 | |
1.37.0 | 125,278,328 | 1/11/2024 | |
1.36.0 | 106,665,722 | 11/10/2023 | |
1.35.0 | 171,407,332 | 9/7/2023 | |
1.34.0 | 29,597,140 | 7/12/2023 | |
1.33.0 | 22,983,527 | 6/16/2023 | |
1.32.0 | 33,462,944 | 5/10/2023 | |
1.31.0 | 37,346,291 | 4/10/2023 | |
1.30.0 | 82,785,585 | 3/10/2023 | |
1.28.0 | 20,520,030 | 2/6/2023 | |
1.27.0 | 26,222,476 | 1/10/2023 | |
1.26.0 | 11,538,995 | 11/8/2022 | |
1.25.0 | 214,544,657 | 6/30/2022 | |
1.24.0 | 140,045,086 | 4/5/2022 | |
1.23.0 | 63,166,896 | 3/22/2022 | |
1.22.0 | 34,867,994 | 1/13/2022 | |
1.21.0 | 28,264,994 | 11/4/2021 | |
1.20.0 | 117,310,359 | 10/4/2021 | |
1.19.0 | 118,164,196 | 9/1/2021 | |
1.18.0 | 8,467,660 | 8/19/2021 | |
1.17.0 | 11,862,149 | 8/3/2021 | |
1.16.0 | 10,426,195 | 7/1/2021 | |
1.15.0 | 46,836,330 | 6/3/2021 | |
1.14.0 | 45,254,778 | 5/6/2021 | |
1.13.0 | 1,015,637 | 4/8/2021 | |
1.12.0 | 1,031,171 | 3/31/2021 | |
1.11.0 | 520,435 | 3/22/2021 | |
1.10.0 | 39,206,395 | 3/8/2021 | |
1.9.0 | 7,438,535 | 2/6/2021 | |
1.8.1 | 27,256,380 | 1/11/2021 | |
1.8.0 | 65,520 | 1/6/2021 | |
1.7.0 | 10,864,248 | 12/14/2020 | |
1.6.0 | 162,603,967 | 10/28/2020 | |
1.5.1 | 572,985 | 10/1/2020 | |
1.5.0 | 4,258,488 | 9/4/2020 | |
1.4.1 | 27,956,674 | 8/18/2020 | |
1.3.0 | 27,089,132 | 7/2/2020 | |
1.2.2 | 9,255,049 | 6/4/2020 | |
1.2.1 | 3,780,334 | 4/30/2020 | |
1.2.0 | 1,594,252 | 4/3/2020 | |
1.1.0 | 2,570,257 | 3/6/2020 | |
1.0.2 | 100,407,365 | 2/10/2020 | |
1.0.1 | 41,947,475 | 11/18/2019 | |
1.0.0 | 7,086,460 | 10/29/2019 | |
1.0.0-preview.9 | 34,369 | 10/7/2019 | |
1.0.0-preview.8 | 16,821 | 9/9/2019 | |
1.0.0-preview.7 | 10,974 | 8/5/2019 | |
1.0.0-preview.6 | 8,996 | 6/27/2019 | |
1.0.0-preview.5 | 16,193 | 5/3/2019 |