From 283c2ed214bc7ff1ee3cf8780c9e084ac0e00afe Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Mon, 10 Aug 2026 13:33:59 +0200 Subject: [PATCH] web,ci: make Grant-AutopilotMonitorAddOn.ps1 actually downloadable The docs page and the admin UI both told customers to run Grant-AutopilotMonitorAddOn.ps1, but the script was never published anywhere -- it only exists in this private repo. Publish it on the download alias next to the agent artifacts and reference it: - build-agent.yml: upload the script on publish_as_stable runs - admin UI: copied grant command now starts with an irm -OutFile download line; prose links the script directly - utils/config.ts: new AGENT_DOWNLOAD_URL registry constant Co-Authored-By: Claude Fable 5 --- .github/workflows/build-agent.yml | 6 ++++++ .../SectionOptionalGraphCapabilities.tsx | 16 +++++++++++++--- src/Web/autopilot-monitor-web/utils/config.ts | 7 +++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-agent.yml b/.github/workflows/build-agent.yml index 75663668..01128339 100644 --- a/.github/workflows/build-agent.yml +++ b/.github/workflows/build-agent.yml @@ -270,6 +270,12 @@ jobs: if (Test-Path "scripts/Bootstrap/Test-ShouldBootstrapAgent.ps1") { Send-Blob -Local "scripts/Bootstrap/Test-ShouldBootstrapAgent.ps1" -BlobName "Test-ShouldBootstrapAgent.ps1" -ContentType "text/plain; charset=utf-8" } + + # Customer-side Graph add-on grant script -- docs and admin UI link + # https://download.autopilotmonitor.com/agent/Grant-AutopilotMonitorAddOn.ps1 + if (Test-Path "scripts/CustomerSetup/Grant-AutopilotMonitorAddOn.ps1") { + Send-Blob -Local "scripts/CustomerSetup/Grant-AutopilotMonitorAddOn.ps1" -BlobName "Grant-AutopilotMonitorAddOn.ps1" -ContentType "text/plain; charset=utf-8" + } } # Update AdminConfiguration LatestAgentV2* -- ONLY on stable cutover. The hash-oracle diff --git a/src/Web/autopilot-monitor-web/app/settings/tenant/sections/SectionOptionalGraphCapabilities.tsx b/src/Web/autopilot-monitor-web/app/settings/tenant/sections/SectionOptionalGraphCapabilities.tsx index e83935b4..c6bede33 100644 --- a/src/Web/autopilot-monitor-web/app/settings/tenant/sections/SectionOptionalGraphCapabilities.tsx +++ b/src/Web/autopilot-monitor-web/app/settings/tenant/sections/SectionOptionalGraphCapabilities.tsx @@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from "react"; import { useAuth } from "../../../../contexts/AuthContext"; import { useTenant } from "../../../../contexts/TenantContext"; import { api } from "@/lib/api"; +import { AGENT_DOWNLOAD_URL } from "@/utils/config"; import { authenticatedFetch } from "@/lib/authenticatedFetch"; import { trackEvent } from "@/lib/appInsights"; @@ -111,8 +112,9 @@ export function SectionOptionalGraphCapabilities() { const allPermissions = Array.from(new Set(featureRows.flatMap(f => f.requiredPermissions))); const allPermissionsLine = allPermissions.map(p => `"${p}"`).join(","); + const scriptDownloadUrl = `${AGENT_DOWNLOAD_URL}/Grant-AutopilotMonitorAddOn.ps1`; const psCommand = status?.clientId - ? `.\\Grant-AutopilotMonitorAddOn.ps1 \`\n -ClientId "${status.clientId}" \`\n -Permissions ${allPermissionsLine} \`\n -TenantId "${tenantId ?? ""}"` + ? `irm '${scriptDownloadUrl}' -OutFile .\\Grant-AutopilotMonitorAddOn.ps1\n.\\Grant-AutopilotMonitorAddOn.ps1 \`\n -ClientId "${status.clientId}" \`\n -Permissions ${allPermissionsLine} \`\n -TenantId "${tenantId ?? ""}"` : ""; return ( @@ -205,8 +207,16 @@ export function SectionOptionalGraphCapabilities() {

PowerShell grant command

- Open a Windows PowerShell or PowerShell 7 prompt as a tenant administrator and run the script - below. It is idempotent — re-running it skips permissions that are already granted. + Open a Windows PowerShell or PowerShell 7 prompt as a tenant administrator and run the commands + below — the first line downloads the script ( + + direct download + + ), the second runs it. It is idempotent — re-running it skips permissions that are already granted.

diff --git a/src/Web/autopilot-monitor-web/utils/config.ts b/src/Web/autopilot-monitor-web/utils/config.ts
index d723331b..0a6f6bfa 100644
--- a/src/Web/autopilot-monitor-web/utils/config.ts
+++ b/src/Web/autopilot-monitor-web/utils/config.ts
@@ -49,6 +49,13 @@ export const API_URL_PROD = "https://autopilotmonitor-api-eu.azurewebsites.net";
 /** Production blob origin (CSP connect-src: diagnostics SAS uploads). */
 export const BLOB_URL_PROD = "https://autopilotmonitoreu.blob.core.windows.net";
 
+/**
+ * Customer-facing download alias for agent artifacts and helper scripts
+ * (Front Door in front of the blob origin). Counterpart of
+ * Constants.AgentDownloadBaseUrl on the C# side.
+ */
+export const AGENT_DOWNLOAD_URL = "https://download.autopilotmonitor.com/agent";
+
 /**
  * Hostnames the portal accepts in a bootstrap response's agentDownloadUrl.
  * Keep in sync with ValidateBootstrapCodeFunction.cs, which builds that URL