Cloud can be tricky sometimes. Find out what scenarios we've ran into that are worth being mentioned and explained.
Here is the code for the Bicep template with Run Commands:
resource runCommandsVM 'Microsoft.Compute/virtualMachines/runCommands' = {
name: 'runCommandsVM',
location: resourceGroup().location,
properties: {
commands: [
{
script: 'Write-Output "Set registry keys"'
commandId: 'SetRegistryKeys',
properties: {
registry: [
{
key: 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server',
valueName: 'DisabledByDefault',
valueData: '0xffffffff',
valueType: 'Dword'
}
]
}
}
],
vm: {
id: vm.id
}
}
}
And here is the code with the script uploaded to a storage account:
resource runCommandsVM 'Microsoft.Compute/virtualMachines/runCommands' = {
name: 'runCommandsVM',
location: resourceGroup().location,
properties: {
commands: [
{
scriptUri: 'https://{storageAccountName}.blob.core.windows.net/{containerName}/{scriptName}.ps1?{SAS-token}',
commandId: 'SetRegistryKeys'
}
],
vm: {
id: vm.id
}
}
}