Scotec.Identity.AzureActiveDirectory
1.0.9-dev.10
dotnet add package Scotec.Identity.AzureActiveDirectory --version 1.0.9-dev.10
NuGet\Install-Package Scotec.Identity.AzureActiveDirectory -Version 1.0.9-dev.10
<PackageReference Include="Scotec.Identity.AzureActiveDirectory" Version="1.0.9-dev.10" />
<PackageVersion Include="Scotec.Identity.AzureActiveDirectory" Version="1.0.9-dev.10" />
<PackageReference Include="Scotec.Identity.AzureActiveDirectory" />
paket add Scotec.Identity.AzureActiveDirectory --version 1.0.9-dev.10
#r "nuget: Scotec.Identity.AzureActiveDirectory, 1.0.9-dev.10"
#:package Scotec.Identity.AzureActiveDirectory@1.0.9-dev.10
#addin nuget:?package=Scotec.Identity.AzureActiveDirectory&version=1.0.9-dev.10&prerelease
#tool nuget:?package=Scotec.Identity.AzureActiveDirectory&version=1.0.9-dev.10&prerelease
Scotec.Identity.AzureActiveDirectory
Scotec.Identity.AzureActiveDirectory is a .NET library that provides authentication and token management for Azure Active Directory (AAD) using the Microsoft Authentication Library (MSAL). It supports secure token caching and seamless integration with Azure SDK clients, making it easy to acquire and manage AAD tokens in your applications.
Features
- Acquire Azure AD tokens using MSAL
- Support for silent and interactive authentication flows
- Secure, persistent token caching
- Integration with Azure SDK clients via TokenCredential
- Configurable authentication options (client ID, tenant ID, scopes, token cache, auto sign-out)
Usage
Configure authentication options with your Azure AD application details and required scopes. Use the provided services to acquire tokens or integrate with Azure SDKs.
Example: Using AadAuthService and AadAuthSession with Azure Storageusing Azure.Storage.Blobs;
using Scotec.Identity.AzureActiveDirectory;
// Configure authentication options
var options = new AadAuthOptions
{
ClientId = "<your-client-id>",
TenantId = "<your-tenant-id>",
Scopes = new[] { "https://storage.azure.com/.default" },
// Optionally, configure persistent token cache:
// TokenCache = new TokenCache("<path-to-cache-file>")
};
// Create the authentication service
var authService = new AadAuthService(options);
// Get available accounts (optional)
var accounts = await authService.GetAccountsAsync();
var account = accounts.FirstOrDefault(); // Or select based on username
// Sign in (silent if possible, otherwise interactive)
var session = await authService.SignInAsync(account);
// Get a TokenCredential for Azure SDKs
var credential = session.TokenCredential;
// Use the credential with Azure BlobServiceClient
var blobServiceClient = new BlobServiceClient(new Uri("https://<your-storage-account>.blob.core.windows.net/"), credential);
Now you can use blobServiceClient to interact with Azure Blob Storage.
Replace <your-client-id>
, <your-tenant-id>
, and <your-storage-account>
with your actual Azure AD and storage account details.
License
MIT License. See license.txt
for details.
For more information, visit the Scotec Software Solutions website or the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
net8.0-windows7.0
- Azure.Core (>= 1.47.1)
- Microsoft.Identity.Client (>= 4.74.0)
- Microsoft.Identity.Client.Desktop (>= 4.74.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.9-dev.10 | 14 | 7/19/2025 |
1.0.9-dev.8 | 105 | 7/17/2025 |
1.0.9-dev.6 | 105 | 7/16/2025 |
1.0.9-dev.5 | 110 | 7/16/2025 |
1.0.9-dev.4 | 107 | 7/16/2025 |
1.0.9-dev.3 | 107 | 7/16/2025 |