Azure DevOps集合级默认团队创建及项目关联技术问询
Great questions—let's break this down clearly for your scenario with the Services collection, devs x/y/z, and projects Service A/B/C.
a) Can you create a collection-level default team and assign users?
Absolutely yes. Azure DevOps lets you create teams at the project collection level (not tied to a single project) and add users to them. These teams are visible across all projects in the collection, and you can assign them collection-wide or project-specific permissions as needed.
Here's how to set this up for your Services collection:
- Open your Azure DevOps portal, navigate to the
Servicescollection. - Click the gear icon in the bottom-left corner and select Collection settings.
- Go to the Teams tab, then click New team.
- Name your team (e.g., "Services Core Team"), add members x and y, and configure any collection-level permissions you want (like basic access or contribute rights across all projects).
This team will live at the collection level, not tied to any single project—perfect for your shared devs x/y.
b) How to make this collection-level team the default for all new projects in the collection?
Azure DevOps automatically creates a project-specific default team when you make a new project (e.g., "Service A Team" for project Service A), but we can override this to use your collection-level team instead. There are two main approaches:
Option 1: Manual post-creation setup (for occasional projects)
For each new project:
- Create the project as usual in the
Servicescollection. - Go to the project's Project settings > Teams.
- Click Add existing team, search for your collection-level "Services Core Team", and add it to the project.
- Hover over the "Services Core Team" entry, click the ellipsis menu, and select Set as default.
- You can then delete the auto-generated project-specific team (e.g., "Service A Team") if you don't need it.
For Service C, you can then manually add z directly to the "Services Core Team" (or create a separate sub-team in the project if you prefer).
Option 2: Automated setup (for consistent, hands-off project creation)
If you want this to happen automatically for all new projects, use Azure DevOps Service Hooks + REST API to automate the process:
- Set up a Service Hook: In your
Servicescollection settings, go to Service Hooks > Create subscription. Choose the "Project created" event, and connect it to an Azure Function, PowerShell script, or Azure DevOps Pipeline. - Automate the team replacement: When the hook triggers (a new project is created), run these steps via the Azure DevOps REST API:
- Add your collection-level team to the new project:
Body:POST https://dev.azure.com/{your-org}/{new-project-name}/_apis/teams?api-version=7.1-preview.3{"name": "Services Core Team", "projectId": "{new-project-id}"} - Mark the collection-level team as the project's default:
Body:PATCH https://dev.azure.com/{your-org}/{new-project-name}/_apis/teams/{collection-team-id}?api-version=7.1-preview.3{"isDefault": true} - Delete the auto-generated project-specific default team:
DELETE https://dev.azure.com/{your-org}/{new-project-name}/_apis/teams/{auto-generated-team-id}?api-version=7.1-preview.3
- Add your collection-level team to the new project:
This way, every new project in the Services collection will automatically have "Services Core Team" (x/y) as its default team—no manual work needed. For Service C, you can still manually add z to the team later.
Key Notes
- Ensure your collection-level team has appropriate permissions (e.g., "Contribute" access) at the collection or project level so x/y can work in new projects out of the box.
- When deleting the auto-generated project team, double-check it has no associated work items (new projects won't have any, so this is safe).
内容的提问来源于stack exchange,提问作者S.N

