Automated Power Down Of Windows Virtual Machine Fails with Authorisation Issue

Cossy Cosmas 25 Reputation points
2025-04-14T10:28:31.1766667+00:00

I have created an automated task in Azure to power down a Windows 2019 Datacenter edition o/s server but it failed with the following error message:

{ "error": { "code": "AuthenticationFailed", "message": "Authentication failed. The 'Authorization' header is missing." }}

Does anyone know what might be causing the issue?

The automated tasks were created using a colleagues user account but that account should have sufficient privileges on all of the resources in the subscription.

Any advice appreciated!

Cossy

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,681 questions
{count} votes

Accepted answer
  1. anashetty 3,060 Reputation points Microsoft External Staff
    2025-04-15T10:42:35.29+00:00

    Hi Cossy Cosmas,

    Thank you for confirming. You don't require a script, these scheduled tasks utilize Azure Logic Apps or Azure Automation to execute the action. This means that authentication is still necessary, likely occurring through your Azure account credentials or a service principal established during the task setup.

    Check the role assignments in Azure portal: VM > Access control (IAM) > Role assignments
    See that you have Contributor role or Virtual Machine Contributor role.

    Recreate the Task with Proper Permissions: Delete the existing task from the VM > Automation > Tasks blade.
    Recreate the task using your own account, which is the recommended way, or A service account with Owner or Contributor rights. Ensure the identity creating the task has at least the Virtual Machine Contributor role.

    Check Microsoft.Compute Resource provider: Go to Subscriptions → Your subscription → Resource providers. Ensure Microsoft.Compute is registered. If not, click "Register"

    If you have any further queries, let me know. If the information is helpful, please click on Upvote.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.