Connecting Azure Log Analytics Workspace
Connect an Azure Log Analytics workspace to RealmJoin Portal with the RealmJoin PowerShell module to store audit, operational and runbook logs in your own tenant.
Overview
RealmJoin Portal can use a Log Analytics workspace in your own Azure subscription to store
its audit log — every action performed in the Portal, see Audit Log
its operational logs
runbook logs, archived beyond the maximum retention of Azure Automation (currently 30 days)
The workspace is set up with the RealmJoin PowerShell module. The Portal generates a ready-to-copy command for you — there is nothing to fill in by hand.
Components
RealmJoin writes its logs through the Azure Monitor Logs Ingestion API, based on Data Collection Rules (DCRs) and Microsoft Entra ID authentication. Running the setup command creates:
The RealmJoin Azure Resources service principal in your Entra ID tenant (if it does not exist yet)
A Log Analytics workspace in the resource group you choose — or your existing workspace, if you name one
Three custom tables in that workspace:
RJAuditLogs_CL,RJOperationalLogs_CL,RJRunbookLogs_CLOne Data Collection Rule per table (
dcr-rj-aud-logs-*,dcr-rj-op-logs-*,dcr-rj-rb-logs-*), each with its own direct ingestion endpointExactly two kinds of role assignment for RealmJoin, and nothing beyond them:
Log Analytics Reader on the workspace, so the Portal can query your logs
Monitoring Metrics Publisher on each of the three Data Collection Rules, so RealmJoin can write to them
RealmJoin receives no other permission in your subscription. No app registration, no client secret and no workspace shared key are involved. The deployment is idempotent — re-running the same command is safe and only applies what is missing.
Prerequisites
In the RealmJoin Portal
A role that grants access to the Settings area (
CanReadSettingsDetails, see Available Permissions). The settings page generates the setup command including a short-lived onboarding token.
In Azure
An Azure subscription and an existing resource group to deploy into — the module does not create the resource group
Optionally an existing Log Analytics workspace. If you do not name one, a workspace is created for you in the region of the resource group.
On the machine running PowerShell
PowerShell 5.1 or later (Windows PowerShell or PowerShell 7)
Access to the PowerShell Gallery to install the RealmJoin module
The
Az.Accounts,Az.ResourcesandAz.Automationmodules — the RealmJoin module installs them in the pinned versions automatically, for the current user
Permissions of the account you sign in with
Microsoft Entra ID: permission to create service principals, for example Application Administrator, Cloud Application Administrator or Global Administrator. Only needed the first time, when the RealmJoin Azure Resources service principal does not exist yet.
Azure subscription: permission to deploy into the resource group and to create role assignments on it — for example Owner, or Contributor combined with User Access Administrator / Role Based Access Control Administrator.
Sign-in happens through
Connect-AzAccount, which uses the Azure PowerShell first-party application. Tenants that restrict user consent may need to grant admin consent to that application first.
Setup
Copy the command from the RealmJoin Portal
In the RealmJoin Portal, navigate to Settings → Log Analytics (https://portal.realmjoin.com/settings/log-analytics-configuration).
The page states that Log Analytics is managed via the RealmJoin PowerShell module and shows a command block. Use the Copy button to copy it.
The first lines install or update the RealmJoin module and import it. Set-RJLogAnalyticsWorkspace performs the deployment and registers the result with RealmJoin using the -Token.
Add the target parameters
Set-RJLogAnalyticsWorkspace needs to know where to deploy. Complete the last line before running it:
-ResourceGroupNameis required. If you leave it out, PowerShell prompts you for it.-SubscriptionIdis optional — without it, the subscription of your current Azure context is used, and you are asked to choose if several are available.-WorkspaceNameis optional. Pass it to define the name of a new workspace or to use an existing workspace; otherwise a new one is created with a generated name.
Run the command
Paste the block into a new PowerShell session and run it. The token is valid for roughly an hour — if it has expired, reload the settings page and copy the command again.
You will be prompted to sign in with Connect-AzAccount. If your account has access to several tenants or subscriptions, the module asks you to choose.
The deployment then reports every resource as it is created: the service principal, the workspace, the custom tables, the Data Collection Rules and the role assignments. A single run usually takes a few minutes.
Verify in the Portal
Return to Settings → Log Analytics and select Refresh.
The page now shows subscription, resource group, workspace name, customer workspace ID and tenant ID as read-only fields — these settings are maintained by the PowerShell module from now on. Under Advanced you can review the endpoints, rule names and stream names of the three Data Collection Rules.
Select Check for configuration problems to verify that all required Azure permissions are in place on the workspace and on each Data Collection Rule.
Afterwards, open the Audit Log or the Runbook Logs and confirm that entries appear. Azure needs a few minutes to make newly created custom tables available.
Data retention
Keeping the schema up to date
If RealmJoin extends the log schema in a future release, the settings page shows a notice that the deployed Log Analytics schema is out of date, along with the command to update it. That is the same Set-RJLogAnalyticsWorkspace command — run it again and the tables and rules are updated in place.
Legacy setup (Data Collector API)
Last updated
Was this helpful?