Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@ param api_identity_outputs_id string

param api_identity_outputs_clientid string

resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
name: 'main'
properties: {
authType: 'UserAssigned'
image: api_containerimage
isMain: true
userManagedIdentityClientId: infra_outputs_azure_container_registry_managed_identity_client_id
}
parent: webapp
}

resource webapp 'Microsoft.Web/sites@2024-04-01' = {
name: take('${toLower('api')}-${uniqueString(resourceGroup().id)}', 60)
location: location
properties: {
serverFarmId: infra_outputs_planid
keyVaultReferenceIdentity: api_identity_outputs_id
siteConfig: {
linuxFxVersion: 'DOCKER|${api_containerimage}'
linuxFxVersion: 'SITECONTAINERS'
acrUseManagedIdentityCreds: true
acrUserManagedIdentityID: infra_outputs_azure_container_registry_managed_identity_client_id
appSettings: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ resource infra_asplan 'Microsoft.Web/serverfarms@2024-04-01' = {
}
kind: 'Linux'
sku: {
name: 'B1'
tier: 'Basic'
name: 'P0V3'
tier: 'Premium'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static IResourceBuilder<AzureAppServiceEnvironmentResource> AddAzureAppSe
{
Sku = new AppServiceSkuDescription
{
Name = "B1",
Tier = "Basic"
Name = "P0V3",
Tier = "Premium"
Comment on lines +87 to +88
Copy link
Member

Choose a reason for hiding this comment

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

I'm having second thoughts about this one.

},
Kind = "Linux",
IsReserved = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ public void BuildWebSite(AzureResourceInfrastructure infra)
// Use the host name as the name of the web app
Name = HostName,
AppServicePlanId = appServicePlanParameter,
// Creating the app service with new sidecar configuration
SiteConfig = new SiteConfigProperties()
{
LinuxFxVersion = BicepFunction.Interpolate($"DOCKER|{containerImage}"),
LinuxFxVersion = "SITECONTAINERS",
Copy link
Member

Choose a reason for hiding this comment

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

Confused by this change. Why do we need sidecars? Or is this just the new way of using containers?

Copy link

@btardif btardif May 13, 2025

Choose a reason for hiding this comment

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

yes this is what we want to do going fwd instead of overloading the linuxFX version. There is no sidecar being configured here

Copy link
Member

Choose a reason for hiding this comment

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

Why is the port hardcoded to 8080?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed setting the port as it is inferred by the platform. Validated with the changes in fork code

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this need to be set to the internal port of the http endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When TargetPort is not specified, our container orchestrator can infer the exposed PORT in the container image and use it for serving the http traffic. So, explicitly mentioning TargetPort is not required.

AcrUserManagedIdentityId = acrClientIdParameter,
UseManagedIdentityCreds = true,
AppSettings = []
Expand All @@ -226,6 +227,19 @@ public void BuildWebSite(AzureResourceInfrastructure infra)
},
};

// Defining the main container for the app service
var mainContainer = new SiteContainer("mainContainer")
{
Parent = webSite,
Name = "main",
Image = containerImage,
AuthType = SiteContainerAuthType.UserAssigned,
UserManagedIdentityClientId = acrClientIdParameter,
IsMain = true
};

infra.Add(mainContainer);

foreach (var kv in EnvironmentVariables)
{
var (val, secretType) = ProcessValue(kv.Value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ param api_containerimage string

param api_containerport string

resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
name: 'main'
properties: {
authType: 'UserAssigned'
image: api_containerimage
isMain: true
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
}
parent: webapp
}

resource webapp 'Microsoft.Web/sites@2024-04-01' = {
name: take('${toLower('api')}-${uniqueString(resourceGroup().id)}', 60)
location: location
properties: {
serverFarmId: env_outputs_planid
siteConfig: {
linuxFxVersion: 'DOCKER|${api_containerimage}'
linuxFxVersion: 'SITECONTAINERS'
acrUseManagedIdentityCreds: true
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
appSettings: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ resource env_asplan 'Microsoft.Web/serverfarms@2024-04-01' = {
}
kind: 'Linux'
sku: {
name: 'B1'
tier: 'Basic'
name: 'P0V3'
tier: 'Premium'
}
}

Expand All @@ -51,4 +51,4 @@ output AZURE_CONTAINER_REGISTRY_ENDPOINT string = env_acr.properties.loginServer

output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID string = env_mi.id

output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID string = env_mi.properties.clientId
output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID string = env_mi.properties.clientId
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ param project2_containerimage string

param project2_containerport string

resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
name: 'main'
properties: {
authType: 'UserAssigned'
image: project2_containerimage
isMain: true
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
}
parent: webapp
}

resource webapp 'Microsoft.Web/sites@2024-04-01' = {
name: take('${toLower('project2')}-${uniqueString(resourceGroup().id)}', 60)
location: location
properties: {
serverFarmId: env_outputs_planid
siteConfig: {
linuxFxVersion: 'DOCKER|${project2_containerimage}'
linuxFxVersion: 'SITECONTAINERS'
acrUseManagedIdentityCreds: true
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
appSettings: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ param api_identity_outputs_id string

param api_identity_outputs_clientid string

resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
name: 'main'
properties: {
authType: 'UserAssigned'
image: api_containerimage
isMain: true
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
}
parent: webapp
}

resource mydb_kv_outputs_name_kv 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
name: mydb_kv_outputs_name
}
Expand All @@ -33,7 +44,7 @@ resource webapp 'Microsoft.Web/sites@2024-04-01' = {
serverFarmId: env_outputs_planid
keyVaultReferenceIdentity: api_identity_outputs_id
siteConfig: {
linuxFxVersion: 'DOCKER|${api_containerimage}'
linuxFxVersion: 'SITECONTAINERS'
acrUseManagedIdentityCreds: true
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
appSettings: [
Expand Down