Skip to content

Add IAzurePrivateEndpointTarget support to AzureOpenAIResource and FoundryResource#15945

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-private-endpoint-support
Draft

Add IAzurePrivateEndpointTarget support to AzureOpenAIResource and FoundryResource#15945
Copilot wants to merge 3 commits intomainfrom
copilot/add-private-endpoint-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Description

AzureOpenAIResource and FoundryResource now implement IAzurePrivateEndpointTarget, enabling private endpoint connectivity.

  • AzureOpenAIResource: group ID "account", DNS zone "privatelink.openai.azure.com"
  • FoundryResource: group ID "account", DNS zone "privatelink.cognitiveservices.azure.com"
  • Both resources gain a BicepOutputReference Id property and emit the id bicep output in their infrastructure configuration
  • Bicep-baseline tests verify the generated private endpoint bicep output for both resources via Verify snapshots in AzurePrivateEndpointLockdownTests
var vnet = builder.AddAzureVirtualNetwork("myvnet");
var subnet = vnet.AddSubnet("pesubnet", "10.0.1.0/24");
var openai = builder.AddAzureOpenAI("openai");
var pe = subnet.AddPrivateEndpoint(openai);

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

…undryResource

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/c060fb13-56b1-4905-9cbc-b78a181f5062

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for private endpoints in AzureOpenAI and Foundry resources Add IAzurePrivateEndpointTarget support to AzureOpenAIResource and FoundryResource Apr 7, 2026
Copilot AI requested a review from eerhardt April 7, 2026 22:22
}

[Fact]
public void AzureOpenAIResource_ImplementsIAzurePrivateEndpointTarget()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot - make better tests here. Instead of just checking it implements the interface, baseline the bicep produced when using these resources as private endpoints.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced the simple interface-check tests with proper bicep-baseline tests in AzurePrivateEndpointLockdownTests, following the existing pattern used for CosmosDB, SQL, etc. The new tests (AddAzureOpenAI_WithPrivateEndpoint_GeneratesCorrectBicep and AddFoundry_WithPrivateEndpoint_GeneratesCorrectBicep) create private endpoints and verify the generated bicep via Verify snapshots. (6cfbc31)


IEnumerable<string> IAzurePrivateEndpointTarget.GetPrivateLinkGroupIds() => ["account"];

string IAzurePrivateEndpointTarget.GetPrivateDnsZoneName() => "privatelink.openai.azure.com";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Are these the correct Dns zone names? Will they always work? Does Cognitive Services need more than 1?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The DNS zone names and group IDs are correct per Azure Private Link DNS zone configuration:

  • Azure OpenAI (Kind="OpenAI", resource type Microsoft.CognitiveServices/accounts): DNS zone privatelink.openai.azure.com, group ID account. OpenAI has its own dedicated DNS zone separate from other Cognitive Services.
  • Foundry/AI Services (Kind="AIServices", resource type Microsoft.CognitiveServices/accounts): DNS zone privatelink.cognitiveservices.azure.com, group ID account. This is the general Cognitive Services DNS zone used for AI Services accounts.

Both use account as the only group ID — Cognitive Services resources don't have sub-resource group IDs like Storage does (blob, queue, table, etc.). The account group ID covers the entire Cognitive Services account endpoint. You can see the new bicep baselines in the snapshot files confirming this produces correct private endpoint configurations.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 7, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet build tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj /p:SkipNativeBuild=true (dns block)
  • learn.microsoft.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from eerhardt April 7, 2026 22:44
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.

AddAzureOpenAI and AddFoundry should support private endpoints

2 participants