标签:lcs D365FO ProjectId Tool lcsapi https dynamics com Automating
If you have Tier1 environments in your project and you would like to automate the starting and stopping of them then Use #d365fotools and get on with your work. two new commands Invoke-D365LcsEnvironmentStart and Invoke-D365LcsEnvironmentStop available in d365 tools (GitHub – richardsondev/d365fo.tools: Tools used for Dynamics 365 Finance and Operations)— Install d365fo.tools on power shell. Install-Module -Name d365fo.tools — Get LCS API Token and saveLCS API Config variables Get-D365LcsApiToken -ClientId “a56e047a-188c-xxxxxxxxxxx” -Username “serviceaccount@domain.onmicrosoft.com” -Password “strongPassword” -LcsApiUri “https://lcsapi.lcs.dynamics.com” | Set-D365LcsApiConfig -ProjectId 1350683-Username, -Password : Service account that should have access to LCS project and MFA should be disabled and should not be Federated authentication account (this is to avoid error) -ClientId : link below is to create the app registration on azure portal, with permission set as shown in picture below. https://docs.microsoft.com/en-us/graph/auth-register-app-v2-LcsApiUri – URI / URL to the LCS API you want to use Depending on whether your LCS project is located in europe or not, there is 2 valid URI’s / URL’s Valid options: “https://lcsapi.lcs.dynamics.com” “https://lcsapi.eu.lcs.dynamics.com” “https://lcsapi.fr.lcs.dynamics.com” “https://lcsapi.sa.lcs.dynamics.com” “https://lcsapi.uae.lcs.dynamics.com” “https://lcsapi.lcs.dynamics.cn“ — This is to stop the environment Invoke-D365LcsEnvironmentStop -ProjectId 1350683 -EnvironmentId “782f99fe-cad6-467b-860f-xxxxxxx” — This is to start the environment Invoke-D365LcsEnvironmentStart -ProjectId 1350683 -EnvironmentId “782f99fe-cad6-467b-860f-xxxxxx” -Projectid , -EncironmentId: This can get from LCS Project, Project settings page.
Building Azure Pipeline to Start and Stop the VM
You can create a build pipeline and just add a Powershell task and add the script to start the VM
Install-PackageProvider nuget -Scope CurrentUser -Force -Confirm:$false
Install-Module -Name AZ -AllowClobber -Scope CurrentUser -Force -Confirm:$False -SkipPublisherCheck
Install-Module -Name d365fo.tools -AllowClobber -Scope CurrentUser -Force -Confirm:$false
Get-D365LcsApiToken -ClientId "a56e047a-188c-xxxx-xxxxxxxxxx" -Username "serviceaccount@domain.onmicrosoft.com" -Password "password" -LcsApiUri "https://lcsapi.lcs.dynamics.com" | Set-D365LcsApiConfig -ProjectId 1350683
Invoke-D365LcsEnvironmentStart -ProjectId 1350683 -EnvironmentId "782f99fe-cad6-467b-xxxxxxxxxxx"
Scheduled can be defined on azure pipeline to start and stop the VM
标签:lcs,D365FO,ProjectId,Tool,lcsapi,https,dynamics,com,Automating 来源: https://www.cnblogs.com/lingdanglfw/p/15202664.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。