Skip to content

Commit 1e6938c

Browse files
authored
Sample Application (#49)
* App Sample - init commit, app servce bicep, bicep cleanup, auth scripts * Sample app - auth automation * App Sample - bicep updates and cleanup WIP * Sample app - removed index creation from infra, workspace cleanup, private conn fixes * Sample app - added initial docs, infra cleanup * App - setup instructions * App - Virtual Network refactoring, key vault purge fix * App - added secrets to keyvault. doc updates * App - documentation updates * App - minor docs update * App - azure.yaml update for multiple hook scripts for quota and auth_init * Rebuilt main.json. added warning lint removal for dependson * feat: Added Data ingestion script & fixes for Sample App (#63) * add cognitive avm content change api to preview remove hub and project from foundry folder add cognitive module calling the revised avm content. * update to api version added project to avm module * remove aihub aiproject * update name outputs for project * update parameter outputs * removed duplicate cognitive added proj name output * updates to deployment and service connections * update errors for proj * add location * location added to project * add preview to api for project * update projname * update name length * update length of project name * remove connection * name changed * pass cognitive name to existing * update cognitive name * storage connection * update project * add additional parameters * add search connection to project * update project api * update search resource name * update main * update storage connection name * storage account existing connection added * update storage account info * update storage api * storage name * update the storage name * update category to storage * update storage connection category to AzureBlob * update storage name * add cosmos (without flag check) add default container for storage * update cosmos settings * update cosmosdb parameters in project * cosmosdb parameters * add api version metadata * cosmosdb connection api set to 04-01 * remove cosmos references * add cosmos * apply disable local auth to project * adding network acl parameter to aiservicesaccount * change property to deny from null * update CKM enforcement to disabled * update the network acl parameter to allow azure services, and to add the subnet rule. * Add cogntive service user to aiServices module by default. This solves the inability to reach the index from within AI Foundry * Update role assignments for search service. Add Search Index contributor and Search Index Reader to user * Added additional role to user for Cognitive Services Contributor. Control Plane API call access * Add AI Developer role to user * Add UserObjectID parameter to aisearch module in main.bicep * add the AI Developer role by id and not name * update the role definition ID for AI Developer * removal of the Azure AI Developer role provisioning * added dependency for project connection. for search * add searchEnabled param to main * remove cognitive * update cosmos db api * update if search enabled * Add Azure AI Developer role name * remove cosmosdb * remove existing cosmosdb * restore cosmos db * update cosmosdb api * Add conditional checks for cosmos * update cosmosdbName * update cosmosdb name cosmosDBname * update parameter name cosmosDBname * change search service dns to private and not public url * changed it back to normal endpoint public for resolution * add private end point to project * update vnet parameters for project * added conditional check to search name * add one conditional check to search in project deployment line 251 * update private end point parameter * update vm and subnet name parameters * update network parameters * update subnet id for project pep * update the private link connection for project * revert back to foundry * update to readme for 1RP * update change log with updates * Add additional documentation * Readme updates related to FDP updates * Updates to configuration documentation * removed mention of one-click deploy * Add links to the new resources in cognitive services * update infra dwg update links * update to network acl * update to project creation * testing of AVM modle pr * remove project parameters * Update to avm pr code * update the image path * update defaultName * fix: Fixed issues when networkisolation flag is set to false * feat: Added Secrets to keyvault which would be used to run the data ingestion script & fixed the issue related to authentication * feat: Added scripts to chunck and ingest data into azure search service * fix: Removed unused param * feat: Added the Roles required to execute the script through VM * fix: Added role assignments & identity for vm * feat: Added changes for running script through VM * fix: Added missing role assignments * fix: Updated scripts to test VM * fix: Updated powershell code * fix: Added Logs * fix: Added more loga * refactor: Different approach to ingest data * replace the in place module with the avm pattern module path * fix: Updated script * fix: Seggregated installtion of python * fix: Created diff scripts * fix: Refresh environment variables * fix: Collecting python logs * fix: Removed logs on python * fix: Added logs * fix: Updated logic for python installation * fix: Use extarcted python package * fix: test dns resolution * fic: Updated host * fix: Updated host * fix: Updated host * fix: Deployment Issue with AZD version 1.17 fixed * feat: Updated the main.json * docs: Added Note related to AZD issues with 1.17.0 version * corrected readme * fix: fixed Project name to 12 characters * updates to remove AML calls to import. * fix: Updated scripts * Quota - implemented AZD quota check, removed model array for embedding and gpt only, removed scripts * Quota - documentation and main.json * Disabled no-unnecessary-dependson warnings * Search - fixed bug where roleassignments was not being used * refactor: Modified the output variables * fix: Resolved the conflict issues * fix: Sample APP deployment issue * fix: AI project location to be same as Congnitive service account * feat: Updated boolean based flags to propmpy user for inputs as AZD issue is fixed * fix: Added the changes related to auth update * fix: Added python path * fix: Updated python script to download the file to specific path * fix: Updated the message * fix: Added sample data & updated script to support non-waf deployment * fix: Fix issues related to codespace * chore: Updated the sample data set * fix: Modified code to process files from local folder while running locally * fix: Updated scripts for Codespace * fix: Updated the path * fix: File names updated * fix: File names updated --------- Co-authored-by: mswantek68 <46489667+mswantek68@users.noreply.github.com> Co-authored-by: Mike Swantek <mike.swantek@microsoft.com> Co-authored-by: Rohini-Microsoft <v-rwalunj@microsoft.com> Co-authored-by: Seth <sethsteenken@microsoft.com> ---------
1 parent 7c25b4c commit 1e6938c

38 files changed

Lines changed: 73577 additions & 60044 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.vscode
22
.vs
33
.venv
4-
__pycache__
4+
__pycache__

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Offers ability to [start with an existing Azure AI Project](docs/transfer_projec
5353
4. If deploying from your [local environment](docs/local_environment_steps.md), install the [Azure CLI (AZ)](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) and the [Azure Developer CLI (AZD)](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd?tabs=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows).
5454
5. If deploying via [GitHub Codespaces](docs/github_code_spaces_steps.md) - requires the user to be on a GitHub Team or Enterprise Cloud plan.
5555
6. If leveraging [GitHub Actions](docs/github_actions_steps.md).
56+
7. Optionally [include a sample AI chat application](/docs/sample_app_setup.md) with the deployment.
5657

5758
### Check Azure OpenAI Quota Availability
5859

@@ -90,6 +91,8 @@ QUICK DEPLOY
9091
## Connect to and validate access to the new environment
9192
Follow the post deployment steps [Post Deployment Steps](docs/github_code_spaces_steps.md) to connect to the isolated environment.
9293

94+
## Deploy Sample Application with the new environment
95+
Optionally include a [sample AI chat application](/docs/sample_app_setup.md) to showcase a production AI application deployed to a secure environment.
9396

9497
## Deploy your application in the isolated environment
9598
- Leverage the Microsoft Learn documentation to provision an app service instance within your secure network [Configure Web App](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/on-your-data-configuration#azure-ai-foundry-portal)

azure.yaml

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
1-
name: deploy-your-ai-application-in-production
2-
infra:
3-
provider: "bicep"
4-
metadata:
5-
template: deploy-your-ai-application-in-production@1.0
6-
hooks:
7-
preup:
8-
windows:
9-
shell: pwsh
10-
run: ./scripts/set_conns_env_vars.ps1
11-
interactive: true
12-
continueOnError: false
13-
posix:
14-
shell: sh
15-
run: chmod u+r+x ./scripts/set_conns_env_vars.sh; ./scripts/set_conns_env_vars.sh
16-
interactive: true
17-
continueOnError: false
1+
name: deploy-your-ai-application-in-production
2+
3+
requiredVersions:
4+
azd: ">=1.15.0 !=1.17.1"
5+
infra:
6+
provider: "bicep"
7+
metadata:
8+
template: deploy-your-ai-application-in-production@1.0
9+
hooks:
10+
preup:
11+
windows:
12+
shell: pwsh
13+
run: ./scripts/set_conns_env_vars.ps1
14+
interactive: true
15+
continueOnError: false
16+
posix:
17+
shell: sh
18+
run: sudo chmod u+r+x ./scripts/set_conns_env_vars.sh; sudo ./scripts/set_conns_env_vars.sh
19+
interactive: true
20+
continueOnError: false
21+
preprovision:
22+
posix:
23+
shell: sh
24+
run: sudo chmod u+r+x ./scripts/auth_init.sh; sudo ./scripts/auth_init.sh
25+
interactive: true
26+
continueOnError: false
27+
windows:
28+
shell: pwsh
29+
run: ./scripts/auth_init.ps1
30+
interactive: true
31+
continueOnError: false
32+
postprovision:
33+
posix:
34+
shell: sh
35+
run: sudo chmod u+r+x ./scripts/process_sample_data.sh; sudo chmod u+r+x ./scripts/postprovision.sh; sudo ./scripts/postprovision.sh
36+
interactive: true
37+
continueOnError: false
38+
windows:
39+
shell: pwsh
40+
run: ./scripts/postprovision.ps1;
41+
interactive: true
42+
continueOnError: false

data/PerksPlus.pdf

113 KB
Binary file not shown.

data/employee_handbook.pdf

140 KB
Binary file not shown.

docs/sample_app_setup.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Setup Sample Application
2+
3+
This solution includes an optional sample AI chat application that can be instantiaed along with the other resources to showcase a production-ready, end-to-end application running securly on Azure. Application image is pulled from a public registry and the [source code can be found here](https://github.com/microsoft/sample-app-aoai-chatGPT).
4+
5+
## Pre-Deployment
6+
7+
### Setup Entra App Registration
8+
9+
The sample application requires an [application registration in Microsoft Entra](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app). This is used for authentication. The deployment process will automatically create the application registration by default or an existing applicaiton registration can be used.
10+
11+
#### Create Application Registration Automatically
12+
13+
Following the steps below and executing a deployment will automatically create the Application Registration in Microsoft Entra and set the required environment variables. The application registration will then be used for that AZD environment when deploying. The executing user will need sufficient permissions on the tenant to create registrations (like the [Application Developer role](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference#application-developer)).
14+
15+
#### Use Existing Application Registration
16+
17+
In the Azure Portal, either [create a new registration](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) or navigate to an existing registration.
18+
19+
* Note the *Application (client) ID* and *Object ID* displayed on the overview page.
20+
* Navigate to "Certificates & secrets" > "New client secret".
21+
* Enter a description and expiration, then click "Add".
22+
* Copy and securely store the generated client secret value, as it will not be shown again.
23+
24+
The client ID and client secret are required for authenticating your application with Microsoft Entra.
25+
26+
Set the following environment variables after establishing an AZD environment:
27+
28+
```sh
29+
azd env set 'AZURE_AUTH_APP_ID' '<your-object-id>'
30+
azd env set 'AZURE_AUTH_CLIENT_ID' '<your-client-id>'
31+
azd env set 'AZURE_AUTH_CLIENT_SECRET' '<your-client-secret>'
32+
```
33+
34+
## Deployment
35+
36+
### Setup Environment Variables
37+
38+
In order to have the sample application infrastructure deployed, certain parameter requirements must be met. Set specific environment variables listed in the below AZD command block after setting up a new AZD environment and prior to running `azd up` to properly deploy the sample application.
39+
40+
```sh
41+
azd env set 'AZURE_APP_SAMPLE_ENABLED' 'true'
42+
azd env set 'AZURE_AI_SEARCH_ENABLED' 'true'
43+
azd env set 'AZURE_COSMOS_DB_ENABLED' 'true'
44+
```
45+
46+
### AI Models Parameter Requirements
47+
48+
Also, the `aiModelDeployments` parameter in the [main.parameters.json](/infra/main.parameters.json) must contain two AI model deployments in this specific order (Note: the default values meet these requirements):
49+
50+
1. Text Embedding model (e.g., `text-embedding-ada-002`, `text-embedding-3-small`, `text-embedding-3-large`)
51+
2. Chat Completion model (e.g., `gpt-4`, `gpt-4o`, `gpt-4o-mini`)
52+
53+
### Deploy
54+
55+
Follow the [standard deployment guide](./local_environment_steps.md).
56+
57+
## Post-Deployment
58+
59+
1. **Access AI Foundry**
60+
- Connect to your VM jump box using Azure Bastion.
61+
- Once connected, browse to the Azure Portal
62+
- Select the Azure AI Project resource and load the AI Foundry
63+
64+
2. **Create a Data Source**
65+
- In AI Foundry, select *Data + Indexes*, and click *+New Data*
66+
- For Data Source, select to Upload Files/Folders, then Upload Files
67+
- Give the Data Source a name and click Create
68+
69+
3. **Create an Index**
70+
- In AI Foundry, select *Data + Indexes*, and click *+New Index*
71+
- Select your Data Source
72+
- Choose the existing Azure Cognitive Search service
73+
- Keep the suggested Index name or supply a different name
74+
- In the Search settings, select the *text-embedding-3-model* model deployment.
75+
- Review and click Create Vector Index. Note this can take a few minutes to complete.
76+
77+
4. **Update App Service Environment Variable**
78+
- After indexing completes, note the name of your new Index.
79+
- In the Azure Portal, navigate to the Azure App Service and update the relevant Environment Variable in the Configuration with this Index name.
80+
81+
5. **Launch and Use the Application**
82+
- Navigate to the Azure App Service in the Azure Portal
83+
- Browse application and begin chatting with your data.
84+

0 commit comments

Comments
 (0)