Skip to content

Commit 3f20f4a

Browse files
Changing default SKU for App Service Plan to P0V3 (#9280)
* Changing default SKU for App Service Plan to P0V3 * Removed TargetPort property from sitecontainer definition * Updated manifest file for sample appservice project * Updated the comments related to sidecar configuration * Fixed failing AppService unit tests
1 parent 15212ad commit 3f20f4a

8 files changed

Lines changed: 70 additions & 12 deletions

playground/AzureAppService/AzureAppService.AppHost/api.module.bicep

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,25 @@ param api_identity_outputs_id string
2626

2727
param api_identity_outputs_clientid string
2828

29+
resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
30+
name: 'main'
31+
properties: {
32+
authType: 'UserAssigned'
33+
image: api_containerimage
34+
isMain: true
35+
userManagedIdentityClientId: infra_outputs_azure_container_registry_managed_identity_client_id
36+
}
37+
parent: webapp
38+
}
39+
2940
resource webapp 'Microsoft.Web/sites@2024-04-01' = {
3041
name: take('${toLower('api')}-${uniqueString(resourceGroup().id)}', 60)
3142
location: location
3243
properties: {
3344
serverFarmId: infra_outputs_planid
3445
keyVaultReferenceIdentity: api_identity_outputs_id
3546
siteConfig: {
36-
linuxFxVersion: 'DOCKER|${api_containerimage}'
47+
linuxFxVersion: 'SITECONTAINERS'
3748
acrUseManagedIdentityCreds: true
3849
acrUserManagedIdentityID: infra_outputs_azure_container_registry_managed_identity_client_id
3950
appSettings: [

playground/AzureAppService/AzureAppService.AppHost/infra.module.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ resource infra_asplan 'Microsoft.Web/serverfarms@2024-04-01' = {
3838
}
3939
kind: 'Linux'
4040
sku: {
41-
name: 'B1'
42-
tier: 'Basic'
41+
name: 'P0V3'
42+
tier: 'Premium'
4343
}
4444
}
4545

src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public static IResourceBuilder<AzureAppServiceEnvironmentResource> AddAzureAppSe
8484
{
8585
Sku = new AppServiceSkuDescription
8686
{
87-
Name = "B1",
88-
Tier = "Basic"
87+
Name = "P0V3",
88+
Tier = "Premium"
8989
},
9090
Kind = "Linux",
9191
IsReserved = true

src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ public void BuildWebSite(AzureResourceInfrastructure infra)
212212
// Use the host name as the name of the web app
213213
Name = HostName,
214214
AppServicePlanId = appServicePlanParameter,
215+
// Creating the app service with new sidecar configuration
215216
SiteConfig = new SiteConfigProperties()
216217
{
217-
LinuxFxVersion = BicepFunction.Interpolate($"DOCKER|{containerImage}"),
218+
LinuxFxVersion = "SITECONTAINERS",
218219
AcrUserManagedIdentityId = acrClientIdParameter,
219220
UseManagedIdentityCreds = true,
220221
AppSettings = []
@@ -226,6 +227,19 @@ public void BuildWebSite(AzureResourceInfrastructure infra)
226227
},
227228
};
228229

230+
// Defining the main container for the app service
231+
var mainContainer = new SiteContainer("mainContainer")
232+
{
233+
Parent = webSite,
234+
Name = "main",
235+
Image = containerImage,
236+
AuthType = SiteContainerAuthType.UserAssigned,
237+
UserManagedIdentityClientId = acrClientIdParameter,
238+
IsMain = true
239+
};
240+
241+
infra.Add(mainContainer);
242+
229243
foreach (var kv in EnvironmentVariables)
230244
{
231245
var (val, secretType) = ProcessValue(kv.Value);

tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAppServiceTests.AddContainerAppEnvironmentAddsDeploymentTargetWithContainerAppToProjectResources.verified.bicep

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ param api_containerimage string
1313

1414
param api_containerport string
1515

16+
resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
17+
name: 'main'
18+
properties: {
19+
authType: 'UserAssigned'
20+
image: api_containerimage
21+
isMain: true
22+
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
23+
}
24+
parent: webapp
25+
}
26+
1627
resource webapp 'Microsoft.Web/sites@2024-04-01' = {
1728
name: take('${toLower('api')}-${uniqueString(resourceGroup().id)}', 60)
1829
location: location
1930
properties: {
2031
serverFarmId: env_outputs_planid
2132
siteConfig: {
22-
linuxFxVersion: 'DOCKER|${api_containerimage}'
33+
linuxFxVersion: 'SITECONTAINERS'
2334
acrUseManagedIdentityCreds: true
2435
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
2536
appSettings: [

tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAppServiceTests.AddContainerAppEnvironmentAddsEnvironmentResource.verified.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ resource env_asplan 'Microsoft.Web/serverfarms@2024-04-01' = {
3838
}
3939
kind: 'Linux'
4040
sku: {
41-
name: 'B1'
42-
tier: 'Basic'
41+
name: 'P0V3'
42+
tier: 'Premium'
4343
}
4444
}
4545

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

5252
output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID string = env_mi.id
5353

54-
output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID string = env_mi.properties.clientId
54+
output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID string = env_mi.properties.clientId

tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAppServiceTests.EndpointReferencesAreResolvedAcrossProjects.verified.bicep

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ param project2_containerimage string
1313

1414
param project2_containerport string
1515

16+
resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
17+
name: 'main'
18+
properties: {
19+
authType: 'UserAssigned'
20+
image: project2_containerimage
21+
isMain: true
22+
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
23+
}
24+
parent: webapp
25+
}
26+
1627
resource webapp 'Microsoft.Web/sites@2024-04-01' = {
1728
name: take('${toLower('project2')}-${uniqueString(resourceGroup().id)}', 60)
1829
location: location
1930
properties: {
2031
serverFarmId: env_outputs_planid
2132
siteConfig: {
22-
linuxFxVersion: 'DOCKER|${project2_containerimage}'
33+
linuxFxVersion: 'SITECONTAINERS'
2334
acrUseManagedIdentityCreds: true
2435
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
2536
appSettings: [

tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAppServiceTests.KeyvaultReferenceHandling.verified.bicep

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ param api_identity_outputs_id string
1717

1818
param api_identity_outputs_clientid string
1919

20+
resource mainContainer 'Microsoft.Web/sites/sitecontainers@2024-04-01' = {
21+
name: 'main'
22+
properties: {
23+
authType: 'UserAssigned'
24+
image: api_containerimage
25+
isMain: true
26+
userManagedIdentityClientId: env_outputs_azure_container_registry_managed_identity_client_id
27+
}
28+
parent: webapp
29+
}
30+
2031
resource mydb_kv_outputs_name_kv 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
2132
name: mydb_kv_outputs_name
2233
}
@@ -33,7 +44,7 @@ resource webapp 'Microsoft.Web/sites@2024-04-01' = {
3344
serverFarmId: env_outputs_planid
3445
keyVaultReferenceIdentity: api_identity_outputs_id
3546
siteConfig: {
36-
linuxFxVersion: 'DOCKER|${api_containerimage}'
47+
linuxFxVersion: 'SITECONTAINERS'
3748
acrUseManagedIdentityCreds: true
3849
acrUserManagedIdentityID: env_outputs_azure_container_registry_managed_identity_client_id
3950
appSettings: [

0 commit comments

Comments
 (0)