
Building Azure Pipeline to Start and Stop 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
