-
Notifications
You must be signed in to change notification settings - Fork 372
PowerShell support
There is no Microsoft supported PoswerShell module or wrapper for MSAL libraries. However, PowerShell was designed to be able to call into .NET code and there are numerous resources that describe how to do this.
After you download the MSAL nuget package, unzip it, and take a look inside. In the lib
folder there are the DLLs you are looking for:
If you are writing modules for the new PowerShell Core, then you should load the netcoreapp2.1
version. If you are writing a module for PowerShell classic, then look into the net45
directory. If you aren't sure, start with the net45
version, which only works on Windows.
Avoid loading the netstandard1.3
DLL, as this version is missing a lot of functionality.
MSAL.NET will create and manage a token cache, but it will NOT persist it. You are responsible for persisting and encrypting the token cache. If you do not, MSAL will only keep the token cache in memory, and when the process stops, the tokens are lost, and users will have to relogin.
On Windows, all our samples use DPAPI to encrypt a file with the token cache. Inspect this sample for details.
If you target PowerShell Core / .NET Core, it important to understand the DPAPI encryption solution above will NOT work. For a cross platform token cache persistence implementation, have a look at:
https://github.com/AzureAD/microsoft-authentication-extensions-for-dotnet
- Home
- Why use MSAL.NET
- Is MSAL.NET right for me
- Scenarios
- Register your app with AAD
- Client applications
- Acquiring tokens
- MSAL samples
- Known Issues
- Acquiring a token for the app
- Acquiring a token on behalf of a user in Web APIs
- Acquiring a token by authorization code in Web Apps
- AcquireTokenInteractive
- WAM - the Windows broker
- .NET Core
- Maui Docs
- Custom Browser
- Applying an AAD B2C policy
- Integrated Windows Authentication for domain or AAD joined machines
- Username / Password
- Device Code Flow for devices without a Web browser
- ADFS support
- High Availability
- Regional
- Token cache serialization
- Logging
- Exceptions in MSAL
- Provide your own Httpclient and proxy
- Extensibility Points
- Clearing the cache
- Client Credentials Multi-Tenant guidance
- Performance perspectives
- Differences between ADAL.NET and MSAL.NET Apps
- PowerShell support
- Testing apps that use MSAL
- Experimental Features
- Proof of Possession (PoP) tokens
- Using in Azure functions
- Extract info from WWW-Authenticate headers
- SPA Authorization Code