fix: normalize subscription ownerId to relative /users path on publish - #279
Merged
Alexander Zaslonov (azaslonov) merged 1 commit intoSep 12, 2026
Conversation
APIM returns ownerId as a full ARM resource path on GET, carrying the
source service coordinates. The PUT endpoint expects a relative URL in
the format /users/{userId}, so cross-instance publishes sent an ownerId
naming the source service. Strip the service ARM prefix the same way
normalizeSubscriptionScope handles scope. envMapping affixes are not
applied (a user id is not an affixed resource name); already-relative
values pass through unchanged.
Closes Azure#273
Copilot started reviewing on behalf of
Aleksey Zheltov (Alexey-Zheltov)
September 11, 2026 16:41
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified, and the normalization cases are covered by tests.
Pull request overview
Normalizes Subscription ownerId values to relative /users/{userId} paths when publishing across APIM instances.
Changes:
- Added owner ID normalization during subscription publishing.
- Preserved relative IDs and excluded environment-mapping affixes.
- Added three unit tests covering the behavior.
File summaries
| File | Summary |
|---|---|
tests/unit/services/resource-publisher.test.ts |
Tests absolute, relative, and environment-mapping owner IDs. |
src/services/resource-publisher.ts |
Normalizes Subscription owner IDs before publishing. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Alexander Zaslonov (azaslonov)
approved these changes
Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Normalizes
properties.ownerIdof Subscription resources on publish, mirroring the existingscopenormalization.APIM returns
ownerIdas a full ARM resource path on GET (carrying the source service coordinates), but the PUT endpoint expects a relative URL in the format/users/{userId}. Previously a subscription extracted from one instance and published to another carried the source instance'sownerIdunchanged.normalizeSubscriptionOwnerId()sibling ofnormalizeSubscriptionScope(), applied in the Subscription branch ofpublishResource.../service/{src-svc}/users/1→/users/1envMappingaffixes are deliberately NOT applied — a user id is not an affixed resource nameRelated Issue(s)
Closes #273
Verification
tests/unit/services/resource-publisher.test.ts: 77/77 passtsc --noEmitclean