Skip to content

Commit edb03ab

Browse files
Prajwal-MicrosoftPrasanjeet-MicrosoftRoopan-MicrosoftAjitPadhi-MicrosoftPavan-Microsoft
authored
feat: Down merge from dev & resolved conflicts (#1826)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: Roopan-Microsoft <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Roopan P M <[email protected]> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <[email protected]> Co-authored-by: Prashant-Microsoft <[email protected]> Co-authored-by: Rohini-Microsoft <[email protected]> Co-authored-by: Avijit-Microsoft <[email protected]> Co-authored-by: RaviKiran-Microsoft <[email protected]> Co-authored-by: Somesh Joshi <[email protected]> Co-authored-by: Himanshi Agrawal <[email protected]> Co-authored-by: pradeepjha-microsoft <[email protected]> Co-authored-by: Harmanpreet Kaur <[email protected]> Co-authored-by: Bangarraju-Microsoft <[email protected]> Co-authored-by: Harsh-Microsoft <[email protected]> Co-authored-by: Kanchan-Microsoft <[email protected]> Co-authored-by: Cristopher Coronado <[email protected]> Co-authored-by: Cristopher Coronado Moreira <[email protected]> Co-authored-by: Vamshi-Microsoft <[email protected]> Co-authored-by: Thanusree-Microsoft <[email protected]>
1 parent f075a9b commit edb03ab

9 files changed

+119
-38
lines changed

docs/azure_app_service_auth_setup.md

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,33 @@
11
# Set Up Authentication in Azure App Service
22

3+
This document provides step-by-step instructions to configure Azure App Registrations for a front-end application.
4+
5+
## Prerequisites
6+
7+
- Access to **Microsoft Entra ID**
8+
- Necessary permissions to create and manage **App Registrations**
9+
310
## Step 1: Add Authentication in Azure App Service configuration
411

512
1. Click on `Authentication` from left menu.
613

714
![Authentication](images/AppAuthentication.png)
815

9-
2. Click on `+ Add Provider` to see a list of identity providers.
16+
2. Click on `+ Add identity provider` to see a list of identity providers.
1017

1118
![Authentication Identity](images/AppAuthenticationIdentity.png)
1219

13-
3. Click on `+ Add Provider` to see a list of identity providers.
20+
3. Click on `Identity Provider` dropdown to see a list of identity providers.
1421

1522
![Add Provider](images/AppAuthIdentityProvider.png)
1623

17-
4. Select the first option `Microsoft Entra Id` from the drop-down list. If `Create new app registration` is disabled, go to [Step 1a](#step-1a-creating-a-new-app-registration).
24+
4. Select the first option `Microsoft Entra Id` from the drop-down list and select `client secret expiration` under App registration.
25+
> NOTE: If `Create new app registration` is disabled, then go to [Create new app registration](/docs/create_new_app_registration.md) and come back to this step to complete the app authentication.
1826
1927
![Add Provider](images/AppAuthIdentityProviderAdd.png)
2028

2129
5. Accept the default values and click on `Add` button to go back to the previous page with the identify provider added.
2230

2331
![Add Provider](images/AppAuthIdentityProviderAdded.png)
2432

25-
### Step 1a: Creating a new App Registration
26-
27-
1. Click on `Home` and select `Microsoft Entra ID`.
28-
29-
![Microsoft Entra ID](images/MicrosoftEntraID.png)
30-
31-
2. Click on `App registrations`.
32-
33-
![App registrations](images/Appregistrations.png)
34-
35-
3. Click on `+ New registration`.
36-
37-
![New Registrations](images/NewRegistration.png)
38-
39-
4. Provide the `Name`, select supported account types as `Accounts in this organizational directory only(Contoso only - Single tenant)`, select platform as `Web`, enter/select the `URL` and register.
40-
41-
![Add Details](images/AddDetails.png)
42-
43-
5. After application is created sucessfully, then click on `Add a Redirect URL`.
44-
45-
![Redirect URL](images/AddRedirectURL.png)
46-
47-
6. Click on `+ Add a platform`.
48-
49-
![+ Add platform](images/AddPlatform.png)
50-
51-
7. Click on `Web`.
52-
53-
![Web](images/Web.png)
54-
55-
8. Enter the `web app URL` (Provide the app service name in place of XXXX) and Save. Then go back to [Step 1](#step-1-add-authentication-in-azure-app-service-configuration) and follow from _Point 4_ choose `Pick an existing app registration in this directory` from the Add an Identity Provider page and provide the newly registered App Name.
56-
E.g. https://appservicename.azurewebsites.net/.auth/login/aad/callback
57-
58-
![Add Details](images/WebAppURL.png)
33+
6. You have successfully added app authentication, and now required to log in to access the application.

docs/create_new_app_registration.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Creating a new App Registration
2+
3+
1. Click on `Home` and select `Microsoft Entra ID`.
4+
5+
![Microsoft Entra ID](images/MicrosoftEntraID.png)
6+
7+
2. Click on `App registrations`.
8+
9+
![App registrations](images/Appregistrations.png)
10+
11+
3. Click on `+ New registration`.
12+
13+
![New Registrations](images/NewRegistration.png)
14+
15+
4. Provide the `Name`, select supported account types as `Accounts in this organizational directory only(Contoso only - Single tenant)`, select platform as `Web`, enter/select the `URL` and register.
16+
17+
![Add Details](images/AddDetails.png)
18+
19+
5. After application is created successfully, then click on `Add a Redirect URL`.
20+
21+
![Redirect URL](images/AddRedirectURL.png)
22+
23+
6. Click on `+ Add a platform`.
24+
25+
![+ Add platform](images/AddPlatform.png)
26+
27+
7. Click on `Web`.
28+
29+
![Web](images/Web.png)
30+
31+
8. Enter the `web app URL` (Provide the app service name in place of XXXX) and Save. Then go back to [Set Up Authentication in Azure App Service](/docs/azure_app_service_auth_setup.md) Step 1 page and follow from _Point 4_ choose `Pick an existing app registration in this directory` from the Add an Identity Provider page and provide the newly registered App Name.
32+
33+
E.g. <<https://<< appservicename >>.azurewebsites.net/.auth/login/aad/callback>>
34+
35+
![Add Details](images/WebAppURL.png)
-80.8 KB
Loading
-134 KB
Loading
-178 KB
Loading

docs/images/AppAuthentication.png

-182 KB
Loading
-185 KB
Loading

infra/main.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12297,4 +12297,4 @@
1229712297
"value": "[variables('semanticKernelSystemPrompt')]"
1229812298
}
1229912299
}
12300-
}
12300+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import logging
2+
3+
from config.constants import *
4+
from pages.adminPage import AdminPage
5+
from pages.webUserPage import WebUserPage
6+
7+
logger = logging.getLogger(__name__)
8+
9+
10+
def test_golden_path_web_page_demo_script(login_logout):
11+
"""Validate Golden path test case for Chat with your Data"""
12+
page = login_logout
13+
page.goto(ADMIN_URL)
14+
logger.info("Step 1: Validate Admin page is loaded.")
15+
admin_page = AdminPage(page)
16+
assert (
17+
admin_page_title == page.locator(admin_page.ADMIN_PAGE_TITLE).text_content()
18+
), "page title not found"
19+
logger.info("Step 2: Validate Files are uploaded or not")
20+
admin_page.click_delete_data_tab()
21+
assert (
22+
page.locator(admin_page.DELETE_CHECK_BOXES).count() >= 1
23+
), "Files are not uploaded."
24+
logger.info("Step 3: Validate Web page is loaded.")
25+
page.goto(WEB_URL)
26+
home_page = WebUserPage(page)
27+
logger.info("Step 5: Validate Chat history has been deleted.")
28+
home_page.delete_chat_history()
29+
30+
failed_questions = []
31+
logger.info("Step 6: Validate Golden Path prompts response")
32+
33+
def ask_question_and_check(question, attempt):
34+
home_page.wait_for_load(4000)
35+
home_page.enter_a_question(question)
36+
home_page.click_send_button()
37+
home_page.validate_response_status(question)
38+
39+
response_text = page.locator(home_page.ANSWER_TEXT)
40+
response_count = response_text.count()
41+
42+
if response_count == 0:
43+
return False # no response found
44+
45+
response_text_content = response_text.nth(response_count - 1).text_content()
46+
47+
if response_text_content == invalid_response:
48+
print(f"[Attempt {attempt}] Invalid response for prompt: {question}")
49+
return False
50+
return True
51+
52+
# First run through all questions
53+
for question in questions:
54+
if not ask_question_and_check(question, attempt=1):
55+
failed_questions.append(question)
56+
57+
# Retry failed questions once more
58+
if failed_questions:
59+
logger.info("Step 7: Retry failed question one more time.")
60+
for question in failed_questions:
61+
if not ask_question_and_check(question, attempt=2):
62+
home_page.soft_assert(
63+
False,
64+
f"Failed after retry- Invalid response for prompt: {question}",
65+
)
66+
67+
logger.info("Step 8: Validate chat history.")
68+
home_page.show_chat_history()
69+
logger.info("Step 9: Validate chat history closed.")
70+
home_page.close_chat_history()
71+
home_page.assert_all()

0 commit comments

Comments
 (0)