---
title: Preparing the VM
description: The VHD image you download can be used as a developer VM with no additional work, just run Visual Studio, connect it to your AZDO project and done. But if you want to use it as a build box you…
url: "https://ariste.info/dynamics365almguide/preparing-the-vm/"
updated: "2024-08-25"
category: Legacy Guide / Azure DevTest Labs powered builds
---

# Preparing the VM

The VHD image you download can be used as a developer VM with no additional work, just run Visual Studio, connect it to your AZDO project and done. But if you want to use it as a build box you need to do several things first.

Remember that the default user and password for these VHDs are Administrator and Pass@word1.

#### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#disable-services](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#disable-services)Disable services

First of all we will stop and disable services like the Batch, Management Reporter, SSAS, SSIS, etc. Anything you see that’s not needed to run a build.

#### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#create-a-new-sql-user](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#create-a-new-sql-user)Create a new SQL user

Open [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15&WT.mc_id=BA-MVP-5003976) (as an Administrator) and create a new SQL user as a copy of the axdbadmin one. Then open the web.config file and update the DB user and password to use the one you’ve just created.

#### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#prepare-ssrs-optional](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#prepare-ssrs-optional)Prepare SSRS (optional)

If you want to deploy reports as part of your build pipeline you need to go to SSMS again (and as an Admin again), and open a new query in the reporting DB to execute the following query:

```
exec DeleteEncryptedContent
```

#### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#powershell-scripts](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#powershell-scripts)PowerShell Scripts

The default build definition that runs on a build VM uses several PowerShell scripts to run some tasks. I’m adding an additional script called PrepareForAgent.

The scripts can be found in the C:\DynamicsSDK folder of the VM.

##### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#prepareforbuild](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#prepareforbuild)PrepareForBuild

This script comes with the VM and **we need to modify it** to avoid one thing: the PackagesLocalDirectory backup which is usually done in the first build. We need to get rid of this or we’ll waste around an hour per run until the files are copied.

We don’t need this because our VM will be new each time we run the pipeline!

So open the script, go to line 696 and look for this piece of code:

```
# Create packages backup (if it does not exist).$NewBackupCreated = Backup-AX7Packages -BackupPath $PackagesBackupPath -DeploymentPackagesPath $DeploymentPackagesPath -LogLocation $LogLocation # Restore packages backup (unless a new backup was just created).if (!$NewBackupCreated){    Restore-AX7Packages -BackupPath $PackagesBackupPath -DeploymentPackagesPath $DeploymentPackagesPath -LogLocation $LogLocation -RestoreAllFiles:$RestorePackagesAllFiles}    if (!$DatabaseBackupToRestore){    $DatabaseBackupPath = Get-BackupPath -Purpose "Databases"    Backup-AX7Database -BackupPath $DatabaseBackupPath}else{    # Restore a database backup (if specified).    Restore-AX7Database -DatabaseBackupToRestore $DatabaseBackupToRestore}
```

We need to modify it until we end up with this:

```
if ($DatabaseBackupToRestore){    Restore-AX7Database -DatabaseBackupToRestore $DatabaseBackupToRestore}
```

We just need the DB restore part and skip the backup, otherwise we’ll be losing 45 minutes in each run for something we don’t need because the VM will be deleted when the build is completed.

#### [http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#optional-but-recommended-install-d365fo-tools](http://ariste.info/en/msdyn365-azure-devops-alm/?preview_id=955&preview_nonce=20b305adad&preview=true&_thumbnail_id=2694#optional-but-recommended-install-d365fo-tools)**Optional (but recommended)**: install [d365fo.tools](https://github.com/d365collaborative/d365fo.tools)

Just run this:

```
Install-Module -Name d365fo.tools
```

We can use the tools to do a module sync, partial sync or deploy just our reports instead of all.

#### Subscribe!

Receive an email when a new post is published
