File tree 2 files changed +73
-0
lines changed
2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Determine Current Linux Images
4
+ . NOTES
5
+ Author: Drew Burt
6
+ Date: 9-27-2020
7
+ Version: 0.0.1
8
+ Resources: https://medium.com/@gmusumeci/how-to-find-azure-linux-vm-images-for-terraform-or-packer-deployments-24e8e0ac68a
9
+ #>
10
+
11
+ $location = Read-Host - Prompt " Please enter the Azure Region you wish to search"
12
+
13
+ $LinuxDistros = [ordered ] @ {
14
+ Canonical = " Ubuntu" ;
15
+ RedHat = " RedHat" ;
16
+ Openlogic = " CentOS" ;
17
+ SuSE = " SUSE" ;
18
+ Debian = " credativ" ;
19
+ " Oracle Linux" = " Oracle-Linux" ;
20
+ CoreOS = " CoreOS"
21
+ }
22
+
23
+
24
+ " These are the Linux Distributions currently Supported in Azure: "
25
+
26
+ $LinuxDistros
27
+
28
+ $PublisherName = Read-Host - Prompt " Please select a publisher from the list"
29
+
30
+ # list Image publishers by region
31
+
32
+ $VMImageOffer = Get-AzVMImageOffer `
33
+ - Location $location `
34
+ - PublisherName $PublisherName
35
+
36
+ " Here are $PublisherName Offers for $Location `n "
37
+
38
+ $VMImageOffer.Offer
39
+
40
+ $ImageSkus = Get-AzVMImageSku `
41
+ - Location $location `
42
+ - PublisherName $PublisherName |
43
+ Select-Object Offer, Skus,
44
+
45
+ " Here are the Skus for $PublisherName in $Location `n "
46
+ $ImageSkus
Original file line number Diff line number Diff line change
1
+ <#
2
+ .Synopsis short script to update the terraform application
3
+ .Descriptiom
4
+ #>
5
+
6
+ # get the download uri
7
+ $URI = " https://www.terraform.io/downloads.html"
8
+
9
+ # scrape the links off the download page
10
+ $links = (Invoke-WebRequest - Uri $URI ).links.href
11
+
12
+ # extract the platform download link
13
+ ($downloadLInk = $links -match " _windows_amd64" )
14
+
15
+ # define the download location
16
+ $output = " C:\temp\terraform.zip"
17
+
18
+ Invoke-WebRequest - Uri " $downloadLInk " - OutFile $output
19
+
20
+ # change to the source diretory
21
+ Set-Location - Path " C:\Temp"
22
+
23
+ Expand-Archive - Path .\terraform.zip - DestinationPath " C:\terraform" - Force
24
+
25
+ # TODO: refactor to function
26
+ # TODO: test for install path
27
+ # TODO: make multiplatform create variable for platform link extraction
You can’t perform that action at this time.
0 commit comments