Description
The Azure Playwright reporter (@azure/playwright/reporter) generates Portal URLs with a hardcoded @microsoft.onmicrosoft.com tenant, which causes authentication failures for users whose Azure subscriptions are in different tenants.
Environment
- Package:
@azure/playwright@1.1.1
- Platform: Node.js
- Authentication: Azure Service Principal with
DefaultAzureCredential
Steps to Reproduce
- Set up Azure Playwright Workspaces in a non-Microsoft tenant (e.g., organization's own Azure AD tenant)
- Configure tests to use
@azure/playwright/reporter
- Run tests with Azure authentication
- Observe the "Published report URL" in the output
Expected Behavior
The generated URL should use the actual tenant ID from the workspace metadata:
https://ms.portal.azure.com/#@{actual-tenant-id}/resource/subscriptions/.../TestRuns
Actual Behavior
The URL is generated with a hardcoded Microsoft tenant:
https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/.../TestRuns
Root Cause
File: dist/*/utils/utils.js (all build outputs: commonjs, esm, browser, react-native)
Function: getPortalTestRunUrl(workspaceMetadata) (around line 397-410)
Issue: The tenant is hardcoded on line 409:
return `https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/${encodeURIComponent(subscriptionId)}/...`;
The WorkspaceMetaData type already includes tenantId field (line 180 of types.d.ts), but the function doesn't use it.
Proposed Fix
Extract and use the tenantId from workspaceMetadata:
function getPortalTestRunUrl(workspaceMetadata) {
const { subscriptionId, resourceId, name, tenantId } = workspaceMetadata ?? {};
// ... validation logic ...
// Use tenant ID from metadata, fallback to microsoft.onmicrosoft.com if not provided
const tenant = tenantId || 'microsoft.onmicrosoft.com';
return `https://ms.portal.azure.com/#@${tenant}/resource/subscriptions/${encodeURIComponent(subscriptionId)}/...`;
}

Description
The Azure Playwright reporter (
@azure/playwright/reporter) generates Portal URLs with a hardcoded@microsoft.onmicrosoft.comtenant, which causes authentication failures for users whose Azure subscriptions are in different tenants.Environment
@azure/playwright@1.1.1DefaultAzureCredentialSteps to Reproduce
@azure/playwright/reporterExpected Behavior
The generated URL should use the actual tenant ID from the workspace metadata:
https://ms.portal.azure.com/#@{actual-tenant-id}/resource/subscriptions/.../TestRunsActual Behavior
The URL is generated with a hardcoded Microsoft tenant:
https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/.../TestRunsRoot Cause
File:
dist/*/utils/utils.js(all build outputs: commonjs, esm, browser, react-native)Function:
getPortalTestRunUrl(workspaceMetadata)(around line 397-410)Issue: The tenant is hardcoded on line 409:
The WorkspaceMetaData type already includes tenantId field (line 180 of types.d.ts), but the function doesn't use it.
Proposed Fix
Extract and use the tenantId from workspaceMetadata: