Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rezamt
rezamt / hashtable-example.ps1
Created June 1, 2018 01:34
Powershell HashTable Iteration
How to Iterate and find the keys and values inside: System.Collection.Hashtable
# System.Collections.Hashtable
# Accessing Keys and Values using Enumerator
(Get-AzureKeyVaultSecret -VaultName $KeyVaultName | Where 'ContentType' -eq 'Wrapped BEK').Tags | foreach {
foreach ($tag in $_.GetEnumerator())
{
if ($tag.Key -eq 'MachineName' -and $tag.Value -eq $VMName) {
Write-Host "$($tag.Key) = $($tag.Value)"
@giseongeom
giseongeom / example_packer_template.json
Last active March 2, 2024 22:24
packer template (sysprep-safe)
{
"variables": {
"client_id": "{{env `AZURE_CLIENT_ID`}}",
"client_secret": "{{env `AZURE_CLIENT_SECRET`}}",
"subscription_id": "{{env `AZURE_SUBSCRIPTION_ID`}}",
"tenant_id": "{{env `AZURE_TENANT_ID`}}",
"spn_object_id": "{{env `AZURE_SPN_OBJECT_ID`}}",
"resource_group": "{{env `AZURE_BUILD_RESOURCE_GROUP`}}",
"resource_location": "{{env `AZURE_BUILD_LOCATION`}}",
"storage_account": "{{env `AZURE_BUILD_STORAGE_ACCOUNT`}}",