Open BernieWhite opened 2 years ago
In case it helps, this is the messy and inefficient script I used for the current version:
az login
$linuxOfferingsFilePath = "LinuxOfferings.ps1"
New-Item $linuxOfferingsFilePath
$allOfferingsRaw = Get-Content "allOfferings.txt" # Info obtained with: az vm image list --all (takes a while)
$allOfferings = $allOfferingsRaw | ConvertFrom-Json
$processedOffers = New-Object System.Collections.Generic.HashSet[string]
Add-Content $linuxOfferingsFilePath "`$global:LinuxOffers = @("
foreach ($offering in $allOfferings)
{
$newOffer = "(`"$($offering.publisher)`", `"$($offering.offer)`"),"
if (!$processedOffers.Contains($newOffer)) {
$processedOffers.Add($newOffer)
$offeringInfo = $(az vm image show --urn $offering.urn) | ConvertFrom-Json
if($offeringInfo.osDiskImage.operatingSystem -eq "Linux") {
Add-Content $linuxOfferingsFilePath $newOffer
}
}
}
Add-Content $linuxOfferingsFilePath "(`"`",`"`"))"
As PR #1701 calls out. We will need to get a list of offers for Linux VMs to better scope/ configure some Linux specific rules.
Let's look for ways to include update of offers as a CI process, similar to what we do with provider data.
https://github.com/Azure/PSRule.Rules.Azure/blob/main/scripts/providers.psm1 https://github.com/Azure/PSRule.Rules.Azure/blob/main/.github/workflows/providers.yml