From 693b6a08094a9853180189ded5e8847087b4ab23 Mon Sep 17 00:00:00 2001 From: michawets <38206266+michawets@users.noreply.github.com> Date: Thu, 10 Dec 2020 08:17:43 +0100 Subject: [PATCH] added git, fixed clone location, fixed import of modules (#2202) Added git to the requirements Fixed clone location (as further is referenced to c:\ ) Fixed import of modules (current command gives error! ) --- help/CreateImageAndAzureResources.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/help/CreateImageAndAzureResources.md b/help/CreateImageAndAzureResources.md index 3401c1fce..b924eeaf9 100644 --- a/help/CreateImageAndAzureResources.md +++ b/help/CreateImageAndAzureResources.md @@ -13,6 +13,7 @@ After successful image generation, a snapshot of the temporary VM will be conver - `PowerShell 5.0 or higher` or `PSCore` for linux distributes. - `Azure CLI ` - https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest - `Azure Powershell module` - https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-4.6.1 +- `Git for Windows` - https://gitforwindows.org/ ### Azure DevOps self-hosted pool requirements To connect to a temporary VM packer use WinRM or SSH connections on public IP interfaces. @@ -39,15 +40,16 @@ Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI Download Virtual-Environments repository. ``` +Set-Location c:\ git clone https://github.com/actions/virtual-environments.git ``` Import [GenerateResourcesAndImage](helpers/GenerateResourcesAndImage.ps1) script from `/helpers` folder, and run `GenerateResourcesAndImage` function via Powershell. ``` -cd C:\virtual-environments +Set-Location C:\virtual-environments -Import-Module "helpers\GenerateResourcesAndImage.ps1" +Import-Module .\helpers\GenerateResourcesAndImage.ps1 GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "myTestResourceGroup" -ImageGenerationRepositoryRoot "$pwd" -ImageType Ubuntu1604 -AzureLocation "East US" ``` @@ -66,9 +68,9 @@ The function automatically creates all required Azure resources and kicks off pa After the successful image generation, Virtual Machine can be created from the generated VHD using [CreateAzureVMFromPackerTemplate](helpers/CreateAzureVMFromPackerTemplate.ps1) script. ``` -cd C:\virtual-environments +Set-Location C:\virtual-environments -Import-Module helpers\CreateAzureVMFromPackerTemplate.ps1 +Import-Module .\helpers\CreateAzureVMFromPackerTemplate.ps1 CreateAzureVMFromPackerTemplate -SubscriptionId {YourSubscriptionId} -ResourceGroupName {ResourceGroupName} -TemplateFile "C:\BuildVmImages\temporaryTemplate.json" -VirtualMachineName "testvm1" -AdminUsername "shady1" -AdminPassword "SomeSecurePassword1" -AzureLocation "eastus" ```