Hi Veer Mayo,
For the first error message:
Provide a start date and time, which has a maximum of 49 years in the future and must follow the ISO 8601 date time specification in UTC date time format, but without a UTC offset: YYYY-MM-DDThh:mm:ss if you select a time zone -or- YYYY-MM-DDThh:mm:ssZ if you don't select a time zone So for example, if you want September 18, 2024 at 2:00 PM, then specify "2024-09-18T8:00:00" and select a time zone such as Pacific Standard Time. Or, specify "2024-09-18T8:00:00Z" without a time zone. Important: If you don't select a time zone, you must add the letter "Z" at the end without any spaces. This "Z" signifies a UTC time format with a UTC offset. If you select a time zone value, you don't need to add a "Z" to the end of your Start time value. If you do, Azure Logic Apps ignores the time zone value because the "Z" signifies a UTC time format.
https://learn.microsoft.com/en-us/azure/connectors/connectors-native-recurrence?tabs=consumption
Second error if your User Id is in a different Tenant than the VM you get an Authorization (401) error (InvalidAuthenticationTokenTenant).
Change Connection:
- Enable Managed Identities for the Logic App
- Add a new role assignment in the VMs Access Control (IAM) section for the Logic App
- Update the Start virtual machine task in the Logic App to connect using the managed identity
https://learn.microsoft.com/en-us/answers/questions/405123/azure-logic-app-azure-vm-connector-invalidauthenti
Another way: Connect with Service Principal: this option will execute this Logic App using a specific Service Principal and strongly recommended.
- if you want to create a Service Principal just follow the steps here: https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal
- Don't forget to assign permission to allow this Service Principal on the Resource Group to manage virtual machines. You can use the built-in role Virtual Machine Contributor.
This document gives you a detailed explanation on how to create Stop/Start VMs on Azure using Logic Apps: https://github.com/fabioharams/stopstart-logicapps
https://learn.microsoft.com/en-us/azure/azure-functions/start-stop-vms/deploy
Hope this helps!