Skip to content

Commit d5f74c2

Browse files
Added support for provisioning AI Foundry Projects (Azure#48314)
* Foundry project provisioning works. Connection URIs are dummy * can now add openai connection without having to manually specify the URI * fixed tests * cleanup * updated cm APIs * PR feedback * user assigned does not work for workspaces * removed ai services * fixed a bug
1 parent e1740e1 commit d5f74c2

20 files changed

+659
-41
lines changed

sdk/cloudmachine/Azure.CloudMachine.OpenAI/api/Azure.CloudMachine.OpenAI.net8.0.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public partial class OpenAIModelFeature : Azure.CloudMachine.Core.CloudMachineFe
4646
public OpenAIModelFeature(string model, string modelVersion, Azure.CloudMachine.OpenAI.AIModelKind kind = Azure.CloudMachine.OpenAI.AIModelKind.Chat) { }
4747
public string Model { get { throw null; } }
4848
public string ModelVersion { get { throw null; } }
49-
protected override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
49+
public Azure.Core.ClientConnection CreateConnection(string cmId) { throw null; }
50+
protected override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
5051
protected override void EmitFeatures(Azure.CloudMachine.Core.FeatureCollection features, string cmId) { }
5152
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm) { throw null; }
5253
}

sdk/cloudmachine/Azure.CloudMachine.OpenAI/api/Azure.CloudMachine.OpenAI.netstandard2.0.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public partial class OpenAIModelFeature : Azure.CloudMachine.Core.CloudMachineFe
4646
public OpenAIModelFeature(string model, string modelVersion, Azure.CloudMachine.OpenAI.AIModelKind kind = Azure.CloudMachine.OpenAI.AIModelKind.Chat) { }
4747
public string Model { get { throw null; } }
4848
public string ModelVersion { get { throw null; } }
49-
protected override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
49+
public Azure.Core.ClientConnection CreateConnection(string cmId) { throw null; }
50+
protected override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
5051
protected override void EmitFeatures(Azure.CloudMachine.Core.FeatureCollection features, string cmId) { }
5152
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm) { throw null; }
5253
}

sdk/cloudmachine/Azure.CloudMachine.OpenAI/src/OpenAIFeature.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using System.Collections.Generic;
45
using Azure.CloudMachine.Core;
56
using Azure.Core;
67
using Azure.Provisioning.CognitiveServices;
@@ -23,7 +24,7 @@ protected override ProvisionableResource EmitResources(ProjectInfrastructure clo
2324
return cognitiveServices;
2425
}
2526

26-
protected override void EmitConnections(ConnectionCollection connections, string cmId)
27+
protected override void EmitConnections(ICollection<ClientConnection> connections, string cmId)
2728
{
2829
ClientConnection connection = new("Azure.AI.OpenAI.AzureOpenAIClient", $"https://{cmId}.openai.azure.com");
2930

@@ -32,7 +33,7 @@ protected override void EmitConnections(ConnectionCollection connections, string
3233
connections.Add(connection);
3334
}
3435
}
35-
internal void EmitConnectionsInternal(ConnectionCollection connections, string cmId)
36+
internal void EmitConnectionsInternal(ICollection<ClientConnection> connections, string cmId)
3637
=> EmitConnections(connections, cmId);
3738

3839
internal static CognitiveServicesAccount CreateOpenAIAccount(ProjectInfrastructure cm)

