lingdanglfw(DAX)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

D365FO Tool – Automating Start and Stop Environments

 

 

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&#8221; | 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

posted on   lingdanglfw  阅读(121)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示