Skip to content

Commit

Permalink
AVD init script - always execute (#105)
Browse files Browse the repository at this point in the history
* AVD init script - always execute

* Update
  • Loading branch information
fraliv13 authored Dec 18, 2024
1 parent 7ae01a4 commit 0f3af63
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"
"time"

"github.com/google/uuid"
"github.com/pulumi/pulumi-azure-native-sdk/authorization/v2"
"github.com/pulumi/pulumi-azure-native-sdk/compute/v2"
"github.com/pulumi/pulumi-azure-native-sdk/desktopvirtualization/v2"
Expand Down Expand Up @@ -297,13 +298,16 @@ func NewAzureVirtualDesktopVM(ctx *pulumi.Context, name string, args *AzureVirtu
})
}

// Append a forceUpdateTag line to ensure the script is always executed
initScript := args.Spec.InitScript + fmt.Sprintf("\n# Force update tag: %s\n", uuid.New().String())

_, err = compute.NewVirtualMachineRunCommandByVirtualMachine(ctx, fmt.Sprintf("%s-init-cmd", name), &compute.VirtualMachineRunCommandByVirtualMachineArgs{
ResourceGroupName: args.ResourceGroupName,
VmName: avdVM.VirtualMachine.Name,
AsyncExecution: pulumi.Bool(false),
RunCommandName: pulumi.String("InitVM"),
Source: compute.VirtualMachineRunCommandScriptSourceArgs{
Script: pulumi.String(args.Spec.InitScript),
Script: pulumi.String(initScript),
},
Parameters: params,
TimeoutInSeconds: pulumi.Int(60),
Expand Down

0 comments on commit 0f3af63

Please sign in to comment.