CloudException: Please register the subscription with Microsoft.Insights

While trying to connect Azure Automation and log Analytics I came across this error:

CloudException: Please register the subscription {your sub ID} with Microsoft.Insights

Message is clear, but how do I do this?? Took me a while to figure out.

  1. In your Azure portal head to your Subscriptions, pick the required subscription
  2. Inside of a subscription pick “Resource providers” – you’ll be presented with a list of providers.
  3. From the list of providers pick microsoft.insights and click Register.
  4. This fixed my problem