-
Notifications
You must be signed in to change notification settings - Fork 102
How To Authenticate With LCS API
The LCS (Lifecycle Services) API authentication will enable you to use the functionality provided by the LCS API.
This how-to will guide you on how to authenticate with the LCS API using the d365fo.tools and persist the LCS API details on your machine. This way you don't need to remember the finer details when you start using other cmdlets of the d365fo.tools that make use of the LCS API.
- PowerShell 5.1
- d365fo.tools module installed
- d365fo.tools module loaded into a PowerShell session
- User account without MFA enabled
- Should already be able to log into LCS and be part of the project
- Registered Application in the Azure AD
- Needs to have the "Dynamics Lifecycle services" permission assigned and granted/consented
- LCS Project Id
Please visit the Install as an Administrator or the Install as a Non Administrator tutorials to learn how to install the tools.
Please visit the Import d365fo.tools module tutorial to see the different ways you can load the d365fo.module into a PowerShell session.
To learn more about the prerequisites for this how-to, you should visit Adrià Ariste's blog - more specific the following guide, chapter "Release Pipelines" & chapter "LCS DB API"
For you to be able to communicate with the LCS API, you will need an username, password and a registered application. As mentioned in the prerequisites, you should read the blog post from Adrià Ariste.
The following script will:
- Test that your username, password and registered application is working
- Store the authentication token and registered application along with the LCS project id
# We will start by testing that we can obtain a valid OAuth token, to make sure our details are correct
Get-D365LcsApiToken -ClientId "e70cac82-6a7c-4f9e-a8b9-e707b961e986" -Username "[email protected]" -Password "fT1DHcLdeTWC9aumugHr" -LcsApiUri "https://lcsapi.lcs.dynamics.com"
# Now we are going to save the details, the refresh token, the registered application and the project id
Get-D365LcsApiToken -ClientId "e70cac82-6a7c-4f9e-a8b9-e707b961e986" -Username "[email protected]" -Password "fT1DHcLdeTWC9aumugHr" -LcsApiUri "https://lcsapi.lcs.dynamics.com" | Set-D365LcsApiConfig -ProjectId "123456789" -ClientId "e70cac82-6a7c-4f9e-a8b9-e707b961e986"
So now you will have the authentication token, the registered application and the project id persisted on your machine, which will enable different cmdlets to utilize them going forward.
- Install as a non-Administrator
- Install as a Administrator
- Import d365fo.tools module
- List available commands from d365fo.tools module
- Get help content for a command
- Start, Stop and List services
- Import users into the D365FO environment
- Import external users into the D365FO environment
- Enable users in the D365FO environment
- Update users in the D365FO environment
- Provision D365FO environment to new Azure AD tenant
- Import a bacpac file into a Tier1 environment
- List modules / models
- Compile module
- Install AzCopy
- Install SqlPackage
- Install Nuget
- Speed up LCS download via AzCopy
- Download latest bacpac from LCS via AzCopy
- Register NuGet source
- Configure Azure Logic App
- Fix AzureStorageConfig
- Run a runnable class
- Update users in environment
- Work with Azure Storage Account
- Work with packages, resource label files, language and lables
- Working with the different D365 services