Hi @PhilippGerber-6516,
Yes, it is possible to activate the Azure VM AutoShutdown function with an Azure Policy. I have tested it in my subscription with this policy. For illustration, you may refer all the below screenshots.
To clarify around "DevTest lab" that you have mentioned, currently the schedule that gets created when we enable AutoShutdown function for an Azure VM is of type "Microsoft.devtestlab/schedules" hence it is mentioned in the above referred policy in the same way but it works for Azure VMs.
To double check the same, I have created a new Azure VM and enabled AutoShutdown function while creating the VM itself and then I have tried to get the type of the AutoShutdown schedule using Azure PowerShell as shown below.
$subscriptionId = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
$ResourceGroupName = "xxxxxxxxxx"
$VMName = "xxxxxxxxxxxxx "
$shutdownResource = Get-AzResource -ResourceId "/subscriptions/$subscriptionId/resourceGroups/$ResourceGroupName/providers/microsoft.devtestlab/schedules/shutdown-computevm-$VMName"
$shutdownResource.Properties
$shutdownResource.Properties.dailyRecurrence
Later I have assigned the above mentioned policy and then I have created another Azure VM without enabling AutoShutdown function and have waiting until the schedule time thats mentioned in the policy and then I could see that AutoShutdown is enabled automatically with the help of the policy.