Secure Programming with .NET and Microsoft Azure
Duration: 3 days
Modern applications must protect APIs, identities, data, and increasingly the AI agents acting on their behalf. This workshop combines secure design with practical implementation in .NET 10, ASP.NET Core, and Microsoft Azure. Participants strengthen an application step by step, address current OWASP risks, and apply defense in depth to AI features without treating model output or safety filters as a security boundary. GDPR considerations are addressed from an engineering perspective; the workshop does not replace legal advice or certify compliance.
Who Should Attend
- C# and .NET developers building web applications, APIs, and services
- Software architects and technical leads designing Azure or on-premises systems
- Developers adding AI assistants, retrieval-augmented generation (RAG), or agents to .NET applications
- DevSecOps engineers responsible for secure builds, deployments, and operations
Prerequisites
- Practical experience with C#, dependency injection, and asynchronous .NET code
- Familiarity with ASP.NET Core, HTTP APIs, and basic authentication concepts
- Basic knowledge of Azure and Git; no prior AI security experience required
- A development environment prepared as described below
Learning Goals
- Identify application and AI threats using threat modeling and current OWASP guidance
- Prevent injection, broken access control, request forgery, and unsafe error handling in ASP.NET Core
- Implement modern authentication and policy- and resource-based authorization
- Protect secrets, personal data, cryptographic keys, and service-to-service communication
- Constrain AI agents and MCP tools with least privilege and explicit authorization
- Evaluate prompt injection defenses, RAG isolation, and model output handling with repeatable tests
- Integrate dependency auditing, security testing, and protected deployments into CI/CD
- Detect security incidents with useful, privacy-aware logs, traces, and alerts
Course Content
Day 1: Secure Design and Current Application Risks
- Threat modeling with STRIDE, trust boundaries, secure defaults, least privilege, and zero trust principles
- OWASP Top 10:2025: A01 Broken Access Control, A02 Security Misconfiguration, A03 Software Supply Chain Failures, A04 Cryptographic Failures, and A05 Injection
- A06 Insecure Design, A07 Authentication Failures, A08 Software or Data Integrity Failures, A09 Security Logging and Alerting Failures, and A10 Mishandling of Exceptional Conditions
- Data classification, data minimization, retention, data subject rights, and records of processing for GDPR-aware design
Day 1: Secure Coding with ASP.NET Core
- SQL/NoSQL/ORM injection prevention, parameterized queries, and safe Entity Framework Core usage
- Input validation with Data Annotations and FluentValidation; regular expression timeouts and safe parsing
- XSS prevention, output encoding, Content Security Policy (CSP), and secure file uploads
- Antiforgery protection for cookie-authenticated requests; CORS limitations and SSRF defenses
- Safe ProblemDetails responses, fail-closed error handling, request limits, rate limiting, timeouts, and circuit breakers
Day 2: Identity, Authentication, and Authorization in .NET 10
- Microsoft Entra ID, OpenID Connect, OAuth authorization code flow with PKCE, and token validation
- Passkeys in ASP.NET Core Identity: phishing-resistant sign-in, registration, and account recovery considerations
- Cookie and token security, secure session handling, and backend-for-frontend (BFF) patterns for browser clients
- .NET 10 cookie authentication behavior: 401/403 responses instead of login redirects for known API endpoints
- Policy- and resource-based authorization, object-level access checks, tenant isolation, and service-to-service identities
Day 2: Data Protection and Secure Azure Operations
- TLS, HSTS, certificate validation, and avoiding insecure development settings in production
- ASP.NET Core Data Protection: purpose isolation, shared key rings, encryption, rotation, and multi-instance hosting
- Azure Key Vault, managed identities, workload identity federation, and validated environment-specific configuration
- Structured and source-generated logging, scopes, personal data and secret redaction, and protected audit trails
- OpenTelemetry, Azure Monitor/Application Insights, and the Aspire dashboard; actionable alerts and incident response
Day 3: AI Application, Agent, and MCP Security
- OWASP Top 10 for LLM Applications: prompt injection, sensitive information disclosure, improper output handling, excessive agency, and unbounded consumption
- Direct and indirect prompt injection in documents, repositories, retrieved content, and tool responses; treating external content as untrusted data
- RAG security: authorization before retrieval, tenant-aware filtering, vector store isolation, data provenance, and poisoning risks
- Tool allowlists, schema and argument validation, server-side authorization for every action, sandboxing, and human approval for high-impact operations
- MCP security practices: scoped access, audience validation, avoiding token passthrough, and confused deputy prevention
- Azure AI Content Safety and Prompt Shields as additional layers, not replacements for authorization or isolation
- Output validation and encoding, safe rendering, sensitive-data handling, token/cost budgets, and security evaluation across supported languages
- Secure use of AI coding assistants: review generated code, dependencies, and tool permissions; protect repository secrets and confidential data
Day 3: Supply Chain Security, Testing, and Deployment
- NuGet Audit in .NET 10: direct and transitive dependency auditing by default for projects targeting net10.0 or later; severity thresholds and reviewed suppressions
- SDK/runtime servicing, security advisories, dependency updates, package source mapping, lock files, SBOMs, signing, and artifact provenance
- Secret scanning, dependency review, SAST with CodeQL/analyzers, DAST, fuzzing, and negative authorization tests
- Least-privilege GitHub Actions workflows, OIDC federation, protected environments, and configuration checks before deployment
- Non-root containers, minimal images, Azure App Service/Container Apps hardening, and Azure Policy
- Repeatable AI security evaluations and regression tests; documenting residual risks and incident response actions
Hands-on Labs
- Threat model a .NET API and its AI integration; identify trust boundaries and prioritize mitigations
- Fix injection and XSS flaws; add request validation, antiforgery protection, secure headers, and safe error responses
- Add Entra ID authentication and resource-based authorization; verify denied cross-user access and API 401/403 responses
- Configure passkey sign-in in an ASP.NET Core Identity sample and review registration and recovery controls
- Move secrets to Azure Key Vault with managed identity; configure shared Data Protection keys and verify redacted telemetry
- Harden a RAG/agent sample against indirect prompt injection; enforce retrieval authorization, tool permissions, output validation, and approval gates
- Run AI security evaluations with synthetic data and compare guardrail results with enforced application controls
- Audit direct and transitive packages, generate an SBOM, and deploy a hardened build through a least-privilege pipeline
Outcomes
Participants leave with a hardened .NET application, tested authorization and AI safeguards, and a practical checklist for secure development and deployment. They can assess application and agent risks, implement layered controls, and use security telemetry and CI/CD checks to maintain those controls as dependencies, models, and cloud services evolve.
Development Environment
Windows, macOS, or Linux with the latest serviced .NET 10 SDK, Git, and Visual Studio 2026 or Visual Studio Code with C# tooling. A current WebAuthn-capable browser and platform authenticator or security key are needed for the passkey lab. Azure labs require a subscription with permission to provision the agreed training resources and access a supported AI model deployment; a GitHub account is required for pipeline exercises. Use an isolated training environment and synthetic data only. Azure and model usage may incur costs; resource access and lab setup are agreed before the workshop.