Add custom Company Portal Url support and improve intune detection fo… #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This change adds support for a custom Company Portal URL (e.g. GCC High / sovereign cloud endpoints) and hardens the Intune MDM detection logic so it correctly identifies Intune across all manage.microsoft.* domains while avoiding obvious false positives.
Changes
Configurable Company Portal URL
Introduces a new optional configuration key: CompanyPortalUrl.
If set, the Company Portal view now loads this URL instead of a hard-coded commercial endpoint.
If not set, the existing behavior is preserved by falling back to the default commercial Intune Company Portal URL.
This enables environments such as GCC High to point the Company Portal tab at https://portal.manage.microsoft.us/ (or other valid Microsoft endpoints) via MDM configuration, without requiring a custom build.
Improved Intune detection for MDM URL
Replaces the previous substring check on mdmUrl.contains(".manage.microsoft.") with host-based detection.
The MDM URL is now parsed via URL(string:), and detection is performed on the host only.
A stricter pattern is used to match manage.microsoft. and subdomains of it, preventing matches against hosts like evil.manage.microsoft.notmicrosoft.com.
This allows Intune mode to be correctly selected for any manage.microsoft.* TLD (e.g. commercial, GCC High, and other Microsoft clouds), while reducing the chance of misclassification.