Skip to content

Add control-plane Azure Policy walkthroughs to egress samples - #1052

Merged
djetchev merged 3 commits into
mainfrom
djetchev/egress-control-plane-policy-sample
Oct 9, 2026
Merged

djetchev merged 3 commits into
mainfrom
djetchev/egress-control-plane-policy-sample

Conversation

@djetchev

@djetchev djetchev commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a custom 92-line Azure Policy definition to the Python and .NET egress-control samples
  • add assignment parameters plus compliant and noncompliant RAI-policy request examples
  • demonstrate an allowed write and an ARM RequestDisallowedByPolicy denial without requiring a model deployment or running hosted agent
  • distinguish Azure Policy definition effect, assignment enforcementMode, and RAI runtime egressPolicy.mode
  • explain Default versus DoNotEnforce while keeping denied-update and runtime checks optional

This is a bounded exact-host teaching policy, not the full built-in governance policy. It demonstrates control-plane ARM enforcement and does not claim APES or runtime traffic enforcement.

This public contribution ports and completes the work originally reviewed in microsoft-foundry/foundry-samples-pr#1049.

Validation

  • bash .github/scripts/validate-sample.sh --language python --sample-dir samples/python/hosted-agents/agent-framework/responses/18-egress-control
  • bash .github/scripts/validate-sample.sh --language csharp --sample-dir samples/csharp/hosted-agents/agent-framework/egress-control
  • validated all added JSON files with jq
  • verified the five duplicated control-plane files are byte-for-byte identical between Python and .NET
  • git diff --check

The original private PR records live West US 2 validation for allowed create, denied create/update, unchanged rejected-update state, hosted-agent outbound behavior, and cleanup. This public port does not change the validated policy definition or request artifacts. The optional DoNotEnforce flow is documentation-only and was not rerun live as part of this port.

Add the custom exact-host Azure Policy definition, assignment parameters, allowed and denied RAI policy examples, and matching walkthroughs to the Python and .NET egress samples.

The documentation distinguishes policy effect, assignment enforcement mode, and RAI runtime enforcement, including an optional Default versus DoNotEnforce comparison.

Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 699774a2-7282-41a8-9946-5a8b05ba6c35
@djetchev
djetchev requested a review from a team as a code owner October 6, 2026 16:24
Copilot AI balanced review requested due to automatic review settings October 6, 2026 16:24
@djetchev
djetchev deployed to L4-validation October 6, 2026 16:25 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The optional .NET deployment instructions omit a required policy-ID materialization step.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
What changed in this PR

Adds mirrored Azure Policy control-plane walkthroughs to the Python and .NET egress samples.

Changes:

  • Adds an exact-host governance policy and assignment parameters.
  • Demonstrates compliant and denied RAI-policy writes.
  • Documents enforcement modes, optional runtime checks, and cleanup.
File Description
samples/​python/​.../​18-egress-control/​README.md Links the control-plane walkthrough.
samples/​python/​.../​control-plane/​README.md Documents the Python walkthrough.
samples/​python/​.../​control-plane/​policy-definition.json Defines host governance rules.
samples/​python/​.../​control-plane/​assignment-parameters.json Configures approved hosts and denial.
samples/​python/​.../​control-plane/​rai-policy-allowed.json Provides a compliant request.
samples/​python/​.../​control-plane/​rai-policy-denied.json Provides a noncompliant request.
samples/​csharp/​.../​egress-control/​README.md Links the control-plane walkthrough.
samples/​csharp/​.../​control-plane/​README.md Documents the .NET walkthrough.
samples/​csharp/​.../​control-plane/​policy-definition.json Mirrors the governance definition.
samples/​csharp/​.../​control-plane/​assignment-parameters.json Mirrors assignment parameters.
samples/​csharp/​.../​control-plane/​rai-policy-allowed.json Mirrors the compliant request.
samples/​csharp/​.../​control-plane/​rai-policy-denied.json Mirrors the noncompliant request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Add the required azure.yaml materialization step before deploying the accepted policy with the .NET sample.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 699774a2-7282-41a8-9946-5a8b05ba6c35
Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:20
@djetchev
djetchev deployed to L4-validation October 8, 2026 12:20 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Final approval requires human confirmation of the new RAI aliases and live Azure Policy behavior against the preview API.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cleanup instructions need explicit identity-switch guidance to avoid leaving RAI-policy resources behind.

2 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Separate administrator cleanup of the policy assignment and definition from developer cleanup of the test RAI policy resources.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 699774a2-7282-41a8-9946-5a8b05ba6c35
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:32
@djetchev
djetchev deployed to L4-validation October 8, 2026 15:33 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The mirrored artifacts are consistent, scoped appropriately, and provide complete setup, verification, boundary, and cleanup guidance.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@djetchev
djetchev merged commit d3171cb into main Oct 9, 2026
21 checks passed
@djetchev
djetchev deleted the djetchev/egress-control-plane-policy-sample branch October 9, 2026 21:17

This branch was successfully deployed

1 active deployment
L4-validation — 6a5dee60 Deployed Oct 8, 2026 by djetchev via trusted #468
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants