Hello Mark Caple,
Thank you for posting your question in the Microsoft Q&A forum.
The error indicates your account lacks permissions for Microsoft.Automation/register/action, which is unrelated to the Compute Gallery access but required for Azure resource provider operations. While your Compute Gallery Image Reader role grants image access, the CLI attempts to register the Microsoft.Automation provider during VM creation a step the Portal might handle implicitly.
Solution Steps:
- Register the Automation Provider manually:
bash
az provider register --namespace Microsoft.Automation --subscription [Subscription-ID]
Wait 5–10 minutes for propagation.
- Grant Additional Permissions: Request a subscription Owner or Contributor to assign:
bash
*az role assignment create --assignee [your-object-id] * *--role "Contributor" * --scope "/subscriptions/[Subscription-ID]"
Alternatively, request Microsoft.Automation/register/action via a custom role.
- Retry with Explicit Subscription: Ensure your CLI session targets the correct subscription:
bash
az account set --subscription [Subscription-ID] az vm create ... (original command)
Why This Occurs:
- The Portal auto-registers providers, while the CLI requires explicit permissions.
- Compute Gallery Image Reader only covers image access, not VM deployment dependencies.
If issues persist, verify Azure Policy isn’t blocking provider registration or VM creation. For immediate resolution, use the Portal or escalate permissions temporarily.
Note: Replace placeholders ([Subscription-ID], [your-object-id])
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.