Prompt templates help you set your Azure tenant and subscription context once at the beginning of your Copilot session, so you don't have to repeat them in every request.
You can place these templates in different locations depending on your IDE:
| IDE | Location | Instructions |
|---|---|---|
| VS Code | .github/copilot-instructions.md in your workspace |
Create this file in your project root. Copilot will automatically use it as context for all conversations in that workspace. |
| Visual Studio 2022/2026 | .github/copilot-instructions.md in your solution |
Create this file at your solution root. GitHub Copilot will reference it automatically. |
| IntelliJ IDEA | Start of each chat session | Copy the template as your first message in a new Copilot chat session. |
| Eclipse | Start of each chat session | Copy the template as your first message in a new Copilot chat session. |
Tip: For VS Code and Visual Studio, using
.github/copilot-instructions.mdmeans you only set up your context once per workspace/solution, and it applies to all future chat sessions automatically.
Why use this? When your Azure subscription is in a different tenant than your default, or you work with specific subscriptions regularly, this template ensures Copilot always uses the correct credentials.
## Azure Context
I'm working with the following Azure environment:
- **Tenant:** contoso.onmicrosoft.com
- **Subscription:** Production-Subscription
When calling Azure MCP tools, always include the `--tenant` parameter to ensure proper authentication with the tenant above.File: .github/copilot-instructions.md
# Project Copilot Instructions
## Azure Context
I'm working with the following Azure environment:
- **Tenant:** contoso.onmicrosoft.com
- **Subscription:** Production-Subscription
- **Primary Resource Group:** myapp-prod-rg
- **Primary Region:** East US
When calling Azure MCP tools, always use these values and include the `--tenant` parameter for authentication.Once this file is in your workspace, all your Copilot chats automatically know your Azure context.
If your IDE doesn't support .github/copilot-instructions.md, start each chat session with:
I'm working with Azure tenant: contoso.onmicrosoft.com and subscription: Production-Subscription.
Please use these values for all Azure operations and include --tenant parameter when calling Azure MCP tools.
Then your subsequent questions are simple:
Show me all storage accounts in East US
List virtual machines in the finance-prod resource group
Copilot will remember the context throughout your conversation.
When you authenticate to Azure, Entra ID issues tokens scoped to a specific tenant (directory). If your subscription is in a different tenant than your default, you must specify the tenant to ensure:
- Correct authentication: Token is issued for the right directory
- Proper permissions: Your RBAC permissions are evaluated in the correct tenant
- Resource access: You can see and manage the subscription's resources
Most Azure MCP tools support these parameters:
--tenant: Tenant ID or domain name--subscription: Subscription ID or name--resource-group: Resource group name
"Authentication failed" or "Subscription not found"
Verify your context and update if needed:
Please use tenant: correct-tenant.onmicrosoft.com and subscription: Correct-Sub
Context seems forgotten mid-conversation
Remind Copilot:
Reminder: We're working with tenant contoso.onmicrosoft.com and subscription Production-Sub