@@ -38,6 +38,13 @@ public async Task PublishAsync_GeneratesMainBicep(bool useContext)
3838 var description = builder . AddParameter ( "skuDescription" , "The sku is " , publishValueAsDefault : true ) ;
3939 var skuDescriptionExpr = ReferenceExpression . Create ( $ "{ description } { storageSku } ") ;
4040
41+ var kvName = builder . AddParameter ( "kvName" ) ;
42+ var kvRg = builder . AddParameter ( "kvRg" , "rg-shared" ) ;
43+
44+ builder . AddAzureKeyVault ( "kv" ) . AsExisting ( kvName , kvRg ) ;
45+
46+ builder . AddAzureStorage ( "existing-storage" ) . PublishAsExisting ( "images" , "rg-shared" ) ;
47+
4148 var pgdb = builder . AddAzurePostgresFlexibleServer ( "pg" ) . AddDatabase ( "pgdb" ) ;
4249 var cosmos = builder . AddAzureCosmosDB ( "account" ) . AddCosmosDatabase ( "db" ) ;
4350 var blobs = builder . AddAzureStorage ( "storage" )
@@ -103,25 +110,29 @@ public async Task PublishAsync_GeneratesMainBicep(bool useContext)
103110 targetScope = 'subscription'
104111
105112 param environmentName string
106-
113+
107114 param location string
108-
115+
109116 param principalId string
110-
117+
118+ param kvRg string
119+
120+ param kvName string
121+
111122 param storageSku string = 'Standard_LRS'
112-
123+
113124 param skuDescription string = 'The sku is '
114-
125+
115126 var tags = {
116127 'aspire-env-name': environmentName
117128 }
118-
129+
119130 resource rg 'Microsoft.Resources/resourceGroups@2023-07-01' = {
120131 name: 'rg-${environmentName}'
121132 location: location
122133 tags: tags
123134 }
124-
135+
125136 module acaEnv 'acaEnv/acaEnv.bicep' = {
126137 name: 'acaEnv'
127138 scope: rg
@@ -130,23 +141,40 @@ param principalId string
130141 userPrincipalId: principalId
131142 }
132143 }
133-
144+
145+ module kv 'kv/kv.bicep' = {
146+ name: 'kv'
147+ scope: resourceGroup(kvRg)
148+ params: {
149+ location: location
150+ kvName: kvName
151+ }
152+ }
153+
154+ module existing_storage 'existing-storage/existing-storage.bicep' = {
155+ name: 'existing-storage'
156+ scope: resourceGroup('rg-shared')
157+ params: {
158+ location: location
159+ }
160+ }
161+
134162 module pg 'pg/pg.bicep' = {
135163 name: 'pg'
136164 scope: rg
137165 params: {
138166 location: location
139167 }
140168 }
141-
169+
142170 module account 'account/account.bicep' = {
143171 name: 'account'
144172 scope: rg
145173 params: {
146174 location: location
147175 }
148176 }
149-
177+
150178 module storage 'storage/storage.bicep' = {
151179 name: 'storage'
152180 scope: rg
@@ -156,7 +184,7 @@ param principalId string
156184 sku_description: '${skuDescription} ${storageSku}'
157185 }
158186 }
159-
187+
160188 module mod 'mod/mod.bicep' = {
161189 name: 'mod'
162190 scope: rg
@@ -165,15 +193,15 @@ param principalId string
165193 pgdb: '${pg.outputs.connectionString};Database=pgdb'
166194 }
167195 }
168-
196+
169197 module myapp_identity 'myapp-identity/myapp-identity.bicep' = {
170198 name: 'myapp-identity'
171199 scope: rg
172200 params: {
173201 location: location
174202 }
175203 }
176-
204+
177205 module myapp_roles_account 'myapp-roles-account/myapp-roles-account.bicep' = {
178206 name: 'myapp-roles-account'
179207 scope: rg
@@ -183,15 +211,15 @@ param principalId string
183211 principalId: myapp_identity.outputs.principalId
184212 }
185213 }
186-
214+
187215 module fe_identity 'fe-identity/fe-identity.bicep' = {
188216 name: 'fe-identity'
189217 scope: rg
190218 params: {
191219 location: location
192220 }
193221 }
194-
222+
195223 module fe_roles_storage 'fe-roles-storage/fe-roles-storage.bicep' = {
196224 name: 'fe-roles-storage'
197225 scope: rg
@@ -201,25 +229,25 @@ param principalId string
201229 principalId: fe_identity.outputs.principalId
202230 }
203231 }
204-
232+
205233 output myapp_identity_id string = myapp_identity.outputs.id
206-
234+
207235 output myapp_identity_clientId string = myapp_identity.outputs.clientId
208-
236+
209237 output account_connectionString string = account.outputs.connectionString
210-
238+
211239 output acaEnv_AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN string = acaEnv.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN
212240
213241 output acaEnv_AZURE_CONTAINER_APPS_ENVIRONMENT_ID string = acaEnv.outputs.AZURE_CONTAINER_APPS_ENVIRONMENT_ID
214-
242+
215243 output fe_identity_id string = fe_identity.outputs.id
216-
244+
217245 output fe_identity_clientId string = fe_identity.outputs.clientId
218-
246+
219247 output storage_blobEndpoint string = storage.outputs.blobEndpoint
220-
248+
221249 output acaEnv_AZURE_CONTAINER_REGISTRY_ENDPOINT string = acaEnv.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT
222-
250+
223251 output acaEnv_AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID string = acaEnv.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID
224252 """ ;
225253 output . WriteLine ( content ) ;
0 commit comments