Running the azure-team terraform make file to create your infrastructure may not work on a Windows machine. If you cannot get it to run, install a linux distribution where you will exectute the tf files. Setting up a distribution with all of the right dependencies does involve a bit of setup to get it configured properly. The following is a list of steps you'll need to complete:
- Install WSL
- Change the mount point from /mnt/c to /c
- Install homebrew
- Set up git credential manager
- Install sqlcmd
- https://docs.microsoft.com/en-us/windows/wsl/install-win10
- https://docs.microsoft.com/en-us/windows/wsl/initialize-distro
-
Enable WSL for windows by running the following commands in an elevated powershell session:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
-
Restart your machine.
-
Install the linux distribution of choice (Ubuntu 18.04 LTS is what these steps were developed with).
- If the windows store is enabled, install your distribution from there.
- Otherwise you can do a manual installation by following these instructions.
-
After installation, open Ubuntu (or the distribution you installed) and let it initialize itself.
- You'll need to set a username and password.
- When you use the
sudo
command you'll be prompted for this password.
-
Once initialized do an update and upgrade.
sudo apt update && sudo apt upgrade
-
Enable and default WSL2 by running the following commands in an elevated powershell session (Currently only on Windows Insiders Slow Track)
wsl --set-version <distro> 2
wsl --list --verbose
to verifywsl --set-default-version 2
This step is optional but it makes it more convenient when running the terraform files if your linux and windows file structures match.
- https://gist.github.com/sgtoj/f82990bcd9e89db49b84e2d2e70b281d
- https://docs.microsoft.com/en-us/windows/wsl/wsl-config
- Start Ubuntu (or your other installed distribution)
- Run this command to open the nano text editor:
sudo nano /etc/wsl.conf
- Paste this snippet at the bottom of the file:
# Enable extra metadata options by default [automount] enabled = true root = / options = "metadata,umask=22,fmask=11" mountFsTab = false # Enable DNS – even though these are turned on by default, we’ll specify here just to be explicit. [network] generateHosts = true generateResolvConf = true
- Press
Ctrl + O
to save the changes, thenCtrl + X
to exit the editor - Restart the WSL service by running
Restart-Service -Name "LxssManager"
in an elevated powershell session
This step is optional but it makes it significantly easier to install all of the required dependencies. If you'd rather install those manually, skip this step
- In Ubuntu (or your other distribution), run the following command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
- Add homebrew to your path:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv) test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) test -r ~/.bash_profile && echo "test -f $(brew --prefix)/bin/brew && eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile echo "test -f $(brew --prefix)/bin/brew && eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
- Then run:
sudo apt-get install build-essential curl file git
This is optional but it keeps you from having to enter git username/password each time.
In Ubuntu run this command:
git config --global credential.helper "/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe"
In Ubuntu (or your installed distribution) run the following commands:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev
sudo apt-get update
sudo apt-get install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
The location for the GCM moved in Git for Windows v2.36.0. It is now located at
/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe
. (If you are changing the mount point, it would be/c/Program\ Files/Git/mingw64/bin/git-credential-manager-core.exe
.)release notes: https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#new-features-1
pull request: git-for-windows/build-extra#406