sdk/cloudmachine/Azure.CloudMachine.OpenAI/src/OpenAIModelFeature.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Collections.Generic;
56
using System.Linq;
67
using Azure.CloudMachine.Core;
78
using Azure.Core;
@@ -40,6 +41,17 @@ public OpenAIModelFeature(string model, string modelVersion, AIModelKind kind =
4041

4142
internal OpenAIFeature Account { get; set; } = default!;
4243

44+
/// <summary>
45+
/// Creates client connection for the resource.
46+
/// </summary>
47+
/// <param name="cmId"></param>
48+
/// <returns></returns>
49+
/// <exception cref="NotImplementedException"></exception>
50+
public ClientConnection CreateConnection(string cmId)
51+
{
52+
ClientConnection connection = new("Azure.AI.OpenAI.AzureOpenAIClient", $"https://{cmId}.openai.azure.com");
53+
return connection;
54+
}
4355
/// <summary>
4456
/// Emit the feature.
4557
/// </summary>
@@ -64,7 +76,7 @@ protected override void EmitFeatures(FeatureCollection features, string cmId)
6476
/// <param name="connections"></param>
6577
/// <param name="cmId"></param>
6678
/// <exception cref="NotImplementedException"></exception>
67-
protected override void EmitConnections(ConnectionCollection connections, string cmId)
79+
protected override void EmitConnections(ICollection<ClientConnection> connections, string cmId)
6880
{
6981
Account.EmitConnectionsInternal(connections, cmId);
7082
// add connections

sdk/cloudmachine/Azure.CloudMachine.sln

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.CloudMachine.OpenAI",
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.CloudMachine.OpenAI.Tests", "Azure.CloudMachine.OpenAI\tests\Azure.CloudMachine.OpenAI.Tests.csproj", "{27CF03E3-50A8-4E15-B74D-2F4225E6E43F}"
1717
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Provisioning.CloudMachine", "Azure.Provisioning.CloudMachine\src\Azure.Provisioning.CloudMachine.csproj", "{F56734C2-45CC-4D00-9B00-44425958F34F}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Provisioning.Deployment", "..\provisioning\Azure.Provisioning.Deployment\src\Azure.Provisioning.Deployment.csproj", "{04532CB2-F363-47CC-9E7E-0BDEA4F77995}"
21+
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Provisioning", "..\provisioning\Azure.Provisioning\src\Azure.Provisioning.csproj", "{179F423F-5475-401B-97D8-33E3C8C9998D}"
23+
EndProject
24+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Core.TestFramework", "..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{FAFABA93-5402-474D-8131-DD276FE6DDF0}"
25+
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Core", "..\core\Azure.Core\src\Azure.Core.csproj", "{79FC1E03-1C11-406E-A5FA-51A9C6DDF41A}"
27+
EndProject
28+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Provisioning.CloudMachine.Tests", "Azure.Provisioning.CloudMachine\tests\Azure.Provisioning.CloudMachine.Tests.csproj", "{028CD687-0925-49A8-8521-8E517DACD371}"
29+
EndProject
1830
Global
1931
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2032
Debug|Any CPU = Debug|Any CPU
2133
Release|Any CPU = Release|Any CPU
2234
EndGlobalSection
23-
GlobalSection(SolutionProperties) = preSolution
24-
HideSolutionNode = FALSE
25-
EndGlobalSection
2635
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2736
{0EA29D2F-41E0-4826-9CD4-111109A2CFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2837
{0EA29D2F-41E0-4826-9CD4-111109A2CFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -40,6 +49,33 @@ Global
4049
{27CF03E3-50A8-4E15-B74D-2F4225E6E43F}.Debug|Any CPU.Build.0 = Debug|Any CPU
4150
{27CF03E3-50A8-4E15-B74D-2F4225E6E43F}.Release|Any CPU.ActiveCfg = Release|Any CPU
4251
{27CF03E3-50A8-4E15-B74D-2F4225E6E43F}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{F56734C2-45CC-4D00-9B00-44425958F34F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{F56734C2-45CC-4D00-9B00-44425958F34F}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{F56734C2-45CC-4D00-9B00-44425958F34F}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{F56734C2-45CC-4D00-9B00-44425958F34F}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{04532CB2-F363-47CC-9E7E-0BDEA4F77995}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{04532CB2-F363-47CC-9E7E-0BDEA4F77995}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{04532CB2-F363-47CC-9E7E-0BDEA4F77995}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{04532CB2-F363-47CC-9E7E-0BDEA4F77995}.Release|Any CPU.Build.0 = Release|Any CPU
60+
{179F423F-5475-401B-97D8-33E3C8C9998D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61+
{179F423F-5475-401B-97D8-33E3C8C9998D}.Debug|Any CPU.Build.0 = Debug|Any CPU
62+
{179F423F-5475-401B-97D8-33E3C8C9998D}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{179F423F-5475-401B-97D8-33E3C8C9998D}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{FAFABA93-5402-474D-8131-DD276FE6DDF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{FAFABA93-5402-474D-8131-DD276FE6DDF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{FAFABA93-5402-474D-8131-DD276FE6DDF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{FAFABA93-5402-474D-8131-DD276FE6DDF0}.Release|Any CPU.Build.0 = Release|Any CPU
68+
{79FC1E03-1C11-406E-A5FA-51A9C6DDF41A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69+
{79FC1E03-1C11-406E-A5FA-51A9C6DDF41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
70+
{79FC1E03-1C11-406E-A5FA-51A9C6DDF41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
71+
{79FC1E03-1C11-406E-A5FA-51A9C6DDF41A}.Release|Any CPU.Build.0 = Release|Any CPU
72+
{028CD687-0925-49A8-8521-8E517DACD371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73+
{028CD687-0925-49A8-8521-8E517DACD371}.Debug|Any CPU.Build.0 = Debug|Any CPU
74+
{028CD687-0925-49A8-8521-8E517DACD371}.Release|Any CPU.ActiveCfg = Release|Any CPU
75+
{028CD687-0925-49A8-8521-8E517DACD371}.Release|Any CPU.Build.0 = Release|Any CPU
76+
EndGlobalSection
77+
GlobalSection(SolutionProperties) = preSolution
78+
HideSolutionNode = FALSE
4379
EndGlobalSection
4480
GlobalSection(NestedProjects) = preSolution
4581
{0EA29D2F-41E0-4826-9CD4-111109A2CFF7} = {780138CF-68C6-4323-982F-F18989E2FA86}

sdk/cloudmachine/Azure.Provisioning.CloudMachine/api/Azure.Provisioning.CloudMachine.net8.0.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ namespace Azure.CloudMachine.AIFoundry
5151
{
5252
public partial class AIFoundryFeature : Azure.CloudMachine.Core.CloudMachineFeature
5353
{
54+
public AIFoundryFeature() { }
5455
public AIFoundryFeature(string connectionString) { }
55-
protected internal override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
56+
public System.Collections.Generic.List<Azure.Core.ClientConnection> Connections { get { throw null; } set { } }
57+
protected internal override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
5658
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm) { throw null; }
5759
}
5860
}
@@ -73,7 +75,7 @@ protected CloudMachineFeature() { }
7375
protected internal System.Collections.Generic.Dictionary<Azure.Provisioning.Primitives.Provisionable, (string RoleName, string RoleId)[]> RequiredSystemRoles { get { throw null; } }
7476
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
7577
public Azure.Provisioning.Primitives.ProvisionableResource Resource { get { throw null; } }
76-
protected internal virtual void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
78+
protected internal virtual void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
7779
protected internal virtual void EmitFeatures(Azure.CloudMachine.Core.FeatureCollection features, string cmId) { }
7880
protected abstract Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm);
7981
protected static T EnsureEmits<T>(Azure.CloudMachine.Core.CloudMachineFeature feature) { throw null; }
@@ -99,7 +101,7 @@ public partial class KeyVaultFeature : Azure.CloudMachine.Core.CloudMachineFeatu
99101
{
100102
public KeyVaultFeature(Azure.Provisioning.KeyVault.KeyVaultSku? sku = null) { }
101103
public Azure.Provisioning.KeyVault.KeyVaultSku Sku { get { throw null; } set { } }
102-
protected internal override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
104+
protected internal override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
103105
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure infrastructure) { throw null; }
104106
}
105107
}

sdk/cloudmachine/Azure.Provisioning.CloudMachine/api/Azure.Provisioning.CloudMachine.netstandard2.0.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ namespace Azure.CloudMachine.AIFoundry
5151
{
5252
public partial class AIFoundryFeature : Azure.CloudMachine.Core.CloudMachineFeature
5353
{
54+
public AIFoundryFeature() { }
5455
public AIFoundryFeature(string connectionString) { }
55-
protected internal override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
56+
public System.Collections.Generic.List<Azure.Core.ClientConnection> Connections { get { throw null; } set { } }
57+
protected internal override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
5658
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm) { throw null; }
5759
}
5860
}
@@ -73,7 +75,7 @@ protected CloudMachineFeature() { }
7375
protected internal System.Collections.Generic.Dictionary<Azure.Provisioning.Primitives.Provisionable, (string RoleName, string RoleId)[]> RequiredSystemRoles { get { throw null; } }
7476
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
7577
public Azure.Provisioning.Primitives.ProvisionableResource Resource { get { throw null; } }
76-
protected internal virtual void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
78+
protected internal virtual void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
7779
protected internal virtual void EmitFeatures(Azure.CloudMachine.Core.FeatureCollection features, string cmId) { }
7880
protected abstract Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure cm);
7981
protected static T EnsureEmits<T>(Azure.CloudMachine.Core.CloudMachineFeature feature) { throw null; }
@@ -99,7 +101,7 @@ public partial class KeyVaultFeature : Azure.CloudMachine.Core.CloudMachineFeatu
99101
{
100102
public KeyVaultFeature(Azure.Provisioning.KeyVault.KeyVaultSku? sku = null) { }
101103
public Azure.Provisioning.KeyVault.KeyVaultSku Sku { get { throw null; } set { } }
102-
protected internal override void EmitConnections(Azure.Core.ConnectionCollection connections, string cmId) { }
104+
protected internal override void EmitConnections(System.Collections.Generic.ICollection<Azure.Core.ClientConnection> connections, string cmId) { }
103105
protected override Azure.Provisioning.Primitives.ProvisionableResource EmitResources(Azure.CloudMachine.ProjectInfrastructure infrastructure) { throw null; }
104106
}
105107
}

sdk/cloudmachine/Azure.Provisioning.CloudMachine/src/CloudMachineInfrastructure/CloudMachineFeature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class CloudMachineFeature
1414
private ProvisionableResource? _resource;
1515

1616
protected abstract ProvisionableResource EmitResources(ProjectInfrastructure cm);
17-
protected internal virtual void EmitConnections(ConnectionCollection connections, string cmId) { }
17+
protected internal virtual void EmitConnections(ICollection<ClientConnection> connections, string cmId) { }
1818
protected internal virtual void EmitFeatures(FeatureCollection features, string cmId)
1919
=> features.Add(this);
2020

sdk/cloudmachine/Azure.Provisioning.CloudMachine/src/FeaturesBuiltIn/AIFoundryFeature.cs

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Collections.Generic;
56
using Azure.CloudMachine.Core;
67
using Azure.Core;
78
using Azure.Identity;
9+
using Azure.Provisioning.AIFoundry;
810
using Azure.Provisioning.Primitives;
911

1012
namespace Azure.CloudMachine.AIFoundry
@@ -14,7 +16,7 @@ namespace Azure.CloudMachine.AIFoundry
1416
/// </summary>
1517
public class AIFoundryFeature : CloudMachineFeature
1618
{
17-
private readonly string _connectionString;
19+
private string? _connectionString;
1820

1921
/// <summary>
2022
/// Initializes a new instance of the <see cref="AIFoundryFeature"/> class.
@@ -35,31 +37,43 @@ public AIFoundryFeature(string connectionString)
3537
_connectionString = connectionString;
3638
}
3739

40+
/// <summary>
41+
/// Creates a new feature for provisioning.
42+
/// </summary>
43+
public AIFoundryFeature()
44+
{
45+
}
46+
47+
public List<ClientConnection> Connections { get; set; } = new List<ClientConnection>();
48+
3849
/// <summary>
3950
/// Emit the Foundry connection(s) into the shared <see cref="ConnectionCollection"/>.
4051
/// </summary>
4152
/// <param name="connections">The global collection of <see cref="ClientConnection"/> objects for this CloudMachine. </param>
4253
/// <param name="cmId">The unique CloudMachine ID</param>
43-
protected internal override void EmitConnections(ConnectionCollection connections, string cmId)
54+
protected internal override void EmitConnections(ICollection<ClientConnection> connections, string cmId)
4455
{
45-
const string foundryId = "Azure.AI.Projects.AIProjectClient";
46-
connections.Add(new ClientConnection(foundryId, _connectionString));
56+
if (_connectionString != null)
57+
{
58+
const string foundryId = "Azure.AI.Projects.AIProjectClient";
59+
connections.Add(new ClientConnection(foundryId, _connectionString));
4760

48-
var foundryConnections = new AIFoundryConnections(_connectionString, new DefaultAzureCredential());
61+
var foundryConnections = new AIFoundryConnections(_connectionString, new DefaultAzureCredential());
4962

50-
// Add OpenAI connections
51-
connections.Add(foundryConnections.GetConnection("Azure.AI.OpenAI.AzureOpenAIClient"));
52-
connections.Add(foundryConnections.GetConnection("OpenAI.Chat.ChatClient"));
53-
connections.Add(foundryConnections.GetConnection("OpenAI.Embeddings.EmbeddingClient"));
63+
// Add OpenAI connections
64+
connections.Add(foundryConnections.GetConnection("Azure.AI.OpenAI.AzureOpenAIClient"));
65+
connections.Add(foundryConnections.GetConnection("OpenAI.Chat.ChatClient"));
66+
connections.Add(foundryConnections.GetConnection("OpenAI.Embeddings.EmbeddingClient"));
5467

55-
// Add Inference connections
56-
connections.Add(foundryConnections.GetConnection("Azure.AI.Inference.ChatCompletionsClient"));
57-
connections.Add(foundryConnections.GetConnection("Azure.AI.Inference.EmbeddingsClient"));
68+
// Add Inference connections
69+
connections.Add(foundryConnections.GetConnection("Azure.AI.Inference.ChatCompletionsClient"));
70+
connections.Add(foundryConnections.GetConnection("Azure.AI.Inference.EmbeddingsClient"));
5871

59-
// Add Search connections
60-
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.SearchClient"));
61-
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.Indexes.SearchIndexClient"));
62-
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.Indexes.SearchIndexerClient"));
72+
// Add Search connections
73+
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.SearchClient"));
74+
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.Indexes.SearchIndexClient"));
75+
connections.Add(foundryConnections.GetConnection("Azure.Search.Documents.Indexes.SearchIndexerClient"));
76+
}
6377
}
6478

6579
/// <summary>
@@ -69,8 +83,21 @@ protected internal override void EmitConnections(ConnectionCollection connection
6983
/// <returns>A placeholder or no-op resource, as provisioning is out-of-band for now.</returns>
7084
protected override ProvisionableResource EmitResources(ProjectInfrastructure cm)
7185
{
72-
// In the future, generate real provisioning resources for Foundry
73-
return new NoOpResource();
86+
var cmId = cm.Id;
87+
AIFoundryHubCdk hub = new($"{cmId}_hub", $"{cmId}_hub");
88+
AIFoundryProjectCdk project = new($"{cmId}_project", $"{cmId}_project", hub);
89+
90+
cm.AddResource(hub);
91+
cm.AddResource(project);
92+
93+
for (int i = 0; i < Connections.Count; i++)
94+
{
95+
ClientConnection connection = Connections[i];
96+
AIFoundryConnectionCdk connectionCdk = new($"{cmId}connection{i}", connection.Id, connection.Locator, project);
97+
cm.AddResource(connectionCdk);
98+
}
99+
100+
return project;
74101
}
75102
}
76103
}

0 commit comments

Comments
 (0)