Problem
When running azd init --template <repo>, ALL files from the template repository are copied to the user's project directory. Template repos often contain files only relevant to template contributors -- not end consumers:
CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
.github/workflows/azure-dev-validation.yaml (template CI)
CHANGELOG.md, CODEOWNERS
These files clutter the consumer's project and cause confusion.
Example: azure-ai-starter-basic copies CONTRIBUTING.md, CHANGELOG.md, .github/CODE_OF_CONDUCT.md, and .github/workflows/azure-dev-validation.yaml -- none of which an end-user needs.
Proposal
Add support for a .azdignore file at the template root that uses standard .gitignore syntax. Template authors add this file to exclude files/directories during azd init.
# .azdignore - files excluded when consumers run azd init
CONTRIBUTING.md
CODE_OF_CONDUCT.md
SECURITY.md
CHANGELOG.md
.github/workflows/azure-dev-validation.yaml
Design decisions
- Separate file (not azure.yaml config) --
.gitignore syntax is universally understood
- Root-only -- single
.azdignore at template root, no recursive/nested ignore files
- Self-excluding --
.azdignore itself is always removed from init output
- UTF-8 BOM safe -- handles Windows editors that add BOM
- Uses
go-gitignore library (same as .funcignore, .webappignore, .gitignore support)
Relationship to other ignore features
| Feature |
Phase |
Shipped |
.azdignore |
azd init (template copy) |
This issue |
.funcignore / .webappignore |
azd deploy (zip packaging) |
1.18.0 (PR #5383) |
.dockerignore |
azd deploy (docker build) |
Already supported |
History
- Original PR: #4146 (jongio, Jul 2024)
- Revised PR: #4258 (jongio, Aug 2024, addressed review feedback)
- Related: #7669, #1039, #4383
Problem
When running
azd init --template <repo>, ALL files from the template repository are copied to the user's project directory. Template repos often contain files only relevant to template contributors -- not end consumers:CONTRIBUTING.md,CODE_OF_CONDUCT.md,SECURITY.md.github/workflows/azure-dev-validation.yaml(template CI)CHANGELOG.md,CODEOWNERSThese files clutter the consumer's project and cause confusion.
Example: azure-ai-starter-basic copies
CONTRIBUTING.md,CHANGELOG.md,.github/CODE_OF_CONDUCT.md, and.github/workflows/azure-dev-validation.yaml-- none of which an end-user needs.Proposal
Add support for a
.azdignorefile at the template root that uses standard.gitignoresyntax. Template authors add this file to exclude files/directories duringazd init.Design decisions
.gitignoresyntax is universally understood.azdignoreat template root, no recursive/nested ignore files.azdignoreitself is always removed from init outputgo-gitignorelibrary (same as.funcignore,.webappignore,.gitignoresupport)Relationship to other ignore features
.azdignoreazd init(template copy).funcignore/.webappignoreazd deploy(zip packaging).dockerignoreazd deploy(docker build)History