Skip to content

Instantly share code, notes, and snippets.

@alventech
alventech / Packer_w10_20h2_SIG.pkr.hcl
Created December 25, 2021 18:53
Packer_w10_20h2_SIG_HCL2
# This file was autogenerated by the 'packer hcl2_upgrade' command. We
# recommend double checking that everything is correct before going forward. We
# also recommend treating this file as disposable. The HCL2 blocks in this
# file can be moved to other files. For example, the variable blocks could be
# moved to their own 'variables.pkr.hcl' file, etc. Those files need to be
# suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at
# once they also need to be in the same folder. 'packer inspect folder/'
# will describe to you what is in that folder.
# Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` )
@alventech
alventech / LogAnalytics-hb
Created July 20, 2021 08:11
LogAnalytics-hb
Heartbeat
| where Computer like "wvd"
| summarize arg_max(TimeGenerated, * ) by Computer
@alventech
alventech / Packer_w10_20h2_SIG.json
Last active May 30, 2021 09:42
Packer_w10_20h2_SIG
{
"variables": {
"clientAPPID": "",
"clientSecret": "",
"tenantid": "",
"subscriptionid": "",
"image_version" : "",
"WorkingDirectory": "{{env `System_DefaultWorkingDirectory`}}"
},
@alventech
alventech / packer_devops_pipeline.yaml
Last active May 30, 2021 09:44
packer_azure_devops_pipeline
# Variable Group 'wvd-packer-vars' was defined in the Variables tab
# Variable Group 'wvd-kv' was defined in the Variables tab
resources:
repositories:
- repository: self
type: git
ref: main
jobs:
- job: Job_1
displayName: Agent job 1
@alventech
alventech / azcli_packer_build.sh
Last active May 30, 2021 16:24
Azure CLI Packer Build Azure DevOps
packer --version
export subscriptionid=$(subscriptionid)
export clientAPPID=$(clientAPPID)
export clientSecret=$(clientSecret)
export tenantid=$(tenantid)
echo $subscriptionid
echo $clientSecret
echo $clientAPPID
@alventech
alventech / AzureVMImageBuilderTask.yaml
Last active April 23, 2021 11:30
Azure VM Image Builder Task
steps:
- task: AzureImageBuilder.devOps-task-for-azure-image-builder.custom-build-release-task.AzureImageBuilderTask@1
displayName: 'Azure VM Image Builder Task'
inputs:
managedIdentity: '/subscriptions/0000-0000-000-0000-00000000/resourceGroups/AIB_Managed_Identity/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-aib-poc'
imageSource: marketplace
baseImage: 'MicrosoftWindowsDesktop:Windows-10:19h1-evd'
baseImagePubOfferSku: 'MicrosoftWindowsDesktop:windows-10:20h2-evd '
provisioner: powershell
windowsUpdateProvisioner: true
@alventech
alventech / id-aib-custom-role.json
Created April 23, 2021 10:01
Azure Image Builder Custom Role
{
"Name": "Azure Image Builder Service Image Creation Role",
"IsCustom": true,
"Description": "AIB access to create resources for the image build, you should delete or split out as appropriate",
"Actions": [
"Microsoft.Compute/galleries/read",
"Microsoft.Compute/galleries/images/read",
"Microsoft.Compute/galleries/images/versions/read",
"Microsoft.Compute/galleries/images/versions/write",
@alventech
alventech / RdsRegistrationInfotoken.ps1
Last active June 16, 2021 17:15
RdsRegistrationInfotoken.ps1
# ARM RdsRegistrationInfotoken Used by arm parameter hostpoolToken
# Get RdsRegistrationInfotoken
# Import Modules for WVD
import-module az.desktopvirtualization
import-module az.network
import-module az.compute
$azureSubscriptionID = "your-wvd-sub-id"
$resourceGroupName = "rg-wvd-Pooled-desktop"
"hostpoolName"
"hostpoolFriendlyName"
"hostpoolDescription"
"location"
"workSpaceName"
"workspaceLocation"
"workspaceResourceGroup"
"allApplicationGroupReferences"
"addToWorkspace"
"administratorAccountUsername"
@alventech
alventech / createtokenExpirationTime.ps1
Last active June 2, 2021 10:47
createtokenExpirationTime.ps1
# ARM tokenExpirationTime
# The expiration date can be no less than an hour and no more than one month.
# If you set tokenExpirationTime outside of that limit, it wont work.
# tokenExpirationTime is used to generate token for WVD hostpool
# https://docs.microsoft.com/en-us/powershell/module/az.desktopvirtualization/new-azwvdhostpool?view=azps-4.8.0
$ExpirationTime = $((get-date).ToUniversalTime().AddDays(1).ToString('yyyy-MM-ddTHH:mm:ss.fffffffZ'))
Write-Host "$("##vso[task.setvariable variable=ExpirationTime]")$($ExpirationTime)"