Dmitry Porotnikov / Bicep: Execute a RunCommand on already running Azure Virtual Machine

Created Sun, 27 Aug 2023 17:09:56 +0000 Modified Sun, 27 Aug 2023 17:09:56 +0000
37 Words

Bicep: Execute a RunCommand on already running Azure Virtual Machine

param vmName string
param location string
//https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/2022-11-01/virtualmachines/runcommands?pivots=deployment-language-bicep
resource runCommand 'Microsoft.Compute/virtualMachines/runCommands@2022-11-01' = {
  name: '${vmName}/runPowerShellCommand'
  location: location
  properties: {
    source: {
      script: 'Write-Host "Hello World"'
    }
  }
}