Microsoft Foundry SDK for .NET 2.0
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
2prompts
- C# 14106 lines · 4.4K tokens
- Microsoft Foundry SDK for .NET 2.056 lines · 1.7K tokens
Total162 lines · 6.1K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 257
- 295
- 319
- 323
- 327
- 338
- 362
- 367
- 378
- 426
- 502
- 532
- 611
- 639
- 674
- 759
- 770
- 772
- 775
- 798
- 807
- 862
- 863
- 915
- 916
- 918
- 922
- 1333
- 1395
- 1426
- 1427
Prompt Preview
Apply the C# 14 baseline first. These rules cover Azure.AI.Projects 2.0 project clients, identity, connections, agents, assets, datasets, evaluation, tracing, networking, and operations.
Project client and identity
- Construct
AIProjectClientwith the exact trusted HTTPS project endpoint<account>.services.ai.azure.com/api/projects/<project>and aTokenCredential; never accept the endpoint, account, or project path from a caller. - Use the Foundry data-plane
v1endpoint expected by Azure.AI.Projects 2.0; do not carry forward hub-project connection strings or old beta endpoint assumptions. - Prefer
ManagedIdentityCredentialor a deliberately constrainedDefaultAzureCredentialin production so developer CLI, IDE, or interactive credentials cannot be selected unexpectedly. - Assign separate least-privilege Azure roles to application, agent administration, connection administration, dataset upload, evaluation, and deployment identities.
- Scope each client and cached resource identifier to one environment, Entra tenant, Foundry project, and privilege boundary; a resource ID returned by the SDK is not proof of caller access.
Connections and secret material
- List connections with
Connections.GetConnections()and retrieve them withincludeCredentials:false, the default; treatincludeCredentials:trueand credential-returning helpers as secret-export operations restricted to an administrative path. - Never send returned connection keys, access tokens, SAS values, or credential-bearing
ClientConnectionobjects to logs, model context, traces, API