diff --git a/docs/basic_linux/readme.md b/docs/basic_linux/readme.md index e69de29..50a28eb 100644 --- a/docs/basic_linux/readme.md +++ b/docs/basic_linux/readme.md @@ -0,0 +1,12 @@ +# Basic Linux Machine +This scenario will build an Ubuntu 16.04 machine. + +Before you attempt this scenario, ensure you have followed the [getting started docs](../../readme.md#getting-started). + +## Vagrant up +- In this directory, run the following + ```bash + vagrant up --provider=azure + ``` + +To clean up, run `vagrant destroy` \ No newline at end of file diff --git a/docs/basic_windows/readme.md b/docs/basic_windows/readme.md index e69de29..511e99a 100644 --- a/docs/basic_windows/readme.md +++ b/docs/basic_windows/readme.md @@ -0,0 +1,12 @@ +# Basic Windows SQL Server 2016 Machine +This scenario will build a Windows SQL Server 2016 machine. + +Before you attempt this scenario, ensure you have followed the [getting started docs](../../readme.md#getting-started). + +## Vagrant up +- In this directory, run the following + ```bash + vagrant up --provider=azure + ``` + +To clean up, run `vagrant destroy` \ No newline at end of file diff --git a/docs/custom_vhd/readme.md b/docs/custom_vhd/readme.md index 346bb2e..f13d4b8 100644 --- a/docs/custom_vhd/readme.md +++ b/docs/custom_vhd/readme.md @@ -13,24 +13,24 @@ If you wanted to build a more customized image, you could do the same with your ## Vagrant up We will set this up with Azure CLI and then run Vagrant after we've provisioned the needed Azure resources. - Login to Azure CLI (if not already logged in) - ```sh + ```bash az login ``` - Create a resource group for your VHDs (assuming westus) - ```sh + ```bash az group create -n vagrantimages -l westus ``` - Create a storage account in the region you'd like to deploy - ```sh + ```bash # insert your own name for the storage account DNS name (-n) az storage account create -g vagrantimages -n vagrantimagesXXXX --sku Standard_LRS -l westus ``` - Download and unzip the VHD from Ubuntu - ```sh + ```bash wget -qO- -O tmp.zip http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.vhd.zip && unzip tmp.zip && rm tmp.zip ``` - Upload the VHD to your storage account in the vhds container - ```sh + ```bash conn_string=$(az storage account show-connection-string -g vagrantimages -n vagrantimagesXXXX -o tsv) az storage container create -n vhds --connection-string $conn_string az storage container create -n vhds vagrantimagesXXXX diff --git a/docs/data_disks/readme.md b/docs/data_disks/readme.md index 2c44b41..98a5755 100644 --- a/docs/data_disks/readme.md +++ b/docs/data_disks/readme.md @@ -1,43 +1,20 @@ # Linux Machine with Empty Data Disks This scenario will build an Ubuntu 16.04 machine with data disks attached to the virtual machine. -To see more information about this scenario, see [Prepare an Ubuntu virtual machine for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-ubuntu) +To see more information about this scenario, see [How to Attach a Data Disk to a Linux VM](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk) Before you attempt this scenario, ensure you have followed the [getting started docs](../../readme.md#getting-started). -If you wanted to build a more customized image, you could do the same with your own VHD manually by following these -[instructions](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-ubuntu?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#manual-steps). +*Note: data disk support is preview and will likely change before becoming stable* ## Vagrant up -We will set this up with Azure CLI and then run Vagrant after we've provisioned the needed Azure resources. -- Login to Azure CLI (if not already logged in) - ```sh - az login - ``` -- Create a resource group for your VHDs (assuming westus) - ```sh - az group create -n vagrantimages -l westus - ``` -- Create a storage account in the region you'd like to deploy - ```sh - # insert your own name for the storage account DNS name (-n) - az storage account create -g vagrantimages -n vagrantimagesXXXX --sku Standard_LRS -l westus - ``` -- Download and unzip the VHD from Ubuntu - ```sh - wget -qO- -O tmp.zip http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.vhd.zip && unzip tmp.zip && rm tmp.zip - ``` -- Upload the VHD to your storage account in the vhds container - ```sh - conn_string=$(az storage account show-connection-string -g vagrantimages -n vagrantimagesXXXX -o tsv) - az storage container create -n vhds --connection-string $conn_string - az storage container create -n vhds vagrantimagesXXXX - az storage blob upload -c vhds -n xenial-server-cloudimg-amd64-disk1.vhd -f xenial-server-cloudimg-amd64-disk1.vhd --connection-string $conn_string - ``` -- Update Vagrantfile with the URI of your uploaded blob (`azure.vm_vhd_uri`). -- Vagrant up +- In this directory, run the following ```bash vagrant up --provider=azure ``` +- The Vagrant file specifies on data disk named foo. The foo disk is not formatted, nor mounted. If you + would like to use the disk, you will need to format and mount the drive. For instructions on how to do that, + see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linux. + In the next rev of data disks, we'll handle mounting and formatting. To clean up, run `vagrant destroy` \ No newline at end of file diff --git a/docs/managed_image/Vagrantfile b/docs/managed_image/Vagrantfile index 14e683b..c9b0acf 100644 --- a/docs/managed_image/Vagrantfile +++ b/docs/managed_image/Vagrantfile @@ -7,7 +7,8 @@ Vagrant.configure("2") do |config| config.vm.provider :azure do |azure, override| azure.location = "westus" - azure.vm_managed_image_id = "https://vagrantimages.blob.core.windows.net/vhds/sample.vhd" + # replace this with your managed image resource id + azure.vm_managed_image_id = "/subscriptions/{subscription_id}/resourceGroups/{group}/providers/Microsoft.Compute/images/{image_name}" end config.vm.provision "shell", inline: "echo Hello, World" diff --git a/docs/managed_image/readme.md b/docs/managed_image/readme.md index e69de29..10ccb8c 100644 --- a/docs/managed_image/readme.md +++ b/docs/managed_image/readme.md @@ -0,0 +1,66 @@ +# Ubuntu Machine from a Captured Managed Image +This scenario will build a machine from a captured managed image. We will build a VM with Azure CLI, capture +an image of the VM and use that image reference for a new Vagrant machine. + +To see more information about this scenario, see [Create a VM from the captured image](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image#step-3-create-a-vm-from-the-captured-image) + +Before you attempt this scenario, ensure you have followed the [getting started docs](../../readme.md#getting-started). + +## Vagrant up +We will set this up with Azure CLI and then run Vagrant after we've provisioned the needed Azure resources. +- Login to Azure CLI (if not already logged in) + ```bash + az login + ``` +- Create a resource group for your VHDs (assuming westus) + ```bash + az group create -n vagrant -l westus + ``` +- Create a new VM + ```bash + az vm create -g vagrant -n vagrant-box --admin-username deploy --image UbuntuLTS + ``` +- Capture an image of the VM + ```bash + az vm deallocate -g vagrant -n vagrant-box + az vm generalize -g vagrant -n vagrant-box + az image create -g vagrant --name vagrant-box-image --source vagrant-box + ``` + You should see json output from the `az image create` command. Extract the "id" value from below for use in your Vagrantfile. + ```json + { + "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/resourceGroups/vagrant/providers/Microsoft.Compute/images/vagrant-box-image", + "location": "westus", + "name": "vagrant-box-image", + "provisioningState": "Succeeded", + "resourceGroup": "vagrant", + "sourceVirtualMachine": { + "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/resourceGroups/vagrant-test/providers/Microsoft.Compute/virtualMachines/vagrant-box", + "resourceGroup": "vagrant" + }, + "storageProfile": { + "dataDisks": [], + "osDisk": { + "blobUri": null, + "caching": "ReadWrite", + "diskSizeGb": null, + "managedDisk": { + "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/resourceGroups/vagrant-test/providers/Microsoft.Compute/disks/osdisk_5ZglGr7Rj4", + "resourceGroup": "vagrant" + }, + "osState": "Generalized", + "osType": "Linux", + "snapshot": null + } + }, + "tags": null, + "type": "Microsoft.Compute/images" + } + ``` +- Update the Vagrantfile in this directory with the URI of your managed image resource (`azure.vm_managed_image_id`). +- Vagrant up + ```bash + vagrant up --provider=azure + ``` + +To clean up, run `vagrant destroy` \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md index fd3c208..2e602e3 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -7,15 +7,15 @@ Before you attempt any scenario, ensure you have followed the [getting started d ## Scenarios ### [Basic Linux Setup](./basic_linux) -Setup a simple Ubuntu box +Setup a simple Ubuntu 16.04 machine ### [Basic Windows Setup](./basic_windows) -Setup a Windows Server box +Setup a Windows SQL Server 2016 machine ### [Ubuntu Xenial Machine from VHD](./custom_vhd) -Setup an Ubuntu box from a custom image +Setup an Ubuntu box from a custom VHD -### [Managed Image Reference](./managed_image_reference) +### [Managed Image Reference](./managed_image) Setup a VM from a managed image reference captured from a previously created Azure VM. ### [Data Disks (empty disk)](./data_disks)