Thanks for reaching out to Q&A.
Here are some steps to troubleshoot/mitigate 503 errors in Functions:
- Launch the hostname url (appname.azurewebsites.net) and check if the app is running or not.
- If the app isnt running, try restarting the app.
- Open the Diagnose and solve problems blade and run the "Function app down or reporting errors" detector. It should give you some insights.
- Sometimes we see 503 error when there some issues with the powershell script.
In order to manage resources in your subscription from the Azure functions, you will have to enable system assigned MSI for the function and provide contributor access to the Function app's MSI.
If you are going to use function app to just start/stop VM, we already have a feature for it : https://learn.microsoft.com/en-us/azure/azure-functions/start-stop-vms/overview
Please note that, this feature is still in preview.
I hope this helps!
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.