@@ -53,17 +53,15 @@ import { AzureOperations } from "./azureOps";
53
53
import { TokenCredentialsBase } from "@azure/ms-rest-nodeauth" ;
54
54
import path from "path" ;
55
55
import { getTemplatesFolder } from "../../.." ;
56
- import { ScaffoldArmTemplateResult } from "../../../common/armInterface" ;
56
+ import { ArmTemplateResult } from "../../../common/armInterface" ;
57
57
import { Bicep , ConstantString } from "../../../common/constants" ;
58
58
import {
59
59
copyFiles ,
60
- generateBicepFiles ,
61
60
getResourceGroupNameFromResourceId ,
62
61
getSiteNameFromResourceId ,
63
62
getSubscriptionIdFromResourceId ,
64
63
isArmSupportEnabled ,
65
64
} from "../../../common" ;
66
- import { AzureSolutionSettings } from "@microsoft/teamsfx-api" ;
67
65
import { getArmOutput } from "../utils4v2" ;
68
66
69
67
export class TeamsBotImpl {
@@ -198,78 +196,42 @@ export class TeamsBotImpl {
198
196
199
197
const bicepTemplateDir = path . join ( getTemplatesFolder ( ) , PathInfo . BicepTemplateRelativeDir ) ;
200
198
201
- const selectedPlugins = ( this . ctx . projectSettings ?. solutionSettings as AzureSolutionSettings )
202
- . activeResourcePlugins ;
203
- const handleBarsContext = {
204
- Plugins : selectedPlugins ,
205
- } ;
206
-
207
- const provisionModuleContentResult = await generateBicepFiles (
208
- path . join ( bicepTemplateDir , PathInfo . ProvisionModuleTemplateFileName ) ,
209
- handleBarsContext
210
- ) ;
211
- if ( provisionModuleContentResult . isErr ( ) ) {
212
- throw provisionModuleContentResult . error ;
213
- }
214
-
215
- const configurationModuleContentResult = await generateBicepFiles (
216
- path . join ( bicepTemplateDir , PathInfo . ConfigurationModuleTemplateFileName ) ,
217
- handleBarsContext
218
- ) ;
219
- if ( configurationModuleContentResult . isErr ( ) ) {
220
- throw configurationModuleContentResult . error ;
221
- }
222
-
223
- const inputParameterContentResult = await generateBicepFiles (
224
- path . join ( bicepTemplateDir , Bicep . ParameterOrchestrationFileName ) ,
225
- handleBarsContext
226
- ) ;
227
- if ( inputParameterContentResult . isErr ( ) ) {
228
- throw inputParameterContentResult . error ;
229
- }
230
-
231
- const moduleOrchestrationContentResult = await generateBicepFiles (
232
- path . join ( bicepTemplateDir , Bicep . ModuleOrchestrationFileName ) ,
233
- handleBarsContext
234
- ) ;
235
- if ( moduleOrchestrationContentResult . isErr ( ) ) {
236
- throw moduleOrchestrationContentResult . error ;
237
- }
238
-
239
- const outputOrchestrationContentResult = await generateBicepFiles (
240
- path . join ( bicepTemplateDir , Bicep . OutputOrchestrationFileName ) ,
241
- handleBarsContext
242
- ) ;
243
- if ( outputOrchestrationContentResult . isErr ( ) ) {
244
- throw outputOrchestrationContentResult . error ;
245
- }
246
-
247
- const result : ScaffoldArmTemplateResult = {
248
- Modules : {
249
- botProvision : {
250
- Content : provisionModuleContentResult . value ,
199
+ const result : ArmTemplateResult = {
200
+ Provision : {
201
+ Orchestration : await fs . readFile (
202
+ path . join ( bicepTemplateDir , Bicep . ProvisionV2FileName ) ,
203
+ ConstantString . UTF8Encoding
204
+ ) ,
205
+ Modules : {
206
+ botProvision : await fs . readFile (
207
+ path . join ( bicepTemplateDir , PathInfo . ProvisionModuleTemplateV2FileName ) ,
208
+ ConstantString . UTF8Encoding
209
+ ) ,
251
210
} ,
252
- botConfiguration : {
253
- Content : configurationModuleContentResult . value ,
211
+ Reference : {
212
+ resourceId : "webAppResourceId" ,
213
+ hostName : "webAppHostName" ,
214
+ webAppEndpoint : "webAppEndpoint" ,
254
215
} ,
255
216
} ,
256
- Orchestration : {
257
- ParameterTemplate : {
258
- Content : inputParameterContentResult . value ,
259
- ParameterJson : JSON . parse (
260
- await fs . readFile (
261
- path . join ( bicepTemplateDir , Bicep . ParameterFileName ) ,
262
- ConstantString . UTF8Encoding
263
- )
217
+ Configuration : {
218
+ Orchestration : await fs . readFile (
219
+ path . join ( bicepTemplateDir , Bicep . ConfigV2FileName ) ,
220
+ ConstantString . UTF8Encoding
221
+ ) ,
222
+ Modules : {
223
+ botConfiguration : await fs . readFile (
224
+ path . join ( bicepTemplateDir , PathInfo . ConfigurationModuleTemplateV2FileName ) ,
225
+ ConstantString . UTF8Encoding
264
226
) ,
265
227
} ,
266
- ModuleTemplate : {
267
- Content : moduleOrchestrationContentResult . value ,
268
- } ,
269
- OutputTemplate : {
270
- Content : outputOrchestrationContentResult . value ,
271
- } ,
272
228
} ,
229
+ Parameters : JSON . parse (
230
+ await fs . readFile (
231
+ path . join ( bicepTemplateDir , Bicep . ParameterFileName ) ,
232
+ ConstantString . UTF8Encoding
233
+ )
234
+ ) ,
273
235
} ;
274
236
275
237
Logger . info ( Messages . SuccessfullyGenerateArmTemplatesBot ) ;
0 commit comments