Docs · Microsoft Azure

Before you connect Azure

What you need ready before connecting Azure, and every step. It takes about 10 minutes for someone who is Owner of a subscription.

Before you start

  • Owner of the Azure subscription that will host the agentThe person running the setup needs Owner (or User Access Administrator) on that subscription, and on any other subscriptions you pick. The setup gives the agent read-only roles.
  • No Microsoft Entra role for subscriptionsThe agent signs in with its own managed identity: no app registration, secret or admin consent.
  • Optional · Covering the whole tenant? A Global Administrator, onceOnly to cover every subscription or a management group with the portal form or the scripts. A Global Administrator takes Owner at the top of the tenant (/) for the setup and gives it back afterwards. Not needed for a single subscription or with Terraform. Elevate access for a Global Administrator.
  • Microsoft Defender for Cloud on your subscriptionsThe free tier is enough for the secure score, security recommendations, MFA checks and compliance standards. Microsoft Defender for Cloud: the free foundational tier.
  • Access to Azure Cloud ShellIn the Azure portal. Used for a one-time command, and for the script install if you choose it. Get started with Azure Cloud Shell.
  • About 10 minutesResults usually appear within the hour. Cost data can take up to a day.
  • One new resource group in your AzureIt holds the read-only agent and its storage, so your data stays in your Azure. Roughly $20–30 a month for the Small size, or $40–60 a month for Standard (recommended), on your own Azure bill. Premium is $250 a month.
  • Optional · A Global Administrator for Microsoft 365 checksTo add Microsoft 365 checks later (sign-in, licences and Copilot), a Global Administrator (or Privileged Role Administrator) runs one command, once. Microsoft Graph permissions reference.

The steps

  1. Create the connection in CloudLens and copy the setup code. In CloudLens, open Connections → Add connection → Microsoft Azure, name the connection and continue. You’ll see a one-time setup code. It works once and expires after 24 hours; if it expires, choose New token. The code is shown only in CloudLens, never by email.
  2. Register the alerts provider, once per subscription. If the subscription has never used Azure alerts, run this in Azure Cloud Shell first. Without it the agent still works, but the portal deployment reports MissingSubscriptionRegistration. The Cloud Shell script and Terraform do this for you. az provider register --namespace Microsoft.AlertsManagement
  3. Run the installer. Choose one: the form in the Azure portal (recommended), one command in Azure Cloud Shell (Bash or PowerShell), or a Terraform module. Sign in as an Owner of the subscription and paste the setup code where asked. They all create the same thing, in about five minutes.
  4. Wait for the first collection. The CloudLens page turns green on its own when the agent connects. Results usually appear within the hour, and cost data within a day. The connection page shows each data source going green.
  5. Optional: connect Microsoft 365 (sign-in, licences, Copilot). A Global Administrator (or Privileged Role Administrator), once. On the Microsoft 365 page in CloudLens, under “Connect Microsoft 365”, copy the command and run it in Azure Cloud Shell (Bash). Nothing is created in Microsoft Entra: no app registration and no secret.
  6. Invite your team and see what we found. Add colleagues in Settings → Members, then open Top findings for what we found in your cloud, with the steps to fix each item.

Each install option is explained in Connect Azure. Covering the whole tenant is in Permissions and scope.

Optional: Microsoft 365 checks (sign-in, licences, Copilot)

A Global Administrator (or Privileged Role Administrator), once. On the Microsoft 365 page in CloudLens, under “Connect Microsoft 365”. Copy the command shown there and run it in Azure Cloud Shell (Bash). It gives the agent’s own managed identity read-only Microsoft Graph permissions.

Microsoft Graph application permission (read-only)
User.Read.All
RoleManagement.Read.Directory
UserAuthenticationMethod.Read.All
Policy.Read.All
AuditLog.Read.All
Application.Read.All
Organization.Read.All
Reports.Read.All
  • Nothing is created in Microsoft Entra: no app registration and no secret.
  • Some checks (sign-in activity, MFA registration for all users and Conditional Access) need Microsoft Entra ID P1 or P2. Without it, they show “needs Entra ID P1”.
  • Results appear within 24 hours, because Azure caches the agent’s sign-in.
  • Remove it any time: delete those permissions from the agent’s managed identity (Enterprise applications → the agent’s identity → Permissions), or remove the agent.
  • People’s names (user principal names) are shown live in CloudLens when your organization’s “Show people’s names” setting is on, which it is by default. CloudLens never stores them or puts them in emails.

What gets created

One new resource group holds everything. Outside it, only read-only role assignments on what you choose to cover.

ResourceDetails
Function App and its planthe agent itself, Node 22, at the size you choose
User-assigned managed identityhow the agent signs in to Azure; no app registration, secret or admin consent
Storage account for the agent hostStandard LRS, shared keys off; holds the agent package and runtime state
Storage account for your dataStandard LRS, shared keys off; raw results and history, kept for 400 days
Key vaultStandard; holds only the agent’s connection key. A deleted one is kept 7 days
Application Insights and Log Analyticsthe agent’s logs, kept 30 days
Azure AI resource and one model deploymentonly with the AI Advisor; plus a usage alert to subscription owners
Read-only role assignmentsReader, Cost Management Reader, Monitoring Reader and Security Reader, on the scope you choose

Send this to your IT team

Not doing the setup yourself? In CloudLens, open Connections → Add connection and choose Email these steps. It sends everything on this page to up to five people, with an optional note. It never includes the setup code: that is shown only in CloudLens.

Microsoft Learn