@Radim Hampel Automation does not protect runbooks from a user reading the contents even with only read access, so an Automation account is not safe for IP protection in this case.
I would recommend using an Azure Function following this guide: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell?tabs=portal
Or, I would recommend using templates to deploy VM extensions that use a reference to your scripts in a storage account on your tenant. You can make the template authenticate privately with your storage account, so that a customer who even views the deployment won't be able to auth and retrieve your script: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-deploy-vm-extensions
------------------------------------------------------------------------------------------------------------------------------
Please do not forget to "Accept the answer" and "Up-Vote" wherever the information provided helps you to help others in the community.