Scotec.Identity.AzureActiveDirectory 1.0.9-dev.10

This is a prerelease version of Scotec.Identity.AzureActiveDirectory.
dotnet add package Scotec.Identity.AzureActiveDirectory --version 1.0.9-dev.10
                    
NuGet\Install-Package Scotec.Identity.AzureActiveDirectory -Version 1.0.9-dev.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Scotec.Identity.AzureActiveDirectory" Version="1.0.9-dev.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Scotec.Identity.AzureActiveDirectory" Version="1.0.9-dev.10" />
                    
Directory.Packages.props
<PackageReference Include="Scotec.Identity.AzureActiveDirectory" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Scotec.Identity.AzureActiveDirectory --version 1.0.9-dev.10
                    
#r "nuget: Scotec.Identity.AzureActiveDirectory, 1.0.9-dev.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Scotec.Identity.AzureActiveDirectory@1.0.9-dev.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Scotec.Identity.AzureActiveDirectory&version=1.0.9-dev.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Scotec.Identity.AzureActiveDirectory&version=1.0.9-dev.10&prerelease
                    
Install as a Cake Tool

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 Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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