From 08f8a211b09c0c8ae3f1ef722d379f08c3d294e1 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Thu, 4 Apr 2024 13:07:07 +1100 Subject: [PATCH 01/14] Uses new Azure.Provisioning packages which have been split by resource type. --- Directory.Packages.props | 17 ++++++++++++++++- NuGet.config | 7 +++++++ ...Aspire.Hosting.Azure.AppConfiguration.csproj | 1 + .../AzureAppConfigurationExtensions.cs | 2 +- ...ire.Hosting.Azure.ApplicationInsights.csproj | 1 + ...spire.Hosting.Azure.CognitiveServices.csproj | 1 + .../AzureOpenAIExtensions.cs | 2 +- .../Aspire.Hosting.Azure.CosmosDB.csproj | 1 + .../Aspire.Hosting.Azure.EventHubs.csproj | 1 + .../AzureEventHubsExtensions.cs | 1 - .../Aspire.Hosting.Azure.KeyVault.csproj | 1 + .../AzureKeyVaultResourceExtensions.cs | 2 +- ...ire.Hosting.Azure.OperationalInsights.csproj | 1 + .../Aspire.Hosting.Azure.PostgreSQL.csproj | 1 + .../Aspire.Hosting.Azure.Redis.csproj | 1 + .../Aspire.Hosting.Azure.Search.csproj | 1 + .../AzureSearchExtensions.cs | 2 +- .../Aspire.Hosting.Azure.ServiceBus.csproj | 1 + .../AzureServiceBusExtensions.cs | 1 - .../Aspire.Hosting.Azure.SignalR.csproj | 1 + .../AzureSignalRExtensions.cs | 2 +- .../Aspire.Hosting.Azure.Sql.csproj | 1 + .../Aspire.Hosting.Azure.Storage.csproj | 1 + .../AzureStorageExtensions.cs | 2 +- .../Aspire.Hosting.Azure.csproj | 2 ++ 25 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 27660f7e6b..5b0ecfc11d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -33,7 +33,22 @@ - + + + + + + + + + + + + + + + + diff --git a/NuGet.config b/NuGet.config index 6d66afe4db..74cfe41480 100644 --- a/NuGet.config +++ b/NuGet.config @@ -19,11 +19,18 @@ + + + + + + + diff --git a/src/Aspire.Hosting.Azure.AppConfiguration/Aspire.Hosting.Azure.AppConfiguration.csproj b/src/Aspire.Hosting.Azure.AppConfiguration/Aspire.Hosting.Azure.AppConfiguration.csproj index 44ad59c6e8..e667301a02 100644 --- a/src/Aspire.Hosting.Azure.AppConfiguration/Aspire.Hosting.Azure.AppConfiguration.csproj +++ b/src/Aspire.Hosting.Azure.AppConfiguration/Aspire.Hosting.Azure.AppConfiguration.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs b/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs index 2a7c306e56..973661409d 100644 --- a/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs +++ b/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs @@ -4,8 +4,8 @@ using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; +using Azure.Provisioning; using Azure.Provisioning.AppConfiguration; -using Azure.Provisioning.Authorization; namespace Aspire.Hosting; diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/Aspire.Hosting.Azure.ApplicationInsights.csproj b/src/Aspire.Hosting.Azure.ApplicationInsights/Aspire.Hosting.Azure.ApplicationInsights.csproj index 512f1dd125..974efe2077 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/Aspire.Hosting.Azure.ApplicationInsights.csproj +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/Aspire.Hosting.Azure.ApplicationInsights.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Aspire.Hosting.Azure.CognitiveServices/Aspire.Hosting.Azure.CognitiveServices.csproj b/src/Aspire.Hosting.Azure.CognitiveServices/Aspire.Hosting.Azure.CognitiveServices.csproj index b4ecb9a335..99b8f21109 100644 --- a/src/Aspire.Hosting.Azure.CognitiveServices/Aspire.Hosting.Azure.CognitiveServices.csproj +++ b/src/Aspire.Hosting.Azure.CognitiveServices/Aspire.Hosting.Azure.CognitiveServices.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs b/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs index 79a3e46250..93087af319 100644 --- a/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs +++ b/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; -using Azure.Provisioning.Authorization; +using Azure.Provisioning; using Azure.Provisioning.CognitiveServices; using Azure.ResourceManager.CognitiveServices.Models; diff --git a/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj b/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj index d643ff3ebd..fb0f08d6cc 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj +++ b/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj b/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj index 7ac0b13a5c..401eb5a55a 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj +++ b/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs index 2fb002d011..ce99a19f1f 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs +++ b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs @@ -5,7 +5,6 @@ using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; using Azure.Provisioning; -using Azure.Provisioning.Authorization; using Azure.Provisioning.EventHubs; namespace Aspire.Hosting; diff --git a/src/Aspire.Hosting.Azure.KeyVault/Aspire.Hosting.Azure.KeyVault.csproj b/src/Aspire.Hosting.Azure.KeyVault/Aspire.Hosting.Azure.KeyVault.csproj index dff526470f..7f974e0cd8 100644 --- a/src/Aspire.Hosting.Azure.KeyVault/Aspire.Hosting.Azure.KeyVault.csproj +++ b/src/Aspire.Hosting.Azure.KeyVault/Aspire.Hosting.Azure.KeyVault.csproj @@ -10,6 +10,7 @@ + diff --git a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs index babad98699..0c8cae488f 100644 --- a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs +++ b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; -using Azure.Provisioning.Authorization; +using Azure.Provisioning; using Azure.Provisioning.KeyVaults; namespace Aspire.Hosting; diff --git a/src/Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.OperationalInsights.csproj b/src/Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.OperationalInsights.csproj index 2b65cff8ef..2e6ce04dab 100644 --- a/src/Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.OperationalInsights.csproj +++ b/src/Aspire.Hosting.Azure.OperationalInsights/Aspire.Hosting.Azure.OperationalInsights.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.PostgreSQL/Aspire.Hosting.Azure.PostgreSQL.csproj b/src/Aspire.Hosting.Azure.PostgreSQL/Aspire.Hosting.Azure.PostgreSQL.csproj index 0b1e17aa0d..40b7c4ce43 100644 --- a/src/Aspire.Hosting.Azure.PostgreSQL/Aspire.Hosting.Azure.PostgreSQL.csproj +++ b/src/Aspire.Hosting.Azure.PostgreSQL/Aspire.Hosting.Azure.PostgreSQL.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Aspire.Hosting.Azure.Redis/Aspire.Hosting.Azure.Redis.csproj b/src/Aspire.Hosting.Azure.Redis/Aspire.Hosting.Azure.Redis.csproj index 3bc8b93887..27f424a6a6 100644 --- a/src/Aspire.Hosting.Azure.Redis/Aspire.Hosting.Azure.Redis.csproj +++ b/src/Aspire.Hosting.Azure.Redis/Aspire.Hosting.Azure.Redis.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Aspire.Hosting.Azure.Search/Aspire.Hosting.Azure.Search.csproj b/src/Aspire.Hosting.Azure.Search/Aspire.Hosting.Azure.Search.csproj index df38623843..8d3adf779b 100644 --- a/src/Aspire.Hosting.Azure.Search/Aspire.Hosting.Azure.Search.csproj +++ b/src/Aspire.Hosting.Azure.Search/Aspire.Hosting.Azure.Search.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs b/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs index 6eb0963c6d..7f92e90291 100644 --- a/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs +++ b/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; -using Azure.Provisioning.Authorization; +using Azure.Provisioning; using Azure.Provisioning.Search; using Azure.ResourceManager.Search.Models; diff --git a/src/Aspire.Hosting.Azure.ServiceBus/Aspire.Hosting.Azure.ServiceBus.csproj b/src/Aspire.Hosting.Azure.ServiceBus/Aspire.Hosting.Azure.ServiceBus.csproj index 65417c35ca..a4e9708e2c 100644 --- a/src/Aspire.Hosting.Azure.ServiceBus/Aspire.Hosting.Azure.ServiceBus.csproj +++ b/src/Aspire.Hosting.Azure.ServiceBus/Aspire.Hosting.Azure.ServiceBus.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs index 3a11a518e4..de43af9200 100644 --- a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs +++ b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs @@ -5,7 +5,6 @@ using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; using Azure.Provisioning; -using Azure.Provisioning.Authorization; using Azure.Provisioning.ServiceBus; namespace Aspire.Hosting; diff --git a/src/Aspire.Hosting.Azure.SignalR/Aspire.Hosting.Azure.SignalR.csproj b/src/Aspire.Hosting.Azure.SignalR/Aspire.Hosting.Azure.SignalR.csproj index 9a5913f9f3..7ef490cb06 100644 --- a/src/Aspire.Hosting.Azure.SignalR/Aspire.Hosting.Azure.SignalR.csproj +++ b/src/Aspire.Hosting.Azure.SignalR/Aspire.Hosting.Azure.SignalR.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs b/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs index b95de833d6..49896de823 100644 --- a/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs +++ b/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; -using Azure.Provisioning.Authorization; +using Azure.Provisioning; using Azure.Provisioning.SignalR; namespace Aspire.Hosting; diff --git a/src/Aspire.Hosting.Azure.Sql/Aspire.Hosting.Azure.Sql.csproj b/src/Aspire.Hosting.Azure.Sql/Aspire.Hosting.Azure.Sql.csproj index 0ae482a882..dfac7fd379 100644 --- a/src/Aspire.Hosting.Azure.Sql/Aspire.Hosting.Azure.Sql.csproj +++ b/src/Aspire.Hosting.Azure.Sql/Aspire.Hosting.Azure.Sql.csproj @@ -12,6 +12,7 @@ + diff --git a/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj b/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj index b60189a9da..b7d8e56988 100644 --- a/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj +++ b/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs index c7220c8a70..5582e08c31 100644 --- a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs +++ b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs @@ -5,7 +5,7 @@ using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; using Aspire.Hosting.Utils; -using Azure.Provisioning.Authorization; +using Azure.Provisioning; using Azure.Provisioning.Storage; using Azure.ResourceManager.Storage.Models; diff --git a/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj b/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj index 7a4da38ea0..b52fb7ebda 100644 --- a/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj +++ b/src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj @@ -24,6 +24,8 @@ + + From 5ae0e45120cd66b9ee7377241d6a21ec0ebfd507 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Thu, 4 Apr 2024 13:20:45 +1100 Subject: [PATCH 02/14] Updated manifests for playgrounds. --- .../Properties/launchSettings.json | 12 +++++++ .../EventHubs.AppHost/aspire-manifest.json | 6 ++-- .../EventHubs.AppHost/ehstorage.module.bicep | 35 ++++++++++--------- .../EventHubs.AppHost/eventhubns.module.bicep | 17 +++++---- .../AzureSearch.AppHost/aspire-manifest.json | 6 ++-- .../AzureSearch.AppHost/search.module.bicep | 18 +++++----- .../storage.module.bicep | 35 ++++++++++--------- .../cosmos.module.bicep | 10 +++--- .../openai.module.bicep | 18 +++++----- .../sql1.module.bicep | 15 ++++---- .../BicepSample.AppHost/storage.module.bicep | 3 ++ .../CdkSample.AppHost/storage.module.bicep | 3 ++ .../OrleansAppHost/aspire-manifest.json | 6 ++-- .../OrleansAppHost/storage.module.bicep | 35 ++++++++++--------- .../SignalRAppHost/signalr1.module.bicep | 12 +++---- 15 files changed, 130 insertions(+), 101 deletions(-) diff --git a/playground/AspireEventHub/EventHubs.AppHost/Properties/launchSettings.json b/playground/AspireEventHub/EventHubs.AppHost/Properties/launchSettings.json index 624df5aa4a..c81df05d23 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/Properties/launchSettings.json +++ b/playground/AspireEventHub/EventHubs.AppHost/Properties/launchSettings.json @@ -11,6 +11,18 @@ "DOTNET_ENVIRONMENT": "Development", "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16201" } + }, + "generate-manifest": { + "commandName": "Project", + "launchBrowser": true, + "dotnetRunMessages": true, + "commandLineArgs": "--publisher manifest --output-path aspire-manifest.json", + "applicationUrl": "http://localhost:15270", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16201" + } } } } diff --git a/playground/AspireEventHub/EventHubs.AppHost/aspire-manifest.json b/playground/AspireEventHub/EventHubs.AppHost/aspire-manifest.json index ba7d069790..1e7cc102fb 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/aspire-manifest.json +++ b/playground/AspireEventHub/EventHubs.AppHost/aspire-manifest.json @@ -44,12 +44,14 @@ "http": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "external": true }, "https": { "scheme": "https", "protocol": "tcp", - "transport": "http" + "transport": "http", + "external": true } } } diff --git a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep index 45c444e8aa..eb4657906c 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep +++ b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource storageAccount_X1L2R0Ykm 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: toLower(take(concat('ehstorage', uniqueString(resourceGroup().id)), 24)) +resource storageAccount_59pNEh4K4 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: toLower(take('ehstorage${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'ehstorage' @@ -22,19 +22,22 @@ resource storageAccount_X1L2R0Ykm 'Microsoft.Storage/storageAccounts@2022-09-01' kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Deny' + } } } -resource blobService_6Eo0U74qO 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { - parent: storageAccount_X1L2R0Ykm +resource blobService_5WQ0wIU09 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { + parent: storageAccount_59pNEh4K4 name: 'default' properties: { } } -resource roleAssignment_QJKNfwb9n 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_X1L2R0Ykm - name: guid(storageAccount_X1L2R0Ykm.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) +resource roleAssignment_LrhalXYOv 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_59pNEh4K4 + name: guid(storageAccount_59pNEh4K4.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') principalId: principalId @@ -42,9 +45,9 @@ resource roleAssignment_QJKNfwb9n 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_XX2YmbC7m 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_X1L2R0Ykm - name: guid(storageAccount_X1L2R0Ykm.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) +resource roleAssignment_DDmC2vNE8 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_59pNEh4K4 + name: guid(storageAccount_59pNEh4K4.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') principalId: principalId @@ -52,9 +55,9 @@ resource roleAssignment_XX2YmbC7m 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_osDAIpL0k 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_X1L2R0Ykm - name: guid(storageAccount_X1L2R0Ykm.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) +resource roleAssignment_4tZWfnMZF 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_59pNEh4K4 + name: guid(storageAccount_59pNEh4K4.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') principalId: principalId @@ -62,6 +65,6 @@ resource roleAssignment_osDAIpL0k 'Microsoft.Authorization/roleAssignments@2022- } } -output blobEndpoint string = storageAccount_X1L2R0Ykm.properties.primaryEndpoints.blob -output queueEndpoint string = storageAccount_X1L2R0Ykm.properties.primaryEndpoints.queue -output tableEndpoint string = storageAccount_X1L2R0Ykm.properties.primaryEndpoints.table +output blobEndpoint string = storageAccount_59pNEh4K4.properties.primaryEndpoints.blob +output queueEndpoint string = storageAccount_59pNEh4K4.properties.primaryEndpoints.queue +output tableEndpoint string = storageAccount_59pNEh4K4.properties.primaryEndpoints.table diff --git a/playground/AspireEventHub/EventHubs.AppHost/eventhubns.module.bicep b/playground/AspireEventHub/EventHubs.AppHost/eventhubns.module.bicep index e534e5eac1..fca33ad816 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/eventhubns.module.bicep +++ b/playground/AspireEventHub/EventHubs.AppHost/eventhubns.module.bicep @@ -13,8 +13,8 @@ param principalId string param principalType string -resource eventHubsNamespace_skb4aVCrD 'Microsoft.EventHub/namespaces@2022-10-01-preview' = { - name: toLower(take(concat('eventhubns', uniqueString(resourceGroup().id)), 24)) +resource eventHubsNamespace_wORIGuvCQ 'Microsoft.EventHub/namespaces@2021-11-01' = { + name: toLower(take('eventhubns${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'eventhubns' @@ -23,13 +23,12 @@ resource eventHubsNamespace_skb4aVCrD 'Microsoft.EventHub/namespaces@2022-10-01- name: sku } properties: { - minimumTlsVersion: '1.2' } } -resource roleAssignment_cky0ZiKdq 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: eventHubsNamespace_skb4aVCrD - name: guid(eventHubsNamespace_skb4aVCrD.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f526a384-b230-433a-b45c-95f59c4a2dec')) +resource roleAssignment_2so8CKuFt 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: eventHubsNamespace_wORIGuvCQ + name: guid(eventHubsNamespace_wORIGuvCQ.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f526a384-b230-433a-b45c-95f59c4a2dec')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f526a384-b230-433a-b45c-95f59c4a2dec') principalId: principalId @@ -37,12 +36,12 @@ resource roleAssignment_cky0ZiKdq 'Microsoft.Authorization/roleAssignments@2022- } } -resource eventHub_BTiIwkSy2 'Microsoft.EventHub/namespaces/eventhubs@2022-10-01-preview' = { - parent: eventHubsNamespace_skb4aVCrD +resource eventHub_4BpPMTltx 'Microsoft.EventHub/namespaces/eventhubs@2021-11-01' = { + parent: eventHubsNamespace_wORIGuvCQ name: 'hub' location: location properties: { } } -output eventHubsEndpoint string = eventHubsNamespace_skb4aVCrD.properties.serviceBusEndpoint +output eventHubsEndpoint string = eventHubsNamespace_wORIGuvCQ.properties.serviceBusEndpoint diff --git a/playground/AzureSearchEndToEnd/AzureSearch.AppHost/aspire-manifest.json b/playground/AzureSearchEndToEnd/AzureSearch.AppHost/aspire-manifest.json index 89a728f391..135ab1e509 100644 --- a/playground/AzureSearchEndToEnd/AzureSearch.AppHost/aspire-manifest.json +++ b/playground/AzureSearchEndToEnd/AzureSearch.AppHost/aspire-manifest.json @@ -22,12 +22,14 @@ "http": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "external": true }, "https": { "scheme": "https", "protocol": "tcp", - "transport": "http" + "transport": "http", + "external": true } } } diff --git a/playground/AzureSearchEndToEnd/AzureSearch.AppHost/search.module.bicep b/playground/AzureSearchEndToEnd/AzureSearch.AppHost/search.module.bicep index 386f1083af..4ec441c444 100644 --- a/playground/AzureSearchEndToEnd/AzureSearch.AppHost/search.module.bicep +++ b/playground/AzureSearchEndToEnd/AzureSearch.AppHost/search.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource searchService_7WkaGluF0 'Microsoft.Search/searchServices@2023-11-01' = { - name: toLower(take(concat('search', uniqueString(resourceGroup().id)), 24)) +resource searchService_j3umigYGT 'Microsoft.Search/searchServices@2023-11-01' = { + name: toLower(take('search${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'search' @@ -27,9 +27,9 @@ resource searchService_7WkaGluF0 'Microsoft.Search/searchServices@2023-11-01' = } } -resource roleAssignment_7uytIREoa 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: searchService_7WkaGluF0 - name: guid(searchService_7WkaGluF0.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8ebe5a00-799e-43f5-93ac-243d3dce84a7')) +resource roleAssignment_f77ijNEYF 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: searchService_j3umigYGT + name: guid(searchService_j3umigYGT.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8ebe5a00-799e-43f5-93ac-243d3dce84a7')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8ebe5a00-799e-43f5-93ac-243d3dce84a7') principalId: principalId @@ -37,9 +37,9 @@ resource roleAssignment_7uytIREoa 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_QpFzCj55x 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: searchService_7WkaGluF0 - name: guid(searchService_7WkaGluF0.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7ca78c08-252a-4471-8644-bb5ff32d4ba0')) +resource roleAssignment_s0J7B4aGN 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: searchService_j3umigYGT + name: guid(searchService_j3umigYGT.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7ca78c08-252a-4471-8644-bb5ff32d4ba0')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7ca78c08-252a-4471-8644-bb5ff32d4ba0') principalId: principalId @@ -47,4 +47,4 @@ resource roleAssignment_QpFzCj55x 'Microsoft.Authorization/roleAssignments@2022- } } -output connectionString string = 'Endpoint=https://${searchService_7WkaGluF0.name}.search.windows.net' +output connectionString string = 'Endpoint=https://${searchService_j3umigYGT.name}.search.windows.net' diff --git a/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep b/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep index ecf704e110..ecda5794da 100644 --- a/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep +++ b/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource storageAccount_65zdmu5tK 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: toLower(take(concat('storage', uniqueString(resourceGroup().id)), 24)) +resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: toLower(take('storage${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'storage' @@ -22,19 +22,22 @@ resource storageAccount_65zdmu5tK 'Microsoft.Storage/storageAccounts@2022-09-01' kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Deny' + } } } -resource blobService_24WqMwYy8 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { - parent: storageAccount_65zdmu5tK +resource blobService_vTLU20GRg 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { + parent: storageAccount_1XR3Um8QY name: 'default' properties: { } } -resource roleAssignment_ryHNwVXTs 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) +resource roleAssignment_Gz09cEnxb 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') principalId: principalId @@ -42,9 +45,9 @@ resource roleAssignment_ryHNwVXTs 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_hqRD0luQx 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) +resource roleAssignment_HRj6MDafS 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') principalId: principalId @@ -52,9 +55,9 @@ resource roleAssignment_hqRD0luQx 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_5PGf5zmoW 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) +resource roleAssignment_r0wA6OpKE 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') principalId: principalId @@ -62,6 +65,6 @@ resource roleAssignment_5PGf5zmoW 'Microsoft.Authorization/roleAssignments@2022- } } -output blobEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.blob -output queueEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.queue -output tableEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.table +output blobEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.blob +output queueEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.queue +output tableEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.table diff --git a/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/cosmos.module.bicep b/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/cosmos.module.bicep index f436b93d37..1be375bedc 100644 --- a/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/cosmos.module.bicep +++ b/playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/cosmos.module.bicep @@ -11,8 +11,8 @@ resource keyVault_IeF8jZvXV 'Microsoft.KeyVault/vaults@2022-07-01' existing = { name: keyVaultName } -resource cosmosDBAccount_5pKmb8KAZ 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = { - name: toLower(take(concat('cosmos', uniqueString(resourceGroup().id)), 24)) +resource cosmosDBAccount_MZyw35gqp 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = { + name: toLower(take('cosmos${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'cosmos' @@ -32,8 +32,8 @@ resource cosmosDBAccount_5pKmb8KAZ 'Microsoft.DocumentDB/databaseAccounts@2023-0 } } -resource cosmosDBSqlDatabase_OquHUsfBg 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2023-04-15' = { - parent: cosmosDBAccount_5pKmb8KAZ +resource cosmosDBSqlDatabase_LFJis0a6w 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2023-04-15' = { + parent: cosmosDBAccount_MZyw35gqp name: 'db' location: location properties: { @@ -48,6 +48,6 @@ resource keyVaultSecret_Ddsc3HjrA 'Microsoft.KeyVault/vaults/secrets@2022-07-01' name: 'connectionString' location: location properties: { - value: 'AccountEndpoint=${cosmosDBAccount_5pKmb8KAZ.properties.documentEndpoint};AccountKey=${cosmosDBAccount_5pKmb8KAZ.listkeys(cosmosDBAccount_5pKmb8KAZ.apiVersion).primaryMasterKey}' + value: 'AccountEndpoint=${cosmosDBAccount_MZyw35gqp.properties.documentEndpoint};AccountKey=${cosmosDBAccount_MZyw35gqp.listkeys(cosmosDBAccount_MZyw35gqp.apiVersion).primaryMasterKey}' } } diff --git a/playground/OpenAIEndToEnd/OpenAIEndToEnd.AppHost/openai.module.bicep b/playground/OpenAIEndToEnd/OpenAIEndToEnd.AppHost/openai.module.bicep index 9ce1cf7cd8..e4e1a31896 100644 --- a/playground/OpenAIEndToEnd/OpenAIEndToEnd.AppHost/openai.module.bicep +++ b/playground/OpenAIEndToEnd/OpenAIEndToEnd.AppHost/openai.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource cognitiveServicesAccount_6g8jyEjX5 'Microsoft.CognitiveServices/accounts@2023-05-01' = { - name: toLower(take(concat('openai', uniqueString(resourceGroup().id)), 24)) +resource cognitiveServicesAccount_wXAGTFUId 'Microsoft.CognitiveServices/accounts@2023-05-01' = { + name: toLower(take('openai${uniqueString(resourceGroup().id)}', 24)) location: location kind: 'OpenAI' sku: { @@ -23,9 +23,9 @@ resource cognitiveServicesAccount_6g8jyEjX5 'Microsoft.CognitiveServices/account } } -resource roleAssignment_X7ie0XqR2 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: cognitiveServicesAccount_6g8jyEjX5 - name: guid(cognitiveServicesAccount_6g8jyEjX5.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a001fd3d-188f-4b5d-821b-7da978bf7442')) +resource roleAssignment_Hsk8rxWY8 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: cognitiveServicesAccount_wXAGTFUId + name: guid(cognitiveServicesAccount_wXAGTFUId.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a001fd3d-188f-4b5d-821b-7da978bf7442')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a001fd3d-188f-4b5d-821b-7da978bf7442') principalId: principalId @@ -33,8 +33,8 @@ resource roleAssignment_X7ie0XqR2 'Microsoft.Authorization/roleAssignments@2022- } } -resource cognitiveServicesAccountDeployment_f9rYX6SRK 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = { - parent: cognitiveServicesAccount_6g8jyEjX5 +resource cognitiveServicesAccountDeployment_hU1MaqMLH 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = { + parent: cognitiveServicesAccount_wXAGTFUId name: 'gpt-35-turbo' sku: { name: 'Standard' @@ -42,11 +42,11 @@ resource cognitiveServicesAccountDeployment_f9rYX6SRK 'Microsoft.CognitiveServic } properties: { model: { - name: 'gpt-35-turbo' format: 'OpenAI' + name: 'gpt-35-turbo' version: '0613' } } } -output connectionString string = 'Endpoint=${cognitiveServicesAccount_6g8jyEjX5.properties.endpoint}' +output connectionString string = 'Endpoint=${cognitiveServicesAccount_wXAGTFUId.properties.endpoint}' diff --git a/playground/SqlServerEndToEnd/SqlServerEndToEnd.AppHost/sql1.module.bicep b/playground/SqlServerEndToEnd/SqlServerEndToEnd.AppHost/sql1.module.bicep index 2000497355..4752ed38bd 100644 --- a/playground/SqlServerEndToEnd/SqlServerEndToEnd.AppHost/sql1.module.bicep +++ b/playground/SqlServerEndToEnd/SqlServerEndToEnd.AppHost/sql1.module.bicep @@ -10,15 +10,14 @@ param principalId string param principalName string -resource sqlServer_MXlkl0TrE 'Microsoft.Sql/servers@2020-11-01-preview' = { - name: toLower(take(concat('sql1', uniqueString(resourceGroup().id)), 24)) +resource sqlServer_x8iP8H24Z 'Microsoft.Sql/servers@2020-11-01-preview' = { + name: toLower(take('sql1${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'sql1' } properties: { version: '12.0' - minimalTlsVersion: '1.2' publicNetworkAccess: 'Enabled' administrators: { administratorType: 'ActiveDirectory' @@ -30,8 +29,8 @@ resource sqlServer_MXlkl0TrE 'Microsoft.Sql/servers@2020-11-01-preview' = { } } -resource sqlFirewallRule_zucOewiTI 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = { - parent: sqlServer_MXlkl0TrE +resource sqlFirewallRule_9yJsWRmBv 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = { + parent: sqlServer_x8iP8H24Z name: 'AllowAllAzureIps' properties: { startIpAddress: '0.0.0.0' @@ -39,12 +38,12 @@ resource sqlFirewallRule_zucOewiTI 'Microsoft.Sql/servers/firewallRules@2020-11- } } -resource sqlDatabase_pLQwSRl2h 'Microsoft.Sql/servers/databases@2020-11-01-preview' = { - parent: sqlServer_MXlkl0TrE +resource sqlDatabase_9KOoL8JWT 'Microsoft.Sql/servers/databases@2020-11-01-preview' = { + parent: sqlServer_x8iP8H24Z name: 'db1' location: location properties: { } } -output sqlServerFqdn string = sqlServer_MXlkl0TrE.properties.fullyQualifiedDomainName +output sqlServerFqdn string = sqlServer_x8iP8H24Z.properties.fullyQualifiedDomainName diff --git a/playground/bicep/BicepSample.AppHost/storage.module.bicep b/playground/bicep/BicepSample.AppHost/storage.module.bicep index fc7dc92187..ecda5794da 100644 --- a/playground/bicep/BicepSample.AppHost/storage.module.bicep +++ b/playground/bicep/BicepSample.AppHost/storage.module.bicep @@ -22,6 +22,9 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Deny' + } } } diff --git a/playground/cdk/CdkSample.AppHost/storage.module.bicep b/playground/cdk/CdkSample.AppHost/storage.module.bicep index 877ae338ba..7f8487c10d 100644 --- a/playground/cdk/CdkSample.AppHost/storage.module.bicep +++ b/playground/cdk/CdkSample.AppHost/storage.module.bicep @@ -28,6 +28,9 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Deny' + } } } diff --git a/playground/orleans/OrleansAppHost/aspire-manifest.json b/playground/orleans/OrleansAppHost/aspire-manifest.json index c1db76a4a2..46a3669eb8 100644 --- a/playground/orleans/OrleansAppHost/aspire-manifest.json +++ b/playground/orleans/OrleansAppHost/aspire-manifest.json @@ -29,10 +29,10 @@ "Orleans__GrainStorage__Default__ProviderType": "AzureBlobStorage", "Orleans__GrainStorage__Default__ServiceKey": "grainstate", "ConnectionStrings__grainstate": "{grainstate.connectionString}", - "Orleans__ClusterId": "02348447ebc64775888d944ac74b95ef", - "Orleans__EnableDistributedTracing": "true", + "Orleans__ClusterId": "0c0f5014e5164ac8925353c6e697e65c", "Orleans__Endpoints__SiloPort": "{silo.bindings.orleans-silo.targetPort}", - "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}" + "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}", + "Orleans__EnableDistributedTracing": "true" }, "bindings": { "http": { diff --git a/playground/orleans/OrleansAppHost/storage.module.bicep b/playground/orleans/OrleansAppHost/storage.module.bicep index ecf704e110..ecda5794da 100644 --- a/playground/orleans/OrleansAppHost/storage.module.bicep +++ b/playground/orleans/OrleansAppHost/storage.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource storageAccount_65zdmu5tK 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: toLower(take(concat('storage', uniqueString(resourceGroup().id)), 24)) +resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: toLower(take('storage${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'storage' @@ -22,19 +22,22 @@ resource storageAccount_65zdmu5tK 'Microsoft.Storage/storageAccounts@2022-09-01' kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Deny' + } } } -resource blobService_24WqMwYy8 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { - parent: storageAccount_65zdmu5tK +resource blobService_vTLU20GRg 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { + parent: storageAccount_1XR3Um8QY name: 'default' properties: { } } -resource roleAssignment_ryHNwVXTs 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) +resource roleAssignment_Gz09cEnxb 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') principalId: principalId @@ -42,9 +45,9 @@ resource roleAssignment_ryHNwVXTs 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_hqRD0luQx 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) +resource roleAssignment_HRj6MDafS 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') principalId: principalId @@ -52,9 +55,9 @@ resource roleAssignment_hqRD0luQx 'Microsoft.Authorization/roleAssignments@2022- } } -resource roleAssignment_5PGf5zmoW 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: storageAccount_65zdmu5tK - name: guid(storageAccount_65zdmu5tK.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) +resource roleAssignment_r0wA6OpKE 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') principalId: principalId @@ -62,6 +65,6 @@ resource roleAssignment_5PGf5zmoW 'Microsoft.Authorization/roleAssignments@2022- } } -output blobEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.blob -output queueEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.queue -output tableEndpoint string = storageAccount_65zdmu5tK.properties.primaryEndpoints.table +output blobEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.blob +output queueEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.queue +output tableEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.table diff --git a/playground/signalr/SignalRAppHost/signalr1.module.bicep b/playground/signalr/SignalRAppHost/signalr1.module.bicep index 2d1f44b7a1..d41c5190de 100644 --- a/playground/signalr/SignalRAppHost/signalr1.module.bicep +++ b/playground/signalr/SignalRAppHost/signalr1.module.bicep @@ -10,8 +10,8 @@ param principalId string param principalType string -resource signalRService_VaTic5fAI 'Microsoft.SignalRService/signalR@2022-02-01' = { - name: toLower(take(concat('signalr1', uniqueString(resourceGroup().id)), 24)) +resource signalRService_w7kmeqf4Y 'Microsoft.SignalRService/signalR@2022-02-01' = { + name: toLower(take('signalr1${uniqueString(resourceGroup().id)}', 24)) location: location tags: { 'aspire-resource-name': 'signalr1' @@ -36,9 +36,9 @@ resource signalRService_VaTic5fAI 'Microsoft.SignalRService/signalR@2022-02-01' } } -resource roleAssignment_3I0AXMYDY 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: signalRService_VaTic5fAI - name: guid(signalRService_VaTic5fAI.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '420fcaa2-552c-430f-98ca-3264be4806c7')) +resource roleAssignment_UoLS3XHY0 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: signalRService_w7kmeqf4Y + name: guid(signalRService_w7kmeqf4Y.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '420fcaa2-552c-430f-98ca-3264be4806c7')) properties: { roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '420fcaa2-552c-430f-98ca-3264be4806c7') principalId: principalId @@ -46,4 +46,4 @@ resource roleAssignment_3I0AXMYDY 'Microsoft.Authorization/roleAssignments@2022- } } -output hostName string = signalRService_VaTic5fAI.properties.hostName +output hostName string = signalRService_w7kmeqf4Y.properties.hostName From 3a9fcb55bbc75b6d4fb406c98ea9db88098145f2 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Thu, 4 Apr 2024 15:24:16 +1100 Subject: [PATCH 03/14] Integrated firewall changes and updated manifests and tests. --- .../EventHubs.AppHost/ehstorage.module.bicep | 1 + .../aspire-manifest.json | 7 +- .../Stress.AppHost/aspire-manifest.json | 90 ++- .../OrleansAppHost/aspire-manifest.json | 2 +- .../AzureCosmosDBExtensions.cs | 6 + .../AzureKeyVaultResourceExtensions.cs | 7 + .../AzureStorageExtensions.cs | 14 + .../Azure/AzureBicepResourceTests.cs | 569 +++++++++++++++++- 8 files changed, 647 insertions(+), 49 deletions(-) diff --git a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep index eb4657906c..c40b230543 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep +++ b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep @@ -23,6 +23,7 @@ resource storageAccount_59pNEh4K4 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { + bypass: 'AzureServices' defaultAction: 'Deny' } } diff --git a/playground/ProxylessEndToEnd/ProxylessEndToEnd.AppHost/aspire-manifest.json b/playground/ProxylessEndToEnd/ProxylessEndToEnd.AppHost/aspire-manifest.json index 62952cb05e..1d4a3508fb 100644 --- a/playground/ProxylessEndToEnd/ProxylessEndToEnd.AppHost/aspire-manifest.json +++ b/playground/ProxylessEndToEnd/ProxylessEndToEnd.AppHost/aspire-manifest.json @@ -9,6 +9,7 @@ "scheme": "tcp", "protocol": "tcp", "transport": "tcp", + "port": 9999, "targetPort": 6379 } } @@ -26,7 +27,8 @@ "http": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "port": 12345 }, "https": { "scheme": "https", @@ -48,7 +50,8 @@ "http": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 13456 } } } diff --git a/playground/Stress/Stress.AppHost/aspire-manifest.json b/playground/Stress/Stress.AppHost/aspire-manifest.json index 60d7f40e91..34e702f330 100644 --- a/playground/Stress/Stress.AppHost/aspire-manifest.json +++ b/playground/Stress/Stress.AppHost/aspire-manifest.json @@ -12,152 +12,182 @@ "http-5180": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5180 }, "http-5181": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5181 }, "http-5182": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5182 }, "http-5183": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5183 }, "http-5184": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5184 }, "http-5185": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5185 }, "http-5186": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5186 }, "http-5187": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5187 }, "http-5188": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5188 }, "http-5189": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5189 }, "http-5190": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5190 }, "http-5191": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5191 }, "http-5192": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5192 }, "http-5193": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5193 }, "http-5194": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5194 }, "http-5195": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5195 }, "http-5196": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5196 }, "http-5197": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5197 }, "http-5198": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5198 }, "http-5199": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5199 }, "http-5200": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5200 }, "http-5201": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5201 }, "http-5202": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5202 }, "http-5203": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5203 }, "http-5204": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5204 }, "http-5205": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5205 }, "http-5206": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5206 }, "http-5207": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5207 }, "http-5208": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5208 }, "http-5209": { "scheme": "http", "protocol": "tcp", - "transport": "http" + "transport": "http", + "targetPort": 5209 } } }, diff --git a/playground/orleans/OrleansAppHost/aspire-manifest.json b/playground/orleans/OrleansAppHost/aspire-manifest.json index 46a3669eb8..be8708c6d8 100644 --- a/playground/orleans/OrleansAppHost/aspire-manifest.json +++ b/playground/orleans/OrleansAppHost/aspire-manifest.json @@ -29,7 +29,7 @@ "Orleans__GrainStorage__Default__ProviderType": "AzureBlobStorage", "Orleans__GrainStorage__Default__ServiceKey": "grainstate", "ConnectionStrings__grainstate": "{grainstate.connectionString}", - "Orleans__ClusterId": "0c0f5014e5164ac8925353c6e697e65c", + "Orleans__ClusterId": "37fce84be012459bba47b663214a1cc3", "Orleans__Endpoints__SiloPort": "{silo.bindings.orleans-silo.targetPort}", "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}", "Orleans__EnableDistributedTracing": "true" diff --git a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs index f7b2b961b8..176b36457d 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs +++ b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs @@ -48,6 +48,12 @@ public static IResourceBuilder AddAzureCosmosDB(this IDis cosmosAccount.AssignProperty(x => x.Locations[0].LocationName, "location"); cosmosAccount.AssignProperty(x => x.Locations[0].FailoverPriority, "0"); + if (builder.ExecutionContext.IsPublishMode) + { + // If we are in publish mode then we lock things down to just Azure services. + cosmosAccount.AssignProperty(x => x.NetworkAclBypass, "'AzureServices'"); + } + cosmosAccount.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; var keyVaultNameParameter = new Parameter("keyVaultName"); diff --git a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs index 0c8cae488f..92c4f5ff8e 100644 --- a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs +++ b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs @@ -44,6 +44,13 @@ public static IResourceBuilder AddAzureKeyVault(this IDis var keyVault = construct.AddKeyVault(name: construct.Resource.Name); keyVault.AddOutput("vaultUri", x => x.Properties.VaultUri); + if (builder.ExecutionContext.IsPublishMode) + { + // If we are in publish mode then we lock things down to just Azure services. + keyVault.AssignProperty(p => p.Properties.NetworkRuleSet.DefaultAction, "'Deny'"); + keyVault.AssignProperty(p => p.Properties.NetworkRuleSet.Bypass, "'AzureServices'"); + } + keyVault.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; var keyVaultAdministratorRoleAssignment = keyVault.AssignRole(RoleDefinition.KeyVaultAdministrator); diff --git a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs index 5582e08c31..2dfef55d19 100644 --- a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs +++ b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs @@ -49,6 +49,20 @@ public static IResourceBuilder AddAzureStorage(this IDistr sku: StorageSkuName.StandardGrs ); + // NOTE: Currently the CDK injects networkAcls by default and sets them to deny. This is sub-optimimal + // as we'd probably want the default to omit this field altogether and accept the default of + // Allow. However because that isn't possible we explicitly set the default action to allow + // in Run mode and Deny in publish mode with an exception for Azure services. + if (builder.ExecutionContext.IsRunMode) + { + storageAccount.AssignProperty(p => p.NetworkRuleSet.DefaultAction, "'Allow'"); + } + else + { + storageAccount.AssignProperty(p => p.NetworkRuleSet.DefaultAction, "'Deny'"); + storageAccount.AssignProperty(p => p.NetworkRuleSet.Bypass, "'AzureServices'"); + } + storageAccount.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; var blobService = new BlobService(construct); diff --git a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs index 33e57b92ad..8532f84163 100644 --- a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs @@ -177,7 +177,7 @@ public async Task AddAzureCosmosDBEmulator() } [Fact] - public async Task AddAzureCosmosDB() + public async Task AddAzureCosmosDBViaRunMode() { using var builder = TestDistributedApplicationBuilder.Create(); @@ -275,6 +275,106 @@ param keyVaultName string Assert.Equal("mycosmosconnectionstring", await connectionStringResource.GetConnectionStringAsync()); } + [Fact] + public async Task AddAzureCosmosDBViaPublishMode() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); + + IEnumerable? callbackDatabases = null; + var cosmos = builder.AddAzureCosmosDB("cosmos", (resource, construct, account, databases) => + { + callbackDatabases = databases; + }); + cosmos.AddDatabase("mydatabase"); + + cosmos.Resource.SecretOutputs["connectionString"] = "mycosmosconnectionstring"; + + var manifest = await ManifestUtils.GetManifestWithBicep(cosmos.Resource); + + var expectedManifest = """ + { + "type": "azure.bicep.v0", + "connectionString": "{cosmos.secretOutputs.connectionString}", + "path": "cosmos.module.bicep", + "params": { + "keyVaultName": "" + } + } + """; + Assert.Equal(expectedManifest, manifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param keyVaultName string + + + resource keyVault_IeF8jZvXV 'Microsoft.KeyVault/vaults@2022-07-01' existing = { + name: keyVaultName + } + + resource cosmosDBAccount_MZyw35gqp 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = { + name: toLower(take('cosmos${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'cosmos' + } + kind: 'GlobalDocumentDB' + properties: { + databaseAccountOfferType: 'Standard' + consistencyPolicy: { + defaultConsistencyLevel: 'Session' + } + locations: [ + { + locationName: location + failoverPriority: 0 + } + ] + networkAclBypass: 'AzureServices' + } + } + + resource cosmosDBSqlDatabase_2kiHyuwCU 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2023-04-15' = { + parent: cosmosDBAccount_MZyw35gqp + name: 'mydatabase' + location: location + properties: { + resource: { + id: 'mydatabase' + } + } + } + + resource keyVaultSecret_Ddsc3HjrA 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = { + parent: keyVault_IeF8jZvXV + name: 'connectionString' + location: location + properties: { + value: 'AccountEndpoint=${cosmosDBAccount_MZyw35gqp.properties.documentEndpoint};AccountKey=${cosmosDBAccount_MZyw35gqp.listkeys(cosmosDBAccount_MZyw35gqp.apiVersion).primaryMasterKey}' + } + } + + """; + output.WriteLine(manifest.BicepText); + Assert.Equal(expectedBicep, manifest.BicepText); + + Assert.NotNull(callbackDatabases); + Assert.Collection( + callbackDatabases, + (database) => Assert.Equal("mydatabase", database.Properties.Name) + ); + + var connectionStringResource = (IResourceWithConnectionString)cosmos.Resource; + + Assert.Equal("cosmos", cosmos.Resource.Name); + Assert.Equal("mycosmosconnectionstring", await connectionStringResource.GetConnectionStringAsync()); + } + [Fact] public async Task AddAzureAppConfiguration() { @@ -706,7 +806,7 @@ param keyVaultName string } [Fact] - public async Task AddKeyVault() + public async Task AddKeyVaultViaRunMode() { using var builder = TestDistributedApplicationBuilder.Create(); @@ -773,6 +873,78 @@ param principalType string Assert.Equal(expectedBicep, manifest.BicepText); } + [Fact] + public async Task AddKeyVaultViaPublishMode() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); + + var mykv = builder.AddAzureKeyVault("mykv"); + + var manifest = await ManifestUtils.GetManifestWithBicep(mykv.Resource); + + var expectedManifest = """ + { + "type": "azure.bicep.v0", + "connectionString": "{mykv.outputs.vaultUri}", + "path": "mykv.module.bicep", + "params": { + "principalId": "", + "principalType": "" + } + } + """; + Assert.Equal(expectedManifest, manifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param principalId string + + @description('') + param principalType string + + + resource keyVault_aMZbuK3Sy 'Microsoft.KeyVault/vaults@2022-07-01' = { + name: toLower(take('mykv${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'mykv' + } + properties: { + tenantId: tenant().tenantId + sku: { + family: 'A' + name: 'standard' + } + enableRbacAuthorization: true + networkAcls: { + bypass: 'AzureServices' + defaultAction: 'Deny' + } + } + } + + resource roleAssignment_hVU9zjQV1 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: keyVault_aMZbuK3Sy + name: guid(keyVault_aMZbuK3Sy.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '00482a5a-887f-4fb3-b363-3b7fe8e74483')) + properties: { + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '00482a5a-887f-4fb3-b363-3b7fe8e74483') + principalId: principalId + principalType: principalType + } + } + + output vaultUri string = keyVault_aMZbuK3Sy.properties.vaultUri + + """; + output.WriteLine(manifest.BicepText); + Assert.Equal(expectedBicep, manifest.BicepText); + } + [Fact] public async Task AddAzureSignalR() { @@ -852,7 +1024,7 @@ param principalType string } [Fact] - public async Task AsAzureSqlDatabase() + public async Task AsAzureSqlDatabaseViaRunMode() { using var builder = TestDistributedApplicationBuilder.Create(); @@ -951,7 +1123,92 @@ param principalType string } [Fact] - public async Task AsAzurePostgresFlexibleServer() + public async Task AsAzureSqlDatabaseViaPublishMode() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); + + var sql = builder.AddSqlServer("sql").AsAzureSqlDatabase((azureSqlBuilder, _, _, _) => + { + azureSqlBuilder.Resource.Outputs["sqlServerFqdn"] = "myserver"; + }); + sql.AddDatabase("db", "dbName"); + + var manifest = await ManifestUtils.GetManifestWithBicep(sql.Resource); + + Assert.Equal("Server=tcp:myserver,1433;Encrypt=True;Authentication=\"Active Directory Default\"", await sql.Resource.GetConnectionStringAsync(default)); + Assert.Equal("Server=tcp:{sql.outputs.sqlServerFqdn},1433;Encrypt=True;Authentication=\"Active Directory Default\"", sql.Resource.ConnectionStringExpression.ValueExpression); + + var expectedManifest = """ + { + "type": "azure.bicep.v0", + "connectionString": "Server=tcp:{sql.outputs.sqlServerFqdn},1433;Encrypt=True;Authentication=\u0022Active Directory Default\u0022", + "path": "sql.module.bicep", + "params": { + "principalId": "", + "principalName": "" + } + } + """; + Assert.Equal(expectedManifest, manifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param principalId string + + @description('') + param principalName string + + + resource sqlServer_lF9QWGqAt 'Microsoft.Sql/servers@2020-11-01-preview' = { + name: toLower(take('sql${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'sql' + } + properties: { + version: '12.0' + publicNetworkAccess: 'Enabled' + administrators: { + administratorType: 'ActiveDirectory' + login: principalName + sid: principalId + tenantId: subscription().tenantId + azureADOnlyAuthentication: true + } + } + } + + resource sqlFirewallRule_vcw7qNn72 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = { + parent: sqlServer_lF9QWGqAt + name: 'AllowAllAzureIps' + properties: { + startIpAddress: '0.0.0.0' + endIpAddress: '0.0.0.0' + } + } + + resource sqlDatabase_m3U42g9Y8 'Microsoft.Sql/servers/databases@2020-11-01-preview' = { + parent: sqlServer_lF9QWGqAt + name: 'dbName' + location: location + properties: { + } + } + + output sqlServerFqdn string = sqlServer_lF9QWGqAt.properties.fullyQualifiedDomainName + + """; + output.WriteLine(manifest.BicepText); + Assert.Equal(expectedBicep, manifest.BicepText); + } + + [Fact] + public async Task AsAzurePostgresFlexibleServerViaRunMode() { using var builder = TestDistributedApplicationBuilder.Create(); @@ -1079,9 +1336,9 @@ param keyVaultName string } [Fact] - public async Task PublishAsAzurePostgresFlexibleServer() + public async Task AsAzurePostgresFlexibleServerViaPublishMode() { - using var builder = TestDistributedApplicationBuilder.Create(); + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); builder.Configuration["Parameters:usr"] = "user"; builder.Configuration["Parameters:pwd"] = "password"; @@ -1089,14 +1346,133 @@ public async Task PublishAsAzurePostgresFlexibleServer() var usr = builder.AddParameter("usr"); var pwd = builder.AddParameter("pwd", secret: true); - var postgres = builder.AddPostgres("postgres", usr, pwd).PublishAsAzurePostgresFlexibleServer(); - postgres.AddDatabase("db"); - - var manifest = await ManifestUtils.GetManifestWithBicep(postgres.Resource); - - // Verify that when PublishAs variant is used, connection string acquisition - // still uses the local endpoint. - postgres.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 1234)); + IResourceBuilder? azurePostgres = null; + var postgres = builder.AddPostgres("postgres", usr, pwd).AsAzurePostgresFlexibleServer((resource, _, _) => + { + Assert.NotNull(resource); + azurePostgres = resource; + }); + postgres.AddDatabase("db", "dbName"); + + var manifest = await ManifestUtils.GetManifestWithBicep(postgres.Resource); + + // Setup to verify that connection strings is acquired via resource connectionstring redirct. + Assert.NotNull(azurePostgres); + azurePostgres.Resource.SecretOutputs["connectionString"] = "myconnectionstring"; + Assert.Equal("myconnectionstring", await postgres.Resource.GetConnectionStringAsync(default)); + + var expectedManifest = """ + { + "type": "azure.bicep.v0", + "connectionString": "{postgres.secretOutputs.connectionString}", + "path": "postgres.module.bicep", + "params": { + "keyVaultName": "", + "administratorLogin": "{usr.value}", + "administratorLoginPassword": "{pwd.value}" + } + } + """; + Assert.Equal(expectedManifest, manifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param administratorLogin string + + @secure() + @description('') + param administratorLoginPassword string + + @description('') + param keyVaultName string + + + resource keyVault_IeF8jZvXV 'Microsoft.KeyVault/vaults@2022-07-01' existing = { + name: keyVaultName + } + + resource postgreSqlFlexibleServer_hFZg1J8nf 'Microsoft.DBforPostgreSQL/flexibleServers@2023-03-01-preview' = { + name: toLower(take('postgres${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'postgres' + } + sku: { + name: 'Standard_B1ms' + tier: 'Burstable' + } + properties: { + administratorLogin: administratorLogin + administratorLoginPassword: administratorLoginPassword + version: '16' + storage: { + storageSizeGB: 32 + } + backup: { + backupRetentionDays: 7 + geoRedundantBackup: 'Disabled' + } + highAvailability: { + mode: 'Disabled' + } + availabilityZone: '1' + } + } + + resource postgreSqlFirewallRule_t5EgXW1q4 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2023-03-01-preview' = { + parent: postgreSqlFlexibleServer_hFZg1J8nf + name: 'AllowAllAzureIps' + properties: { + startIpAddress: '0.0.0.0' + endIpAddress: '0.0.0.0' + } + } + + resource postgreSqlFlexibleServerDatabase_QJSbpnLQ9 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2023-03-01-preview' = { + parent: postgreSqlFlexibleServer_hFZg1J8nf + name: 'dbName' + properties: { + } + } + + resource keyVaultSecret_Ddsc3HjrA 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = { + parent: keyVault_IeF8jZvXV + name: 'connectionString' + location: location + properties: { + value: 'Host=${postgreSqlFlexibleServer_hFZg1J8nf.properties.fullyQualifiedDomainName};Username=${administratorLogin};Password=${administratorLoginPassword}' + } + } + + """; + output.WriteLine(manifest.BicepText); + Assert.Equal(expectedBicep, manifest.BicepText); + } + + [Fact] + public async Task PublishAsAzurePostgresFlexibleServer() + { + using var builder = TestDistributedApplicationBuilder.Create(); + + builder.Configuration["Parameters:usr"] = "user"; + builder.Configuration["Parameters:pwd"] = "password"; + + var usr = builder.AddParameter("usr"); + var pwd = builder.AddParameter("pwd", secret: true); + + var postgres = builder.AddPostgres("postgres", usr, pwd).PublishAsAzurePostgresFlexibleServer(); + postgres.AddDatabase("db"); + + var manifest = await ManifestUtils.GetManifestWithBicep(postgres.Resource); + + // Verify that when PublishAs variant is used, connection string acquisition + // still uses the local endpoint. + postgres.WithEndpoint("tcp", e => e.AllocatedEndpoint = new AllocatedEndpoint(e, "localhost", 1234)); var expectedConnectionString = $"Host=localhost;Port=1234;Username=user;Password=password"; Assert.Equal(expectedConnectionString, await postgres.Resource.GetConnectionStringAsync()); @@ -1330,7 +1706,7 @@ public async Task AddAzureStorageEmulator() } [Fact] - public async Task AddAzureStorage() + public async Task AddAzureStorageViaRunMode() { using var builder = TestDistributedApplicationBuilder.Create(); @@ -1390,6 +1766,9 @@ param storagesku string kind: 'StorageV2' properties: { accessTier: 'Hot' + networkAcls: { + defaultAction: 'Allow' + } } } @@ -1433,7 +1812,7 @@ param storagesku string output blobEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.blob output queueEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.queue output tableEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.table - + """; output.WriteLine(storageManifest.BicepText); Assert.Equal(expectedBicep, storageManifest.BicepText); @@ -1482,7 +1861,165 @@ param storagesku string """; var tableManifest = await ManifestUtils.GetManifest(table.Resource); Assert.Equal(expectedTableManifest, tableManifest.ToString()); + } + + [Fact] + public async Task AddAzureStorageViaPublishMode() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); + + var storagesku = builder.AddParameter("storagesku"); + var storage = builder.AddAzureStorage("storage", (_, _, sa) => + { + sa.AssignProperty(x => x.Sku.Name, storagesku); + }); + + storage.Resource.Outputs["blobEndpoint"] = "https://myblob"; + storage.Resource.Outputs["queueEndpoint"] = "https://myqueue"; + storage.Resource.Outputs["tableEndpoint"] = "https://mytable"; + + // Check storage resource. + Assert.Equal("storage", storage.Resource.Name); + + var storageManifest = await ManifestUtils.GetManifestWithBicep(storage.Resource); + + var expectedStorageManifest = """ + { + "type": "azure.bicep.v0", + "path": "storage.module.bicep", + "params": { + "principalId": "", + "principalType": "", + "storagesku": "{storagesku.value}" + } + } + """; + Assert.Equal(expectedStorageManifest, storageManifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param principalId string + + @description('') + param principalType string + + @description('') + param storagesku string + + + resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: toLower(take('storage${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'storage' + } + sku: { + name: storagesku + } + kind: 'StorageV2' + properties: { + accessTier: 'Hot' + networkAcls: { + bypass: 'AzureServices' + defaultAction: 'Deny' + } + } + } + + resource blobService_vTLU20GRg 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01' = { + parent: storageAccount_1XR3Um8QY + name: 'default' + properties: { + } + } + + resource roleAssignment_Gz09cEnxb 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')) + properties: { + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') + principalId: principalId + principalType: principalType + } + } + + resource roleAssignment_HRj6MDafS 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')) + properties: { + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') + principalId: principalId + principalType: principalType + } + } + + resource roleAssignment_r0wA6OpKE 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + scope: storageAccount_1XR3Um8QY + name: guid(storageAccount_1XR3Um8QY.id, principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88')) + properties: { + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') + principalId: principalId + principalType: principalType + } + } + + output blobEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.blob + output queueEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.queue + output tableEndpoint string = storageAccount_1XR3Um8QY.properties.primaryEndpoints.table + + """; + output.WriteLine(storageManifest.BicepText); + Assert.Equal(expectedBicep, storageManifest.BicepText); + + // Check blob resource. + var blob = storage.AddBlobs("blob"); + + var connectionStringBlobResource = (IResourceWithConnectionString)blob.Resource; + + Assert.Equal("https://myblob", await connectionStringBlobResource.GetConnectionStringAsync()); + var expectedBlobManifest = """ + { + "type": "value.v0", + "connectionString": "{storage.outputs.blobEndpoint}" + } + """; + var blobManifest = await ManifestUtils.GetManifest(blob.Resource); + Assert.Equal(expectedBlobManifest, blobManifest.ToString()); + + // Check queue resource. + var queue = storage.AddQueues("queue"); + var connectionStringQueueResource = (IResourceWithConnectionString)queue.Resource; + + Assert.Equal("https://myqueue", await connectionStringQueueResource.GetConnectionStringAsync()); + var expectedQueueManifest = """ + { + "type": "value.v0", + "connectionString": "{storage.outputs.queueEndpoint}" + } + """; + var queueManifest = await ManifestUtils.GetManifest(queue.Resource); + Assert.Equal(expectedQueueManifest, queueManifest.ToString()); + + // Check table resource. + var table = storage.AddTables("table"); + + var connectionStringTableResource = (IResourceWithConnectionString)table.Resource; + + Assert.Equal("https://mytable", await connectionStringTableResource.GetConnectionStringAsync()); + var expectedTableManifest = """ + { + "type": "value.v0", + "connectionString": "{storage.outputs.tableEndpoint}" + } + """; + var tableManifest = await ManifestUtils.GetManifest(table.Resource); + Assert.Equal(expectedTableManifest, tableManifest.ToString()); } [Fact] From 38c4bf892576f4cf13bac038825bfe76f66e0e67 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Thu, 4 Apr 2024 19:40:31 +1100 Subject: [PATCH 04/14] Refresh manifests. Remove firewall rules for KeyVault, Storage, and Cosmos. --- .../AWS.AppHost/Properties/launchSettings.json | 2 +- .../EventHubs.AppHost/ehstorage.module.bicep | 3 +-- .../storage.module.bicep | 2 +- .../BicepSample.AppHost/storage.module.bicep | 2 +- .../cdk/CdkSample.AppHost/storage.module.bicep | 2 +- .../orleans/OrleansAppHost/aspire-manifest.json | 2 +- .../orleans/OrleansAppHost/storage.module.bicep | 2 +- .../AzureApplicationInsightsExtensions.cs | 1 - .../AzureCosmosDBExtensions.cs | 6 ------ .../AzureKeyVaultResourceExtensions.cs | 7 ------- .../AzureStorageExtensions.cs | 17 ++++------------- .../Azure/AzureBicepResourceTests.cs | 8 +------- 12 files changed, 12 insertions(+), 42 deletions(-) diff --git a/playground/AWS/AWS.AppHost/Properties/launchSettings.json b/playground/AWS/AWS.AppHost/Properties/launchSettings.json index 7def19447c..0b4ade4882 100644 --- a/playground/AWS/AWS.AppHost/Properties/launchSettings.json +++ b/playground/AWS/AWS.AppHost/Properties/launchSettings.json @@ -26,7 +26,7 @@ "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" } }, - "manifest-publish": { + "generate-manifest": { "commandName": "Project", "commandLineArgs": "--publisher manifest --output-path ./aspire-manifest.json", "dotnetRunMessages": true, diff --git a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep index c40b230543..c56d5e6e7a 100644 --- a/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep +++ b/playground/AspireEventHub/EventHubs.AppHost/ehstorage.module.bicep @@ -23,8 +23,7 @@ resource storageAccount_59pNEh4K4 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { - bypass: 'AzureServices' - defaultAction: 'Deny' + defaultAction: 'Allow' } } } diff --git a/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep b/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep index ecda5794da..e73f0fb10e 100644 --- a/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep +++ b/playground/AzureStorageEndToEnd/AzureStorageEndToEnd.AppHost/storage.module.bicep @@ -23,7 +23,7 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { - defaultAction: 'Deny' + defaultAction: 'Allow' } } } diff --git a/playground/bicep/BicepSample.AppHost/storage.module.bicep b/playground/bicep/BicepSample.AppHost/storage.module.bicep index ecda5794da..e73f0fb10e 100644 --- a/playground/bicep/BicepSample.AppHost/storage.module.bicep +++ b/playground/bicep/BicepSample.AppHost/storage.module.bicep @@ -23,7 +23,7 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { - defaultAction: 'Deny' + defaultAction: 'Allow' } } } diff --git a/playground/cdk/CdkSample.AppHost/storage.module.bicep b/playground/cdk/CdkSample.AppHost/storage.module.bicep index 7f8487c10d..f56424ed87 100644 --- a/playground/cdk/CdkSample.AppHost/storage.module.bicep +++ b/playground/cdk/CdkSample.AppHost/storage.module.bicep @@ -29,7 +29,7 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { - defaultAction: 'Deny' + defaultAction: 'Allow' } } } diff --git a/playground/orleans/OrleansAppHost/aspire-manifest.json b/playground/orleans/OrleansAppHost/aspire-manifest.json index be8708c6d8..8749d3ad7e 100644 --- a/playground/orleans/OrleansAppHost/aspire-manifest.json +++ b/playground/orleans/OrleansAppHost/aspire-manifest.json @@ -29,7 +29,7 @@ "Orleans__GrainStorage__Default__ProviderType": "AzureBlobStorage", "Orleans__GrainStorage__Default__ServiceKey": "grainstate", "ConnectionStrings__grainstate": "{grainstate.connectionString}", - "Orleans__ClusterId": "37fce84be012459bba47b663214a1cc3", + "Orleans__ClusterId": "bf827dc3e0d6415b9bc9285a64cd0d90", "Orleans__Endpoints__SiloPort": "{silo.bindings.orleans-silo.targetPort}", "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}", "Orleans__EnableDistributedTracing": "true" diff --git a/playground/orleans/OrleansAppHost/storage.module.bicep b/playground/orleans/OrleansAppHost/storage.module.bicep index ecda5794da..e73f0fb10e 100644 --- a/playground/orleans/OrleansAppHost/storage.module.bicep +++ b/playground/orleans/OrleansAppHost/storage.module.bicep @@ -23,7 +23,7 @@ resource storageAccount_1XR3Um8QY 'Microsoft.Storage/storageAccounts@2022-09-01' properties: { accessTier: 'Hot' networkAcls: { - defaultAction: 'Deny' + defaultAction: 'Allow' } } } diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs index 60125641be..5abe2d4ae4 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs @@ -84,7 +84,6 @@ public static IResourceBuilder AddAzureApplica // side and the CDK side so that AZD can fill the value in with the one it generates. construct.Resource.Parameters.Add(AzureBicepResource.KnownParameters.LogAnalyticsWorkspaceId, ""); appInsights.AssignProperty(p => p.WorkspaceResourceId, new Parameter(AzureBicepResource.KnownParameters.LogAnalyticsWorkspaceId)); - } appInsights.AddOutput("appInsightsConnectionString", p => p.ConnectionString); diff --git a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs index 176b36457d..f7b2b961b8 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs +++ b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs @@ -48,12 +48,6 @@ public static IResourceBuilder AddAzureCosmosDB(this IDis cosmosAccount.AssignProperty(x => x.Locations[0].LocationName, "location"); cosmosAccount.AssignProperty(x => x.Locations[0].FailoverPriority, "0"); - if (builder.ExecutionContext.IsPublishMode) - { - // If we are in publish mode then we lock things down to just Azure services. - cosmosAccount.AssignProperty(x => x.NetworkAclBypass, "'AzureServices'"); - } - cosmosAccount.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; var keyVaultNameParameter = new Parameter("keyVaultName"); diff --git a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs index 92c4f5ff8e..0c8cae488f 100644 --- a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs +++ b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs @@ -44,13 +44,6 @@ public static IResourceBuilder AddAzureKeyVault(this IDis var keyVault = construct.AddKeyVault(name: construct.Resource.Name); keyVault.AddOutput("vaultUri", x => x.Properties.VaultUri); - if (builder.ExecutionContext.IsPublishMode) - { - // If we are in publish mode then we lock things down to just Azure services. - keyVault.AssignProperty(p => p.Properties.NetworkRuleSet.DefaultAction, "'Deny'"); - keyVault.AssignProperty(p => p.Properties.NetworkRuleSet.Bypass, "'AzureServices'"); - } - keyVault.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; var keyVaultAdministratorRoleAssignment = keyVault.AssignRole(RoleDefinition.KeyVaultAdministrator); diff --git a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs index 2dfef55d19..5e88e5a473 100644 --- a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs +++ b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs @@ -49,19 +49,10 @@ public static IResourceBuilder AddAzureStorage(this IDistr sku: StorageSkuName.StandardGrs ); - // NOTE: Currently the CDK injects networkAcls by default and sets them to deny. This is sub-optimimal - // as we'd probably want the default to omit this field altogether and accept the default of - // Allow. However because that isn't possible we explicitly set the default action to allow - // in Run mode and Deny in publish mode with an exception for Azure services. - if (builder.ExecutionContext.IsRunMode) - { - storageAccount.AssignProperty(p => p.NetworkRuleSet.DefaultAction, "'Allow'"); - } - else - { - storageAccount.AssignProperty(p => p.NetworkRuleSet.DefaultAction, "'Deny'"); - storageAccount.AssignProperty(p => p.NetworkRuleSet.Bypass, "'AzureServices'"); - } + // Unfortunately Azure Storage does not list ACA as one of the resource types in which + // the AzureServices firewall policy works. This means that we need this Azure Storage + // account to have its default action set to Allow. + storageAccount.AssignProperty(p => p.NetworkRuleSet.DefaultAction, "'Allow'"); storageAccount.Properties.Tags["aspire-resource-name"] = construct.Resource.Name; diff --git a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs index 8532f84163..3fdb8a21d1 100644 --- a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs @@ -335,7 +335,6 @@ param keyVaultName string failoverPriority: 0 } ] - networkAclBypass: 'AzureServices' } } @@ -921,10 +920,6 @@ param principalType string name: 'standard' } enableRbacAuthorization: true - networkAcls: { - bypass: 'AzureServices' - defaultAction: 'Deny' - } } } @@ -1925,8 +1920,7 @@ param storagesku string properties: { accessTier: 'Hot' networkAcls: { - bypass: 'AzureServices' - defaultAction: 'Deny' + defaultAction: 'Allow' } } } From 8aa6b103135e62bb5aa4969fa446334018d61223 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Thu, 4 Apr 2024 21:47:42 +1100 Subject: [PATCH 05/14] Fix AppInsights azure provisioning bug. --- .../OrleansAppHost/aspire-manifest.json | 2 +- .../AzureApplicationInsightsExtensions.cs | 15 +++- .../Azure/AzureBicepResourceTests.cs | 72 ++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/playground/orleans/OrleansAppHost/aspire-manifest.json b/playground/orleans/OrleansAppHost/aspire-manifest.json index 8749d3ad7e..a6e308dca8 100644 --- a/playground/orleans/OrleansAppHost/aspire-manifest.json +++ b/playground/orleans/OrleansAppHost/aspire-manifest.json @@ -29,7 +29,7 @@ "Orleans__GrainStorage__Default__ProviderType": "AzureBlobStorage", "Orleans__GrainStorage__Default__ServiceKey": "grainstate", "ConnectionStrings__grainstate": "{grainstate.connectionString}", - "Orleans__ClusterId": "bf827dc3e0d6415b9bc9285a64cd0d90", + "Orleans__ClusterId": "8578f94495f94302a742fd92fb958ece", "Orleans__Endpoints__SiloPort": "{silo.bindings.orleans-silo.targetPort}", "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}", "Orleans__EnableDistributedTracing": "true" diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs index 5abe2d4ae4..7f6274e2f0 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs @@ -6,6 +6,7 @@ using Aspire.Hosting.Azure; using Azure.Provisioning; using Azure.Provisioning.ApplicationInsights; +using Azure.Provisioning.OperationalInsights; namespace Aspire.Hosting; @@ -76,12 +77,24 @@ public static IResourceBuilder AddAzureApplica if (logAnalyticsWorkspace != null) { + // If someone provides a workspace via the extension method we should use it. appInsights.AssignProperty(p => p.WorkspaceResourceId, logAnalyticsWorkspace.Resource.WorkspaceId, AzureBicepResource.KnownParameters.LogAnalyticsWorkspaceId); } - else + else if (builder.ExecutionContext.IsRunMode) { + // ... otherwise if we are in run mode, the provisioner expects us to create one ourselves. + var autoInjectedLogAnalyticsWorkspace = new OperationalInsightsWorkspace(construct, name: $"law-{construct.Resource.Name}"); + appInsights.Properties.Tags["aspire-resource-name"] = $"law-{construct.Resource.Name}"; + autoInjectedLogAnalyticsWorkspace.AssignProperty(p => p.Sku.Name, "'PerGB2018'"); + // If the user does not supply a log analytics workspace of their own we still create a parameter on the Aspire // side and the CDK side so that AZD can fill the value in with the one it generates. + appInsights.AssignProperty(p => p.WorkspaceResourceId, $"{autoInjectedLogAnalyticsWorkspace.Name}.id"); + } + else + { + // If the user does not supply a log analytics workspace of their own, and we are in publish mode + // then we want AZD to provide one to us. construct.Resource.Parameters.Add(AzureBicepResource.KnownParameters.LogAnalyticsWorkspaceId, ""); appInsights.AssignProperty(p => p.WorkspaceResourceId, new Parameter(AzureBicepResource.KnownParameters.LogAnalyticsWorkspaceId)); } diff --git a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs index 3fdb8a21d1..6764b4ce5d 100644 --- a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs @@ -446,9 +446,9 @@ param principalType string } [Fact] - public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParameter() + public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParameterInPublishMode() { - using var builder = TestDistributedApplicationBuilder.Create(); + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish); var appInsights = builder.AddAzureApplicationInsights("appInsights"); @@ -509,6 +509,74 @@ param logAnalyticsWorkspaceId string Assert.Equal(expectedBicep, appInsightsManifest.BicepText); } + [Fact] + public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParameterInRunMode() + { + using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Run); + + var appInsights = builder.AddAzureApplicationInsights("appInsights"); + + appInsights.Resource.Outputs["appInsightsConnectionString"] = "myinstrumentationkey"; + + var connectionStringResource = (IResourceWithConnectionString)appInsights.Resource; + + Assert.Equal("appInsights", appInsights.Resource.Name); + Assert.Equal("myinstrumentationkey", await connectionStringResource.GetConnectionStringAsync()); + Assert.Equal("{appInsights.outputs.appInsightsConnectionString}", appInsights.Resource.ConnectionStringExpression.ValueExpression); + + var appInsightsManifest = await ManifestUtils.GetManifestWithBicep(appInsights.Resource); + var expectedManifest = """ + { + "type": "azure.bicep.v0", + "connectionString": "{appInsights.outputs.appInsightsConnectionString}", + "path": "appInsights.module.bicep" + } + """; + Assert.Equal(expectedManifest, appInsightsManifest.ManifestNode.ToString()); + + var expectedBicep = """ + targetScope = 'resourceGroup' + + @description('') + param location string = resourceGroup().location + + @description('') + param applicationType string = 'web' + + @description('') + param kind string = 'web' + + + resource applicationInsightsComponent_eYAu4rv7j 'Microsoft.Insights/components@2020-02-02' = { + name: toLower(take('appInsights${uniqueString(resourceGroup().id)}', 24)) + location: location + tags: { + 'aspire-resource-name': 'law-appInsights' + } + kind: kind + properties: { + Application_Type: applicationType + WorkspaceResourceId: operationalInsightsWorkspace_smwjw0Wga.id + } + } + + resource operationalInsightsWorkspace_smwjw0Wga 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { + name: toLower(take('law-appInsights${uniqueString(resourceGroup().id)}', 24)) + location: location + properties: { + sku: { + name: 'PerGB2018' + } + } + } + + output appInsightsConnectionString string = applicationInsightsComponent_eYAu4rv7j.properties.ConnectionString + + """; + output.WriteLine(appInsightsManifest.BicepText); + Assert.Equal(expectedBicep, appInsightsManifest.BicepText); + } + [Fact] public async Task AddApplicationInsightsWithExplicitLawArgumentDoesntGetDefaultParameter() { From a1063aee7a0daae4e7c95800a6fc804e3f5d5831 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 07:00:35 +1100 Subject: [PATCH 06/14] Update AzureApplicationInsightsExtensions.cs Co-authored-by: Eric Erhardt --- .../AzureApplicationInsightsExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs index 7f6274e2f0..cd23f719f2 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs @@ -84,7 +84,7 @@ public static IResourceBuilder AddAzureApplica { // ... otherwise if we are in run mode, the provisioner expects us to create one ourselves. var autoInjectedLogAnalyticsWorkspace = new OperationalInsightsWorkspace(construct, name: $"law-{construct.Resource.Name}"); - appInsights.Properties.Tags["aspire-resource-name"] = $"law-{construct.Resource.Name}"; + autoInjectedLogAnalyticsWorkspace.Properties.Tags["aspire-resource-name"] = $"law-{construct.Resource.Name}"; autoInjectedLogAnalyticsWorkspace.AssignProperty(p => p.Sku.Name, "'PerGB2018'"); // If the user does not supply a log analytics workspace of their own we still create a parameter on the Aspire From 7553ed7042770eab555baafec0db2c10816c3a56 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 09:13:12 +1100 Subject: [PATCH 07/14] Switch over to AZPROVISION001 code. --- playground/cdk/CdkSample.AppHost/Program.cs | 2 +- .../AzureAppConfigurationExtensions.cs | 6 ++--- .../AzureApplicationInsightsExtensions.cs | 12 +++++----- .../AzureOpenAIExtensions.cs | 6 ++--- .../AzureCosmosDBExtensions.cs | 6 ++--- .../AzureEventHubsExtensions.cs | 12 +++++----- .../AzureKeyVaultResourceExtensions.cs | 6 ++--- .../AzureLogAnalyticsWorkspaceExtensions.cs | 6 ++--- .../AzurePostgresExtensions.cs | 12 +++++----- .../AzureRedisExtensions.cs | 12 +++++----- .../AzureSearchExtensions.cs | 6 ++--- .../AzureServiceBusExtensions.cs | 24 +++++++++---------- .../AzureSignalRExtensions.cs | 6 ++--- .../AzureSqlExtensions.cs | 12 +++++----- .../AzureStorageExtensions.cs | 6 ++--- .../Azure/AzureBicepResourceTests.cs | 2 +- 16 files changed, 68 insertions(+), 68 deletions(-) diff --git a/playground/cdk/CdkSample.AppHost/Program.cs b/playground/cdk/CdkSample.AppHost/Program.cs index 5dcd0a9757..32e7b6a0f1 100644 --- a/playground/cdk/CdkSample.AppHost/Program.cs +++ b/playground/cdk/CdkSample.AppHost/Program.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable ASPIRE0001 // Because we use the CDK callbacks. +#pragma warning disable AZPROVISION001 // Because we use the CDK callbacks. using Aspire.Hosting.Azure; using Azure.Provisioning.KeyVaults; diff --git a/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs b/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs index 973661409d..6550ea1194 100644 --- a/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs +++ b/src/Aspire.Hosting.Azure.AppConfiguration/AzureAppConfigurationExtensions.cs @@ -22,9 +22,9 @@ public static class AzureAppConfigurationExtensions /// A reference to the . public static IResourceBuilder AddAzureAppConfiguration(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureAppConfiguration(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureAppConfigu /// The name of the resource. This name will be used as the connection string name when referenced in a dependency. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureAppConfiguration(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, AppConfigurationStore>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs index cd23f719f2..ff4aaf342c 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs @@ -23,9 +23,9 @@ public static class AzureApplicationInsightsExtensions /// A reference to the . public static IResourceBuilder AddAzureApplicationInsights(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureApplicationInsights(name, null, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -37,9 +37,9 @@ public static IResourceBuilder AddAzureApplica /// A reference to the . public static IResourceBuilder AddAzureApplicationInsights(this IDistributedApplicationBuilder builder, string name, IResourceBuilder? logAnalyticsWorkspace) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureApplicationInsights(name, logAnalyticsWorkspace, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -49,7 +49,7 @@ public static IResourceBuilder AddAzureApplica /// The name of the resource. /// Optional callback to configure the Application Insights resource. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureApplicationInsights(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, ApplicationInsightsComponent>? configureResource) { return builder.AddAzureApplicationInsights(name, null, configureResource); @@ -63,7 +63,7 @@ public static IResourceBuilder AddAzureApplica /// A resource builder for the log analytics workspace. /// Optional callback to configure the Application Insights resource. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureApplicationInsights(this IDistributedApplicationBuilder builder, string name, IResourceBuilder? logAnalyticsWorkspace, Action, ResourceModuleConstruct, ApplicationInsightsComponent>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs b/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs index 93087af319..64025116fa 100644 --- a/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs +++ b/src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIExtensions.cs @@ -23,9 +23,9 @@ public static class AzureOpenAIExtensions /// A reference to the . public static IResourceBuilder AddAzureOpenAI(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureOpenAI(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -35,7 +35,7 @@ public static IResourceBuilder AddAzureOpenAI(this IDistrib /// The name of the resource. This name will be used as the connection string name when referenced in a dependency. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureOpenAI(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, CognitiveServicesAccount, IEnumerable>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs index f7b2b961b8..6875ef15e0 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs +++ b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs @@ -24,9 +24,9 @@ public static class AzureCosmosExtensions /// A reference to the . public static IResourceBuilder AddAzureCosmosDB(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureCosmosDB(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// /// Adds an Azure Cosmos DB connection to the application model. @@ -35,7 +35,7 @@ public static IResourceBuilder AddAzureCosmosDB(this IDis /// The name of the resource. This name will be used as the connection string name when referenced in a dependency. /// /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureCosmosDB(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, CosmosDBAccount, IEnumerable>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs index ce99a19f1f..543bd6c3f9 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs +++ b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs @@ -23,9 +23,9 @@ public static class AzureEventHubsExtensions public static IResourceBuilder AddAzureEventHubs( this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // This API requires opting into experimental features +#pragma warning disable AZPROVISION001 // This API requires opting into experimental features return builder.AddAzureEventHubs(name, null); -#pragma warning restore ASPIRE0001 // This API requires opting into experimental features +#pragma warning restore AZPROVISION001 // This API requires opting into experimental features } /// @@ -35,7 +35,7 @@ public static IResourceBuilder AddAzureEventHubs( /// The name of the resource. /// Optional callback to configure the Event Hubs namespace. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureEventHubs(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, EventHubsNamespace>? configureResource) { @@ -81,9 +81,9 @@ public static IResourceBuilder AddAzureEventHubs(this ID /// The name of the Event Hub. public static IResourceBuilder AddEventHub(this IResourceBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // This API requires opting into experimental features +#pragma warning disable AZPROVISION001 // This API requires opting into experimental features return builder.AddEventHub(name, null); -#pragma warning restore ASPIRE0001 // This API requires opting into experimental features +#pragma warning restore AZPROVISION001 // This API requires opting into experimental features } /// @@ -92,7 +92,7 @@ public static IResourceBuilder AddEventHub(this IResourc /// The Azure Event Hubs resource builder. /// The name of the Event Hub. /// Optional callback to customize the Event Hub. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddEventHub(this IResourceBuilder builder, string name, Action, ResourceModuleConstruct, EventHub>? configureHub) { diff --git a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs index 0c8cae488f..482fc6d6fd 100644 --- a/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs +++ b/src/Aspire.Hosting.Azure.KeyVault/AzureKeyVaultResourceExtensions.cs @@ -22,9 +22,9 @@ public static class AzureKeyVaultResourceExtensions /// A reference to the . public static IResourceBuilder AddAzureKeyVault(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureKeyVault(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureKeyVault(this IDis /// The name of the resource. This name will be used as the connection string name when referenced in a dependency. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureKeyVault(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, KeyVault>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.OperationalInsights/AzureLogAnalyticsWorkspaceExtensions.cs b/src/Aspire.Hosting.Azure.OperationalInsights/AzureLogAnalyticsWorkspaceExtensions.cs index 852b466200..e5ca648780 100644 --- a/src/Aspire.Hosting.Azure.OperationalInsights/AzureLogAnalyticsWorkspaceExtensions.cs +++ b/src/Aspire.Hosting.Azure.OperationalInsights/AzureLogAnalyticsWorkspaceExtensions.cs @@ -22,9 +22,9 @@ public static class AzureLogAnalyticsWorkspaceExtensions /// A reference to the . public static IResourceBuilder AddAzureLogAnalyticsWorkspace(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureLogAnalyticsWorkspace(name, (_, _, _) => { }); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureLogAn /// The name of the resource. /// Optional callback to configure the Azure Log Analytics Workspace resource. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureLogAnalyticsWorkspace(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, OperationalInsightsWorkspace>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs b/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs index 908f68fd64..f7f3b45799 100644 --- a/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs +++ b/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs @@ -118,7 +118,7 @@ internal static IResourceBuilder PublishAsAzurePostgresF /// The builder. /// Callback to configure the underlying resource. /// A reference to the builder. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder PublishAsAzurePostgresFlexibleServer( this IResourceBuilder builder, Action, ResourceModuleConstruct, PostgreSqlFlexibleServer>? configureResource) @@ -136,9 +136,9 @@ public static IResourceBuilder PublishAsAzurePostgresFle public static IResourceBuilder PublishAsAzurePostgresFlexibleServer( this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.PublishAsAzurePostgresFlexibleServer(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -149,9 +149,9 @@ public static IResourceBuilder PublishAsAzurePostgresFle public static IResourceBuilder AsAzurePostgresFlexibleServer( this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AsAzurePostgresFlexibleServer(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -160,7 +160,7 @@ public static IResourceBuilder AsAzurePostgresFlexibleSe /// The builder. /// Callback to configure the underlying resource. /// A reference to the builder. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AsAzurePostgresFlexibleServer( this IResourceBuilder builder, Action, ResourceModuleConstruct, PostgreSqlFlexibleServer>? configureResource) diff --git a/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs b/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs index 2483938457..efb454b7ee 100644 --- a/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs +++ b/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs @@ -22,9 +22,9 @@ public static class AzureRedisExtensions /// A reference to the builder. public static IResourceBuilder PublishAsAzureRedis(this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.PublishAsAzureRedis(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -33,7 +33,7 @@ public static IResourceBuilder PublishAsAzureRedis(this IResource /// The builder. /// Callback to configure the underlying resource. /// A reference to the builder. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder PublishAsAzureRedis(this IResourceBuilder builder, Action, ResourceModuleConstruct, RedisCache>? configureResource) { return builder.PublishAsAzureRedisInternal(configureResource); @@ -93,9 +93,9 @@ internal static IResourceBuilder PublishAsAzureRedisInternal(this /// A reference to the builder. public static IResourceBuilder AsAzureRedis(this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AsAzureRedis(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -104,7 +104,7 @@ public static IResourceBuilder AsAzureRedis(this IResourceBuilder /// The builder. /// Callback to configure the underlying resource. /// A reference to the builder. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AsAzureRedis(this IResourceBuilder builder, Action, ResourceModuleConstruct, RedisCache>? configureResource) { return builder.PublishAsAzureRedisInternal(configureResource, useProvisioner: true); diff --git a/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs b/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs index 7f92e90291..4cd44cc3cd 100644 --- a/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs +++ b/src/Aspire.Hosting.Azure.Search/AzureSearchExtensions.cs @@ -23,9 +23,9 @@ public static class AzureSearchExtensions /// A reference to the . public static IResourceBuilder AddAzureSearch(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureSearch(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// /// Adds an Azure AI Search service resource to the application model. @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureSearch(this IDistrib /// The name of the Azure AI Search resource. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureSearch( this IDistributedApplicationBuilder builder, string name, diff --git a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs index de43af9200..9941cfc940 100644 --- a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs +++ b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs @@ -22,9 +22,9 @@ public static class AzureServiceBusExtensions /// public static IResourceBuilder AddAzureServiceBus(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureServiceBus(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureServiceBus(this /// The name of the resource. /// Callback to configure the underlying resource. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureServiceBus(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, ServiceBusNamespace>? configureResource) { builder.AddAzureProvisioning(); @@ -108,9 +108,9 @@ public static IResourceBuilder AddTopic(this IResourceB /// The name of the queue. public static IResourceBuilder AddQueue(this IResourceBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddQueue(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -119,7 +119,7 @@ public static IResourceBuilder AddQueue(this IResourceB /// The Azure Service Bus resource builder. /// The name of the queue. /// Callback to configure the underlying resource. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddQueue(this IResourceBuilder builder, string name, Action, ResourceModuleConstruct, ServiceBusQueue>? configureQueue) { builder.Resource.Queues.Add((name, configureQueue)); @@ -133,9 +133,9 @@ public static IResourceBuilder AddQueue(this IResourceB /// The name of the topic. public static IResourceBuilder AddTopic(this IResourceBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddTopic(name, configureTopic: null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -144,7 +144,7 @@ public static IResourceBuilder AddTopic(this IResourceB /// The Azure Service Bus resource builder. /// The name of the topic. /// Callback to configure the underlying resource. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddTopic(this IResourceBuilder builder, string name, Action, ResourceModuleConstruct, ServiceBusTopic>? configureTopic) { builder.Resource.Topics.Add((name, configureTopic)); @@ -159,9 +159,9 @@ public static IResourceBuilder AddTopic(this IResourceB /// The name of the subscription. public static IResourceBuilder AddSubscription(this IResourceBuilder builder, string topicName, string subscriptionName) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddSubscription(topicName, subscriptionName, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -171,7 +171,7 @@ public static IResourceBuilder AddSubscription(this IRe /// The name of the topic. /// The name of the subscription. /// Callback to configure the underlying resource. - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddSubscription(this IResourceBuilder builder, string topicName, string subscriptionName, Action, ResourceModuleConstruct, ServiceBusSubscription>? configureSubscription) { builder.Resource.Subscriptions.Add((topicName, subscriptionName, configureSubscription)); diff --git a/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs b/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs index 49896de823..933c6ae31a 100644 --- a/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs +++ b/src/Aspire.Hosting.Azure.SignalR/AzureSignalRExtensions.cs @@ -22,9 +22,9 @@ public static class AzureSignalRExtensions /// A reference to the . public static IResourceBuilder AddAzureSignalR(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureSignalR(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -34,7 +34,7 @@ public static IResourceBuilder AddAzureSignalR(this IDistr /// The name of the resource. This name will be used as the connection string name when referenced in a dependency. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureSignalR(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, SignalRService>? configureResource) { builder.AddAzureProvisioning(); diff --git a/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs b/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs index c08e640144..0adaaa918c 100644 --- a/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs +++ b/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs @@ -93,9 +93,9 @@ internal static IResourceBuilder PublishAsAzureSqlDatab /// A reference to the . public static IResourceBuilder PublishAsAzureSqlDatabase(this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.PublishAsAzureSqlDatabase(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -104,7 +104,7 @@ public static IResourceBuilder PublishAsAzureSqlDatabas /// The builder for the SQL Server resource. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder PublishAsAzureSqlDatabase(this IResourceBuilder builder, Action, ResourceModuleConstruct, SqlServer, IEnumerable>? configureResource) { return builder.PublishAsAzureSqlDatabase(configureResource, useProvisioner: false); @@ -117,9 +117,9 @@ public static IResourceBuilder PublishAsAzureSqlDatabas /// A reference to the . public static IResourceBuilder AsAzureSqlDatabase(this IResourceBuilder builder) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AsAzureSqlDatabase(null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -128,7 +128,7 @@ public static IResourceBuilder AsAzureSqlDatabase(this /// The builder for the SQL Server resource. /// Callback to configure the underlying resource. /// A reference to the . - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AsAzureSqlDatabase(this IResourceBuilder builder, Action, ResourceModuleConstruct, SqlServer, IEnumerable>? configureResource) { return builder.PublishAsAzureSqlDatabase(configureResource, useProvisioner: true); diff --git a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs index 5e88e5a473..3bd3a2a6d6 100644 --- a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs +++ b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs @@ -24,9 +24,9 @@ public static class AzureStorageExtensions /// public static IResourceBuilder AddAzureStorage(this IDistributedApplicationBuilder builder, string name) { -#pragma warning disable ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AddAzureStorage(name, null); -#pragma warning restore ASPIRE0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. +#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -36,7 +36,7 @@ public static IResourceBuilder AddAzureStorage(this IDistr /// The name of the resource. /// Callback to configure the underlying resource. /// - [Experimental("ASPIRE0001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] + [Experimental("AZPROVISION001", UrlFormat = "https://aka.ms/dotnet/aspire/diagnostics#{0}")] public static IResourceBuilder AddAzureStorage(this IDistributedApplicationBuilder builder, string name, Action, ResourceModuleConstruct, StorageAccount>? configureResource) { builder.AddAzureProvisioning(); diff --git a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs index 6764b4ce5d..af7e441fd8 100644 --- a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable ASPIRE0001 // Because we are testing CDK callbacks. +#pragma warning disable AZPROVISION001 // Because we are testing CDK callbacks. using System.Text.Json.Nodes; using Aspire.Hosting.Azure; From d90f2698807bd8d2047d471b77f17dbff1c038d9 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 09:21:25 +1100 Subject: [PATCH 08/14] Generate name once. --- eng/refreshManifests.ps1 | 0 .../AzureApplicationInsightsExtensions.cs | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 eng/refreshManifests.ps1 diff --git a/eng/refreshManifests.ps1 b/eng/refreshManifests.ps1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs index ff4aaf342c..de50da5a2c 100644 --- a/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs +++ b/src/Aspire.Hosting.Azure.ApplicationInsights/AzureApplicationInsightsExtensions.cs @@ -83,8 +83,9 @@ public static IResourceBuilder AddAzureApplica else if (builder.ExecutionContext.IsRunMode) { // ... otherwise if we are in run mode, the provisioner expects us to create one ourselves. - var autoInjectedLogAnalyticsWorkspace = new OperationalInsightsWorkspace(construct, name: $"law-{construct.Resource.Name}"); - autoInjectedLogAnalyticsWorkspace.Properties.Tags["aspire-resource-name"] = $"law-{construct.Resource.Name}"; + var autoInjectedLogAnalyticsWorkspaceName = $"law-{construct.Resource.Name}"; + var autoInjectedLogAnalyticsWorkspace = new OperationalInsightsWorkspace(construct, name: autoInjectedLogAnalyticsWorkspaceName); + autoInjectedLogAnalyticsWorkspace.Properties.Tags["aspire-resource-name"] = autoInjectedLogAnalyticsWorkspaceName; autoInjectedLogAnalyticsWorkspace.AssignProperty(p => p.Sku.Name, "'PerGB2018'"); // If the user does not supply a log analytics workspace of their own we still create a parameter on the Aspire From 096cc552841dc6b937b6126c1a1893dc8359e741 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 11:54:03 +1100 Subject: [PATCH 09/14] Fix up test case. --- tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs index af7e441fd8..ec6a4d1d7c 100644 --- a/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/Azure/AzureBicepResourceTests.cs @@ -551,7 +551,7 @@ public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParamete name: toLower(take('appInsights${uniqueString(resourceGroup().id)}', 24)) location: location tags: { - 'aspire-resource-name': 'law-appInsights' + 'aspire-resource-name': 'appInsights' } kind: kind properties: { @@ -563,6 +563,9 @@ public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParamete resource operationalInsightsWorkspace_smwjw0Wga 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { name: toLower(take('law-appInsights${uniqueString(resourceGroup().id)}', 24)) location: location + tags: { + 'aspire-resource-name': 'law-appInsights' + } properties: { sku: { name: 'PerGB2018' From 620bdbab5ce49fecd9496399dc0abd6931c0ea95 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 11:56:44 +1100 Subject: [PATCH 10/14] Bump package versions and remove NuGet config. --- Directory.Packages.props | 32 ++++++++++++++++---------------- NuGet.config | 7 ------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5b0ecfc11d..55209900ee 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -33,22 +33,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/NuGet.config b/NuGet.config index 74cfe41480..6d66afe4db 100644 --- a/NuGet.config +++ b/NuGet.config @@ -19,18 +19,11 @@ - - - - - - - From 0ff697dad87f547e4e01d389a8bcc716b9fe7adf Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 13:53:20 +1100 Subject: [PATCH 11/14] Update packages. --- Directory.Packages.props | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 55209900ee..ca9a0ae213 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -34,21 +34,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + From bf27c98f377cb96a43faa600bdcaed3cf2c6d5f8 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 16:30:31 +1100 Subject: [PATCH 12/14] Suppress warning. --- src/Aspire.Hosting.Azure/AzureConstructResource.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Aspire.Hosting.Azure/AzureConstructResource.cs b/src/Aspire.Hosting.Azure/AzureConstructResource.cs index 081c572d03..df69c83297 100644 --- a/src/Aspire.Hosting.Azure/AzureConstructResource.cs +++ b/src/Aspire.Hosting.Azure/AzureConstructResource.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using System.Linq.Expressions; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; From b1f80a4b1ac505ee4a0853769c87e56b299b27a2 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 17:21:40 +1100 Subject: [PATCH 13/14] Fix experimental warnings. --- .../AzureEventHubsResource.cs | 2 ++ .../AzurePostgresExtensions.cs | 2 ++ src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs | 6 ++---- .../AzureServiceBusResource.cs | 2 ++ src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs | 6 ++---- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsResource.cs b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsResource.cs index a224c1fea7..6563e9b449 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsResource.cs +++ b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsResource.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using Aspire.Hosting.ApplicationModel; using Azure.Provisioning.EventHubs; diff --git a/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs b/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs index f7f3b45799..a5edb77445 100644 --- a/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs +++ b/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresExtensions.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; diff --git a/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs b/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs index efb454b7ee..022688b182 100644 --- a/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs +++ b/src/Aspire.Hosting.Azure.Redis/AzureRedisExtensions.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; @@ -22,9 +24,7 @@ public static class AzureRedisExtensions /// A reference to the builder. public static IResourceBuilder PublishAsAzureRedis(this IResourceBuilder builder) { -#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.PublishAsAzureRedis(null); -#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -93,9 +93,7 @@ internal static IResourceBuilder PublishAsAzureRedisInternal(this /// A reference to the builder. public static IResourceBuilder AsAzureRedis(this IResourceBuilder builder) { -#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AsAzureRedis(null); -#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// diff --git a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusResource.cs b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusResource.cs index 45be6b1f3e..b70605ffd9 100644 --- a/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusResource.cs +++ b/src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusResource.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using Aspire.Hosting.ApplicationModel; using Azure.Provisioning.ServiceBus; diff --git a/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs b/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs index 0adaaa918c..5f82b686e9 100644 --- a/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs +++ b/src/Aspire.Hosting.Azure.Sql/AzureSqlExtensions.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#pragma warning disable AZPROVISION001 + using System.Diagnostics.CodeAnalysis; using Aspire.Hosting.ApplicationModel; using Aspire.Hosting.Azure; @@ -93,9 +95,7 @@ internal static IResourceBuilder PublishAsAzureSqlDatab /// A reference to the . public static IResourceBuilder PublishAsAzureSqlDatabase(this IResourceBuilder builder) { -#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.PublishAsAzureSqlDatabase(null); -#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// @@ -117,9 +117,7 @@ public static IResourceBuilder PublishAsAzureSqlDatabas /// A reference to the . public static IResourceBuilder AsAzureSqlDatabase(this IResourceBuilder builder) { -#pragma warning disable AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. return builder.AsAzureSqlDatabase(null); -#pragma warning restore AZPROVISION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. } /// From 44f071d005ee5409754f068b6767dca7fdc38a81 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 5 Apr 2024 19:28:10 +1100 Subject: [PATCH 14/14] Update refresh manifests script. --- eng/refreshManifests.ps1 | 2 ++ playground/orleans/OrleansAppHost/aspire-manifest.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/refreshManifests.ps1 b/eng/refreshManifests.ps1 index e69de29bb2..581b7e0591 100644 --- a/eng/refreshManifests.ps1 +++ b/eng/refreshManifests.ps1 @@ -0,0 +1,2 @@ +..\build.cmd +get-childitem ..\playground\*AppHost.csproj -Recurse | % { "Generating Manifest for: $_"; dotnet run --no-build --project $_.FullName --launch-profile generate-manifest } \ No newline at end of file diff --git a/playground/orleans/OrleansAppHost/aspire-manifest.json b/playground/orleans/OrleansAppHost/aspire-manifest.json index a6e308dca8..9be1ce102c 100644 --- a/playground/orleans/OrleansAppHost/aspire-manifest.json +++ b/playground/orleans/OrleansAppHost/aspire-manifest.json @@ -29,7 +29,7 @@ "Orleans__GrainStorage__Default__ProviderType": "AzureBlobStorage", "Orleans__GrainStorage__Default__ServiceKey": "grainstate", "ConnectionStrings__grainstate": "{grainstate.connectionString}", - "Orleans__ClusterId": "8578f94495f94302a742fd92fb958ece", + "Orleans__ClusterId": "c7673f46dfc745c8b4492b957aa42408", "Orleans__Endpoints__SiloPort": "{silo.bindings.orleans-silo.targetPort}", "Orleans__Endpoints__GatewayPort": "{silo.bindings.orleans-gateway.targetPort}", "Orleans__EnableDistributedTracing": "true"