From 925172708c51fe87f813c91bbda716419cd4f411 Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:38:40 +0530 Subject: [PATCH 01/10] docs: Update package.nls.json --- packages/fx-core/resource/package.nls.json | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/fx-core/resource/package.nls.json b/packages/fx-core/resource/package.nls.json index 0e5e3610b2..fef6451803 100644 --- a/packages/fx-core/resource/package.nls.json +++ b/packages/fx-core/resource/package.nls.json @@ -631,32 +631,32 @@ "driver.aadApp.error.missingEnv": "Environment variable %s is not set.", "driver.aadApp.error.generateSecretFailed": "Cannot generate client secret.", "driver.aadApp.error.invalidFieldInManifest": "Field %s is missing or invalid in Microsoft Entra app manifest.", - "driver.aadApp.error.appNameTooLong": "The name for this Microsoft Entra app is too long. The maximum length is 120.", + "driver.aadApp.error.appNameTooLong": "The Microsoft Entra app name is too long. Maximum character length is 120.", "driver.aadApp.error.credentialInvalidLifetimeAsPerAppPolicy": "The client secret lifetime is too long for your tenant. Use a shorter value with the clientSecretExpireDays parameter.", "driver.aadApp.error.credentialTypeNotAllowedAsPerAppPolicy": "Your tenant doesn't allow creating a client secret for Microsoft Entra app. Create and configure the app manually.", - "driver.aadApp.progressBar.createAadAppTitle": "Creating Microsoft Entra application...", - "driver.aadApp.progressBar.updateAadAppTitle": "Updating Microsoft Entra application...", - "driver.aadApp.log.startExecuteDriver": "Executing action %s", + "driver.aadApp.progressBar.createAadAppTitle": "Microsoft Entra app creation is in progress...", + "driver.aadApp.progressBar.updateAadAppTitle": "Microsoft Entra app update is in progress...", + "driver.aadApp.log.startExecuteDriver": "Execution of action %s is in progress...", "driver.aadApp.log.successExecuteDriver": "Action %s executed successfully", "driver.aadApp.log.failExecuteDriver": "Unable to execute action %s. Error message: %s", - "driver.aadApp.log.startCreateAadApp": "Environment variable %s does not exist, creating a new Microsoft Entra app...", - "driver.aadApp.log.successCreateAadApp": "Created Microsoft Entra application with object id %s", - "driver.aadApp.log.skipCreateAadApp": "Environment variable %s already exist, skipping new Microsoft Entra app creation step.", - "driver.aadApp.log.startGenerateClientSecret": "Environment variable %s does not exist, generating client secret for Microsoft Entra app...", - "driver.aadApp.log.successGenerateClientSecret": "Generated client secret for Microsoft Entra application with object id %s", - "driver.aadApp.log.skipGenerateClientSecret": "Environment variable %s already exist, skipping Microsoft Entra app client secret generation step.", + "driver.aadApp.log.startCreateAadApp": "Environment variable %s doesn't exist, creating a new Microsoft Entra app...", + "driver.aadApp.log.successCreateAadApp": "Microsoft Entra app created with object id %s", + "driver.aadApp.log.skipCreateAadApp": "Environment variable %s already exists, skipping new Microsoft Entra app creation step.", + "driver.aadApp.log.startGenerateClientSecret": "Environment variable %s doesn't exist, generating client secret for Microsoft Entra app...", + "driver.aadApp.log.successGenerateClientSecret": "Client secret for Microsoft Entra app generated with object id %s", + "driver.aadApp.log.skipGenerateClientSecret": "Environment variable %s already exists, skipping Microsoft Entra app client secret generation step.", "driver.aadApp.log.outputAadAppManifest": "Build Microsoft Entra app manifest completed, and app manifest content is written to %s", - "driver.aadApp.log.successUpdateAadAppManifest": "Applied manifest %s to Microsoft Entra application with object id %s", - "botRegistration.ProgressBar.creatingBotAadApp": "Creating bot Microsoft Entra app...", - "botRegistration.log.startCreateBotAadApp": "Creating bot Microsoft Entra app.", + "driver.aadApp.log.successUpdateAadAppManifest": "Applied manifest %s to Microsoft Entra app with object id %s", + "botRegistration.ProgressBar.creatingBotAadApp": "Bot Microsoft Entra app creation is in progress...", + "botRegistration.log.startCreateBotAadApp": "Bot Microsoft Entra app is in progress...", "botRegistration.log.successCreateBotAadApp": "Bot Microsoft Entra app created successfully.", "botRegistration.log.skipCreateBotAadApp": "Bot Microsoft Entra app creation skipped.", "driver.botAadApp.create.description": "create a new or reuse an existing bot Microsoft Entra app.", - "driver.botAadApp.log.startExecuteDriver": "Executing action %s", + "driver.botAadApp.log.startExecuteDriver": "Execution of action %s is in progress...", "driver.botAadApp.log.successExecuteDriver": "Action %s executed successfully", "driver.botAadApp.log.failExecuteDriver": "Unable to execute action %s. Error message: %s", - "driver.botAadApp.log.successCreateBotAad": "Created Microsoft Entra application with client id %s.", - "driver.botAadApp.log.useExistingBotAad": "Used existing Microsoft Entra application with client id %s.", + "driver.botAadApp.log.successCreateBotAad": "Created Microsoft Entra app with client id %s.", + "driver.botAadApp.log.useExistingBotAad": "Used existing Microsoft Entra app with client id %s.", "driver.botAadApp.error.unexpectedEmptyBotPassword": "Bot password is empty. Add it in env file or clear bot id to have bot id/password pair regenerated. action: %s.", "driver.arm.description.deploy": "Deploy the given ARM templates to Azure.", "driver.arm.deploy.progressBar.message": "Deploying the ARM templates to Azure...", From a5b0388f73dc824b36b6bb8e7681c25519fd9afa Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:30:03 +0530 Subject: [PATCH 02/10] Update update.test.ts --- packages/fx-core/tests/component/driver/aad/update.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/tests/component/driver/aad/update.test.ts b/packages/fx-core/tests/component/driver/aad/update.test.ts index eb5c0a8a2c..b6d252e2d1 100644 --- a/packages/fx-core/tests/component/driver/aad/update.test.ts +++ b/packages/fx-core/tests/component/driver/aad/update.test.ts @@ -153,7 +153,7 @@ describe("aadAppUpdate", async () => { const informationSpy = sinon.spy(mockedDriverContext.logProvider, "info"); const result = await updateAadAppDriver.execute(args, mockedDriverContext); chai.assert.isTrue(informationSpy.called); - chai.assert.equal(informationSpy.getCall(0).args[0], "Executing action aadApp/update"); + chai.assert.equal(informationSpy.getCall(0).args[0], "Execution of action aadApp/update is in progress..."); const manifestOutputFilePath = path.join( mockedDriverContext.projectPath, outputRoot, From 2f8db5e0f0c6cdabd9351970c2f6a3abefede198 Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:35:35 +0530 Subject: [PATCH 03/10] Update package.nls.json --- packages/fx-core/resource/package.nls.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/fx-core/resource/package.nls.json b/packages/fx-core/resource/package.nls.json index fef6451803..2d45e8c806 100644 --- a/packages/fx-core/resource/package.nls.json +++ b/packages/fx-core/resource/package.nls.json @@ -634,9 +634,9 @@ "driver.aadApp.error.appNameTooLong": "The Microsoft Entra app name is too long. Maximum character length is 120.", "driver.aadApp.error.credentialInvalidLifetimeAsPerAppPolicy": "The client secret lifetime is too long for your tenant. Use a shorter value with the clientSecretExpireDays parameter.", "driver.aadApp.error.credentialTypeNotAllowedAsPerAppPolicy": "Your tenant doesn't allow creating a client secret for Microsoft Entra app. Create and configure the app manually.", - "driver.aadApp.progressBar.createAadAppTitle": "Microsoft Entra app creation is in progress...", - "driver.aadApp.progressBar.updateAadAppTitle": "Microsoft Entra app update is in progress...", - "driver.aadApp.log.startExecuteDriver": "Execution of action %s is in progress...", + "driver.aadApp.progressBar.createAadAppTitle": "Creating Microsoft Entra app...", + "driver.aadApp.progressBar.updateAadAppTitle": "Updating Microsoft Entra app...", + "driver.aadApp.log.startExecuteDriver": "Executing action %s...", "driver.aadApp.log.successExecuteDriver": "Action %s executed successfully", "driver.aadApp.log.failExecuteDriver": "Unable to execute action %s. Error message: %s", "driver.aadApp.log.startCreateAadApp": "Environment variable %s doesn't exist, creating a new Microsoft Entra app...", @@ -652,7 +652,7 @@ "botRegistration.log.successCreateBotAadApp": "Bot Microsoft Entra app created successfully.", "botRegistration.log.skipCreateBotAadApp": "Bot Microsoft Entra app creation skipped.", "driver.botAadApp.create.description": "create a new or reuse an existing bot Microsoft Entra app.", - "driver.botAadApp.log.startExecuteDriver": "Execution of action %s is in progress...", + "driver.botAadApp.log.startExecuteDriver": "Executing action %s...", "driver.botAadApp.log.successExecuteDriver": "Action %s executed successfully", "driver.botAadApp.log.failExecuteDriver": "Unable to execute action %s. Error message: %s", "driver.botAadApp.log.successCreateBotAad": "Created Microsoft Entra app with client id %s.", From e63dff6894bc1780bdbe02062b808215c358835b Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:36:03 +0530 Subject: [PATCH 04/10] Update create.test.ts --- packages/fx-core/tests/component/driver/aad/create.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/tests/component/driver/aad/create.test.ts b/packages/fx-core/tests/component/driver/aad/create.test.ts index 68db635b0b..628e50df18 100644 --- a/packages/fx-core/tests/component/driver/aad/create.test.ts +++ b/packages/fx-core/tests/component/driver/aad/create.test.ts @@ -375,7 +375,7 @@ describe("aadAppCreate", async () => { .is.instanceOf(MissingEnvUserError) .and.has.property( "message", - "Cannot generate client secret. Environment variable AAD_APP_OBJECT_ID is not set." + "Unable to generate client secret. Environment variable AAD_APP_OBJECT_ID is not set." ); }); From 2521b2520d894dc50d20e97841a65fd798230dc8 Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:42:02 +0530 Subject: [PATCH 05/10] Update update.test.ts --- packages/fx-core/tests/component/driver/aad/update.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/tests/component/driver/aad/update.test.ts b/packages/fx-core/tests/component/driver/aad/update.test.ts index b6d252e2d1..6d0c8f349c 100644 --- a/packages/fx-core/tests/component/driver/aad/update.test.ts +++ b/packages/fx-core/tests/component/driver/aad/update.test.ts @@ -166,7 +166,7 @@ describe("aadAppUpdate", async () => { ); chai.assert.equal( informationSpy.getCall(2).args[0], - `Applied manifest ${manifestPath} to Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Applied manifest ${manifestPath} to Microsoft Entra app with object id 00000000-0000-0000-0000-000000000000` ); chai.assert.equal( informationSpy.getCall(3).args[0], From 93107b487fcc6d3081ed7b419b50a78a08934855 Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:20:18 +0530 Subject: [PATCH 06/10] Update update.test.ts --- packages/fx-core/tests/component/driver/aad/update.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/tests/component/driver/aad/update.test.ts b/packages/fx-core/tests/component/driver/aad/update.test.ts index 6d0c8f349c..c86df7a2e5 100644 --- a/packages/fx-core/tests/component/driver/aad/update.test.ts +++ b/packages/fx-core/tests/component/driver/aad/update.test.ts @@ -153,7 +153,7 @@ describe("aadAppUpdate", async () => { const informationSpy = sinon.spy(mockedDriverContext.logProvider, "info"); const result = await updateAadAppDriver.execute(args, mockedDriverContext); chai.assert.isTrue(informationSpy.called); - chai.assert.equal(informationSpy.getCall(0).args[0], "Execution of action aadApp/update is in progress..."); + chai.assert.equal(informationSpy.getCall(0).args[0], "Executing action aadApp/update..."); const manifestOutputFilePath = path.join( mockedDriverContext.projectPath, outputRoot, From 921521b7ccefdc1be0d8a868b67121c387c599aa Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:21:59 +0530 Subject: [PATCH 07/10] Update package.nls.json --- packages/fx-core/resource/package.nls.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/resource/package.nls.json b/packages/fx-core/resource/package.nls.json index 2d45e8c806..7f2d4e84ae 100644 --- a/packages/fx-core/resource/package.nls.json +++ b/packages/fx-core/resource/package.nls.json @@ -629,7 +629,7 @@ "driver.aadApp.description.create": "Create a Microsoft Entra app to authenticate users", "driver.aadApp.description.update": "Apply Microsoft Entra app manifest to an existing app", "driver.aadApp.error.missingEnv": "Environment variable %s is not set.", - "driver.aadApp.error.generateSecretFailed": "Cannot generate client secret.", + "driver.aadApp.error.generateSecretFailed": "Unable to generate client secret.", "driver.aadApp.error.invalidFieldInManifest": "Field %s is missing or invalid in Microsoft Entra app manifest.", "driver.aadApp.error.appNameTooLong": "The Microsoft Entra app name is too long. Maximum character length is 120.", "driver.aadApp.error.credentialInvalidLifetimeAsPerAppPolicy": "The client secret lifetime is too long for your tenant. Use a shorter value with the clientSecretExpireDays parameter.", From ecdfbd20d75b6dbf098ebe89e5f5cb2f303e1f2e Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:37:32 +0530 Subject: [PATCH 08/10] Update create.test.ts --- .../fx-core/tests/component/driver/aad/create.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/fx-core/tests/component/driver/aad/create.test.ts b/packages/fx-core/tests/component/driver/aad/create.test.ts index 628e50df18..13dd49c1fc 100644 --- a/packages/fx-core/tests/component/driver/aad/create.test.ts +++ b/packages/fx-core/tests/component/driver/aad/create.test.ts @@ -159,7 +159,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id ${expectedObjectId}` + `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` ); expect(result.summaries).includes( `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` @@ -270,7 +270,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id ${expectedObjectId}` + `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` ); expect(result.summaries).includes( `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` @@ -355,7 +355,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(5); expect(result.summaries.length).to.equal(1); expect(result.summaries).includes( - `Created Microsoft Entra application with object id ${expectedObjectId}` + `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` ); }); @@ -691,7 +691,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id ${expectedObjectId}` + `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` ); expect(result.summaries).includes( `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` From 5acb3c2ef1f58398a8ff5bf7676011c617997598 Mon Sep 17 00:00:00 2001 From: supkasar <157565053+supkasar@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:38:00 +0530 Subject: [PATCH 09/10] Update update.test.ts --- packages/fx-core/tests/component/driver/aad/update.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fx-core/tests/component/driver/aad/update.test.ts b/packages/fx-core/tests/component/driver/aad/update.test.ts index c86df7a2e5..afcd532006 100644 --- a/packages/fx-core/tests/component/driver/aad/update.test.ts +++ b/packages/fx-core/tests/component/driver/aad/update.test.ts @@ -192,7 +192,7 @@ describe("aadAppUpdate", async () => { expect(result.summaries.length).to.equal(1); console.log(result.summaries[0]); expect(result.summaries).includes( - `Applied manifest ${args.manifestPath} to Microsoft Entra application with object id ${expectedObjectId}` + `Applied manifest tests/component/driver/aad/testAssets/manifest.json to Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` ); }); it("should success with valid manifest on cli", async () => { From 627072f92a5019cd5c9f10bab1a1705a232f7841 Mon Sep 17 00:00:00 2001 From: Yiqing Zhao Date: Mon, 8 Jul 2024 16:52:35 +0800 Subject: [PATCH 10/10] test: fix ut --- .../tests/component/driver/aad/create.test.ts | 16 ++++++++-------- .../tests/component/driver/aad/update.test.ts | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/fx-core/tests/component/driver/aad/create.test.ts b/packages/fx-core/tests/component/driver/aad/create.test.ts index 13dd49c1fc..fd88230f71 100644 --- a/packages/fx-core/tests/component/driver/aad/create.test.ts +++ b/packages/fx-core/tests/component/driver/aad/create.test.ts @@ -159,10 +159,10 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Microsoft Entra app created with object id ${expectedObjectId}` ); expect(result.summaries).includes( - `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` + `Client secret for Microsoft Entra app generated with object id ${expectedObjectId}` ); }); @@ -270,10 +270,10 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Microsoft Entra app created with object id ${expectedObjectId}` ); expect(result.summaries).includes( - `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` + `Client secret for Microsoft Entra app generated with object id ${expectedObjectId}` ); }); @@ -297,7 +297,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(1); // 1 new env and 2 existing env expect(result.summaries.length).to.equal(1); expect(result.summaries).includes( - `Generated client secret for Microsoft Entra application with object id existing value` + `Client secret for Microsoft Entra app generated with object id existing value` ); }); @@ -355,7 +355,7 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(5); expect(result.summaries.length).to.equal(1); expect(result.summaries).includes( - `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Microsoft Entra app created with object id ${expectedObjectId}` ); }); @@ -691,10 +691,10 @@ describe("aadAppCreate", async () => { expect(result.result._unsafeUnwrap().size).to.equal(6); expect(result.summaries.length).to.equal(2); expect(result.summaries).includes( - `Created Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Microsoft Entra app created with object id ${expectedObjectId}` ); expect(result.summaries).includes( - `Generated client secret for Microsoft Entra application with object id ${expectedObjectId}` + `Client secret for Microsoft Entra app generated with object id ${expectedObjectId}` ); }); diff --git a/packages/fx-core/tests/component/driver/aad/update.test.ts b/packages/fx-core/tests/component/driver/aad/update.test.ts index afcd532006..2445bb9d4b 100644 --- a/packages/fx-core/tests/component/driver/aad/update.test.ts +++ b/packages/fx-core/tests/component/driver/aad/update.test.ts @@ -192,7 +192,7 @@ describe("aadAppUpdate", async () => { expect(result.summaries.length).to.equal(1); console.log(result.summaries[0]); expect(result.summaries).includes( - `Applied manifest tests/component/driver/aad/testAssets/manifest.json to Microsoft Entra application with object id 00000000-0000-0000-0000-000000000000` + `Applied manifest ${args.manifestPath} to Microsoft Entra app with object id ${expectedObjectId}` ); }); it("should success with valid manifest on cli", async () => {