Proposal: Integrated Multi-Repository and Layered Provisioning Architecture for azd
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Summary
This proposal outlines a comprehensive plan to enable first-class multi-repository (multi-repo) application scenarios in Azure Developer CLI (azd), fully integrating support for layered provisioning, dependency management, and enterprise-scale infrastructure patterns. It addresses key challenges from monolith-to-multirepo migration, cross-repository orchestration, and layered infrastructure deployment, referencing all major related issues.
---
## Background & Motivation
azd currently uses a monorepo structure, where all services and infrastructure definitions live in a single repository. There is growing demand, especially from enterprise teams, to enable each service and/or infrastructure layer to reside in separate repositories—enabling team autonomy, better ownership, independent versioning, improved scalability, and alignment with platform engineering practices.
**Key related issues:**
- [Support multi-repo application scenarios (#2372)](https://github.com/Azure/azure-dev/issues/2372)
- [Feature request: Support multiple infrastructure deployments in AZD provision cmd. (#4755)](https://github.com/Azure/azure-dev/issues/4755)
- [Create layer deployment orchestration engine (#5294)](https://github.com/Azure/azure-dev/issues/5294)
- [Multi environment support (#383)](https://github.com/Azure/azure-dev/issues/383)
- [Create precedence resolution logic (#5322)](https://github.com/Azure/azure-dev/issues/5322)
---
## Comprehensive Multi-Repo + Layered Provisioning Plan
### 1. **Extend azure.yaml Schema**
- Add first-class `repository` support for both `services` and `infra.layers`:
- Allow each service and each infra layer to specify an external git repository URL, branch/ref, and credentials.
- Allow a mix of local and remote components.
- Example:
```yaml
infra:
layers:
- name: networking
repository:
url: https://github.com/myorg/infra-networking
ref: main
credentials: $PLATFORM_PAT
path: infra
provider: bicep
- name: application
path: infra
provider: bicep
dependsOn:
- networking
services:
api:
repository:
url: https://github.com/myorg/api-service
ref: main
credentials: $SERVICE_PAT
project: ./src
host: containerapp
dependsOn:
- application
```
### 2. **Repository Manager & Workspace**
- Implement a `RepositoryManager` to clone/fetch repos, manage credentials, cache, and track refs.
- Standardize workspace layout under `.azure/workspace` for clean, conflict-free source isolation.
### 3. **Layered Orchestration & Dependency Resolution**
- Enhance layer orchestration to support cross-repo dependencies:
- Design a dependency graph (layers/services → layers/services).
- Use a `dependsOn:` key for both infra layers and services.
- Ensure provision, destroy, and CI/CD flows respect dependency order.
### 4. **Provisioning Engine Enhancements**
- Refactor provisioning logic to iterate provision/destroy by layer/service in topological order:
- Support partial (layer/service) operations and promote re-entrancy.
- Tag deployments/resources with layer+repo metadata for traceability.
### 5. **Cross-Repo CI/CD Orchestration**
- Generate or recommend workflows that can trigger downstream repo workflows (e.g., GitHub Actions, Azure Pipelines).
- Example: trigger service deployment after successful layer provision.
### 6. **Configuration, Precedence & Security**
- Add configuration/secret management for repository credentials.
- Implement clear precedence when configuration is present both locally and in dependencies (see #5322).
- Document security best practices for credential isolation and access control.
### 7. **User Experience & Migration**
- Provide migration guides and tooling for moving from monorepo to multi-repo setups.
- Ensure backwards compatibility—monorepo and multi-repo models should co-exist.
### 8. **Performance & Caching**
- Add smart caching for repo clones & builds.
- Detect no-op scenarios for unchanged layers/services.
### 9. **Testing and Rollout**
- Provide real-world starter templates for multi-repo/layered apps.
- Target incremental delivery: alpha flag → beta → GA.
---
## Implementation Roadmap & Phasing
1. **RepositoryManager POC**: Clone, fetch, validate remote layers and services.
2. **Schema validation**: Extend and strictly validate azure. yaml.
3. **Provisioning engine**: Layered, cross-repo, dependency-aware orchestration.
4. **CI/CD generation & docs**: Multi-repo workflow blueprints and documentation.
5. **User migration & feedback loop**: Engage early adopters, iterate.
---
## Out of Scope / Open Questions
- Support for non-Git backends
- Partial layer overrides/patching mechanics
---
## References to Related Issues
- [#2372: Support multi-repo application scenarios](https://github.com/Azure/azure-dev/issues/2372)
- [#4755: Support multiple infrastructure deployments in AZD provision cmd.](https://github.com/Azure/azure-dev/issues/4755)
- [#5294: Create layer deployment orchestration engine](https://github.com/Azure/azure-dev/issues/5294)
- [#383: Multi environment support](https://github.com/Azure/azure-dev/issues/383)
- [#5322: Create precedence resolution logic](https://github.com/Azure/azure-dev/issues/5322)
---
Contributor guide
Assessment
This issue has not been assessed yet.