Commit 64cd37b
Fix devcontainer to properly restore projects with private NuGet feed using interactive authentication (#778)
The devcontainer configuration was missing authentication setup for the
private Azure DevOps NuGet feed, preventing proper package restoration
when using GitHub Codespaces or local devcontainer development.
## Problem
The existing devcontainer would fail to restore packages that depend on
private NuGet packages from the Azure DevOps feed
(`https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json`).
This affected packages like:
- `ContentFeedNuget`
- `EssentialCSharp.Shared.Models`
## Solution
This PR implements a secure interactive authentication solution using
Microsoft's recommended approach for Azure Artifacts Credential
Provider:
### Key Changes
1. **Enhanced devcontainer.json**:
- Updated to use .NET 9.0 SDK specifically
- Added VS Code C# extensions for better development experience
- Added post-create command for automated setup
- Removed hardcoded environment variables for cleaner configuration
2. **Interactive Authentication Setup**:
- Created `setup-nuget-auth.sh` script that:
- Installs Azure Artifacts Credential Provider automatically
- Uses `dotnet restore --interactive` for secure credential prompting
- Gracefully falls back to public packages only when authentication
fails
- Provides clear user guidance for authentication options
3. **Developer Experience**:
- Secure interactive authentication - no need to store PATs in files or
environment variables
- Automatic fallback to public packages when private authentication is
unavailable
- Clear user prompts and guidance during setup
- Follows Microsoft's recommended authentication patterns
### Authentication Options
**Interactive Authentication**: When prompted during package
restoration, users can:
1. Use their Azure DevOps account credentials, or
2. Create a Personal Access Token (PAT) with 'Packaging (read)'
permissions from https://dev.azure.com/intelliTect/_usersSettings/tokens
### Backward Compatibility
The solution is fully backward compatible:
- Developers without private feed access can still use the devcontainer
- The setup script automatically falls back to public packages when
authentication fails
- All public packages restore normally without any user interaction
required
### Testing
- ✅ Package restoration works without authentication (public packages
only)
- ✅ Interactive authentication works for private packages
- ✅ Build and tests pass successfully
- ✅ Graceful handling of network restrictions and missing dependencies
- ✅ Secure credential handling with no storage of sensitive information
This brings the devcontainer authentication in line with Microsoft's
recommended security practices while ensuring consistent development
environments across local development, Codespaces, and CI/CD pipelines.
<!-- START COPILOT CODING AGENT SUFFIX -->
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/IntelliTect/EssentialCSharp.Web/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: BenjaminMichaelis <[email protected]>
Co-authored-by: Benjamin Michaelis <[email protected]>
Co-authored-by: Copilot <[email protected]>1 parent ac761c8 commit 64cd37b
File tree
3 files changed
+71
-5
lines changed- .devcontainer
3 files changed
+71
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
0 commit comments