RestEase.Authentication.Azure
0.3.2.1
dotnet add package RestEase.Authentication.Azure --version 0.3.2.1
NuGet\Install-Package RestEase.Authentication.Azure -Version 0.3.2.1
<PackageReference Include="RestEase.Authentication.Azure" Version="0.3.2.1" />
<PackageVersion Include="RestEase.Authentication.Azure" Version="0.3.2.1" />
<PackageReference Include="RestEase.Authentication.Azure" />
paket add RestEase.Authentication.Azure --version 0.3.2.1
#r "nuget: RestEase.Authentication.Azure, 0.3.2.1"
#addin nuget:?package=RestEase.Authentication.Azure&version=0.3.2.1
#tool nuget:?package=RestEase.Authentication.Azure&version=0.3.2.1
RestEase.Authentication.Azure
An extension to RestEase which adds Microsoft Entra ID (Azure AD) Authentication.
Supported modes are:
- Username + Pasword
- Client with ClientSecret
- Managed Identity
Configuration when using a ClientId + ClientSecret
appsettings.json
{
"DocumentApiClientOptions": {
"TenantId": "t",
"ClientId": "c",
"ClientSecret": "s",
"Resource": "r",
"BaseAddress": "https://localhost:44318",
"AcceptAnyServerCertificate": true,
"TimeoutInSeconds": 99
}
}
Configuration when using a Managed Identity with a ClientId
appsettings.json
{
"DocumentApiClientOptions": {
"ClientId": "c",
"Resource": "r",
"BaseAddress": "https://localhost:44318",
"AcceptAnyServerCertificate": true,
"TimeoutInSeconds": 99
}
}
Configuration when using a Managed Identity without a ClientId (it will fall back to DefaultAzureCredential)
appsettings.json
{
"DocumentApiClientOptions": {
"Resource": "r",
"BaseAddress": "https://localhost:44318",
"AcceptAnyServerCertificate": true,
"TimeoutInSeconds": 99
}
}
💡 If the scopes
-array is not defined, the default the scope {Resource}/.default
is used.
Usage
1️⃣ Create a RestEase interface
[BasePath("/api")]
public interface IDocumentApi
{
[Get("GetDocumentById/{id}")]
Task<Response<Document>> GetDocumentAsync([Path] int id, CancellationToken cancellationToken = default);
}
2️⃣ Configure Dependency Injection
services.UseWithAzureAuthenticatedRestEaseClient<IDocumentApi>(configuration.GetSection("DocumentApiClientOptions"));
3️⃣ Use it in your code
IDocumentApi documentApi = ...; // Injected
var document = await documentApi.GetDocumentAsync(1, cancellationToken);
🌐 Links
- See also: RestEase.Authentication
Sponsors
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of RestEase.Authentication.Azure.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Azure.Identity (>= 1.14.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.16)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- RestEase.HttpClientFactory (>= 1.6.4)
- Stef.Validation.Options (>= 0.1.1)
-
.NETStandard 2.0
- Azure.Identity (>= 1.14.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.16)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- RestEase.HttpClientFactory (>= 1.6.4)
- Stef.Validation.Options (>= 0.1.1)
-
.NETStandard 2.1
- Azure.Identity (>= 1.14.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.16)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- RestEase.HttpClientFactory (>= 1.6.4)
- Stef.Validation.Options (>= 0.1.1)
-
net6.0
- Azure.Identity (>= 1.14.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.16)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- RestEase.HttpClientFactory (>= 1.6.4)
- Stef.Validation.Options (>= 0.1.1)
-
net8.0
- Azure.Identity (>= 1.14.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.16)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- RestEase.HttpClientFactory (>= 1.6.4)
- Stef.Validation.Options (>= 0.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# 0.3.2 (07 June 2025)
- #8 Add PackageReadme [enhancement]
The full release notes can be found here: https://github.com/StefH/RestEase.Authentication.Azure/blob/main/ReleaseNotes.md