feat: Redesign container-copy flow to select destination account and enable cross-account container creation#2436
Open
BChoudhury-ms wants to merge 3 commits intomasterfrom
Open
feat: Redesign container-copy flow to select destination account and enable cross-account container creation#2436BChoudhury-ms wants to merge 3 commits intomasterfrom
BChoudhury-ms wants to merge 3 commits intomasterfrom
Conversation
616589b to
129c25c
Compare
…enable cross-account container creation
129c25c to
f63d164
Compare
vchske
approved these changes
Apr 3, 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.
Preview this branch
Summary
This PR redesigns the container copy job feature to fix the conceptual direction of account selection, and extends
createDatabase,createCollection, andExplorer.openEnableSynapseLinkDialogto operate against an arbitrary target account via a newAccountOverrideparameter.Also this PR upgrades the required RBAC permission for Container Copy jobs from the built-in Cosmos DB Reader role (
00000000-0000-0000-0000-000000000001) to the built-in Cosmos DB Data Contributor role (00000000-0000-0000-0000-000000000002). The change ensures the destination account's managed identity has sufficient write access to execute copy jobs reliably.What Changed
Data model changes (
DataModels.ts,CopyJobTypes.ts)AccountOverrideinterface (subscriptionId,resourceGroup,accountName).source/targetinCopyJobContextState:sourcenow stores a flatsubscriptionId: string(pre-filled fromuserContext).targetnow stores asubscription: Subscription | nullthat the user selects.Copy-job feature flow
CopyJobContext.tsx— initial state now pre-fillssourcefromuserContextand leavestargetempty.SelectAccountscreen — dropdowns (SubscriptionDropdown,AccountDropdown) now read from / write totarget.useCreateCopyJobScreensList— validation now checkstarget.subscriptionandtarget.account.CopyJobActions.tsx— movedremoteAccountNamefromproperties.source→properties.destinationin the data-transfer API payload (fixing a bug where the remote account name was sent on the wrong side).Cross-account container & database creation
DataModels.CreateDatabaseParamsandCreateCollectionParamsnow accept an optionaltargetAccountOverride.createDatabase.ts/createCollection.ts— whentargetAccountOverrideis set, ARM calls use itssubscriptionId,resourceGroup, andaccountNameinstead ofuserContext, and duplicate-ID validation is skipped.readDatabases.ts— new exportedreadDatabasesForAccount(subscriptionId, resourceGroup, accountName)function.AddCollectionPanelimprovementstargetAccountOverride?: AccountOverrideandexternalDatabaseOptions?: IDropdownOption[].getDatabaseOptions()returnsexternalDatabaseOptionswhen provided, bypassing the local Zustand store.openEnableSynapseLinkDialog.refreshAllDatabasesis skipped to avoid refreshing the source account's tree.AddCollectionPanelWrapper(copy-job flow)readDatabasesForAccountand passes them asexternalDatabaseOptions.MessageBarerror on permission or network failures.targetAccountOverridefrom the selected target account's ARM resource ID."Configure the properties for the new container on destination account \"<name>\".".Explorer.openEnableSynapseLinkDialogtargetAccountOverride; uses its coordinates for the ARMupdatecall.userContext.databaseAccount.properties.enableAnalyticalStoragewhen no override is present.Permission Model
RbacUtils.ts:assignRolenow assigns the Data Contributor role definitioninstead of the Reader role.
usePermissionsSection.tsx:checkTargetHasReaderRoleOnSourcerenamed tocheckTargetHasReadWriteRoleOnSource. Validation logic expanded to:...000002).databaseAccounts/*,containers/*,items/*).items/readanditems/writedata actions for custom roles.UI label corrections (
ContainerCopyMessages.ts,PreviewCopyJob.tsx)