Skip to content

Commit 4b177c2

Browse files
authored
Merge pull request #34 from microsoft/azd/add-template-gallery
Azd/add template gallery
2 parents 718c64e + 7397d42 commit 4b177c2

7 files changed

Lines changed: 180 additions & 13 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: AZD Template Validation
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
pull-requests: write
12+
13+
jobs:
14+
template_validation:
15+
runs-on: ubuntu-latest
16+
name: azd template validation
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: microsoft/template-validation-action@Latest
21+
with:
22+
validateAzd: ${{ vars.TEMPLATE_VALIDATE_AZD }}
23+
useDevContainer: ${{ vars.TEMPLATE_USE_DEV_CONTAINER }}
24+
id: validation
25+
env:
26+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
27+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
28+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
29+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
30+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: print result
34+
run: cat ${{ steps.validation.outputs.resultFile }}

.github/workflows/azure-dev.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: AZD Deployment
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
env:
16+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
17+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
18+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
19+
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
20+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
21+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
22+
AZURE_USER_OBJECT_ID: ''
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Install azd
27+
uses: Azure/setup-azd@v2
28+
- name: Log in with Azure (Federated Credentials)
29+
run: |
30+
azd auth login `
31+
--client-id "$Env:AZURE_CLIENT_ID" `
32+
--federated-credential-provider "github" `
33+
--tenant-id "$Env:AZURE_TENANT_ID"
34+
shell: pwsh
35+
36+
- name: Provision Infrastructure
37+
run: azd provision --no-prompt
38+
env:
39+
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}

CONTRIBUTING.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributing to Deploy your AI Application in Production
2+
3+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
4+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
6+
7+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
8+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
9+
provided by the bot. You will only need to do this once across all repos using our CLA.
10+
11+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
14+
15+
- [Code of Conduct](#coc)
16+
- [Issues and Bugs](#issue)
17+
- [Feature Requests](#feature)
18+
- [Submission Guidelines](#submit)
19+
20+
## <a name="coc"></a> Code of Conduct
21+
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
22+
23+
## <a name="issue"></a> Found an Issue?
24+
If you find a bug in the source code or a mistake in the documentation, you can help us by
25+
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
26+
[submit a Pull Request](#submit-pr) with a fix.
27+
28+
## <a name="feature"></a> Want a Feature?
29+
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
30+
Repository. If you would like to *implement* a new feature, please submit an issue with
31+
a proposal for your work first, to be sure that we can use it.
32+
33+
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
34+
35+
## <a name="submit"></a> Submission Guidelines
36+
37+
### <a name="submit-issue"></a> Submitting an Issue
38+
Before you submit an issue, search the archive, maybe your question was already answered.
39+
40+
If your issue appears to be a bug, and hasn't been reported, open a new issue.
41+
Help us to maximize the effort we can spend fixing issues and adding new
42+
features, by not reporting duplicate issues. Providing the following information will increase the
43+
chances of your issue being dealt with quickly:
44+
45+
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
46+
* **Version** - what version is affected (e.g. 0.1.2)
47+
* **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
48+
* **Browsers and Operating System** - is this a problem with all browsers?
49+
* **Reproduce the Error** - provide a live example or a unambiguous set of steps
50+
* **Related Issues** - has a similar issue been reported before?
51+
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
52+
causing the problem (line of code or commit)
53+
54+
You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/microsoft/Deploy-Your-AI-Application-In-Production/issues/new.
55+
56+
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
57+
Before you submit your Pull Request (PR) consider the following guidelines:
58+
59+
* Search the repository (https://github.com/microsoft/Deploy-Your-AI-Application-In-Production/pulls) for an open or closed PR
60+
that relates to your submission. You don't want to duplicate effort.
61+
62+
* Make your changes in a new git fork:
63+
64+
* Commit your changes using a descriptive commit message
65+
* Push your fork to GitHub:
66+
* In GitHub, create a pull request
67+
* If we suggest changes then:
68+
* Make the required updates.
69+
* Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
70+
71+
```shell
72+
git rebase master -i
73+
git push -f
74+
```
75+
76+
That's it! Thank you for your contribution!

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ The diagram below illustrates the capabilities included in the template.
2828
| 4 | The online endpoint is secured with Microsoft Entra ID authentication. Client applications must obtain a security token from the Microsoft Entra ID tenant before invoking the prompt flow hosted by the managed deployment and available through the online endpoint|
2929
| 5 | API Management creates consistent, modern API gateways for existing backend services. In this architecture, API Management is used in a fully private mode to offload cross-cutting concerns from the API code and hosts.|
3030

31+
## Features
3132

32-
33-
34-
## Key Features
3533
### What solutions does this enable?
3634
- Deploys AI hub and AI project into a virtual network with all dependent services connected via private end points.
3735

@@ -64,6 +62,7 @@ For additional documentation of the default enabled services of this solution ac
6462
11. [Azure Log Analytics](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview)
6563
12. [Azure Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview)
6664

65+
## Getting Started
6766

6867
<h2><img src="./img/Documentation/quickDeploy.png" width="64">
6968
<br/>
@@ -75,7 +74,6 @@ QUICK DEPLOY
7574
[Steps to deploy with GitHub Codespaces](DeployViaCodeSpaces.md)
7675

7776

78-
7977
## Connect to and validate access to the new environment
8078
Follow the post deployment steps [Post Deployment Steps](post_deployment_steps.md) to connect to the isolated environment.
8179

@@ -85,11 +83,25 @@ Follow the post deployment steps [Post Deployment Steps](post_deployment_steps.m
8583
- Follow these instructions to [Add your data and chat with it in the AI Foundry playground](https://learn.microsoft.com/en-us/azure/ai-foundry/tutorials/deploy-chat-web-app#add-your-data-and-try-the-chat-model-again)
8684

8785

86+
## Guidance
87+
88+
### Region Availability
89+
90+
By default, this template uses AI models which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly.
91+
92+
### Costs
93+
94+
You can estimate the cost of this project's architecture with [Azure's pricing calculator](https://azure.microsoft.com/pricing/calculator/)
95+
96+
### Security
97+
98+
This template has [Managed Identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) built in to eliminate the need for developers to manage these credentials. Applications can use managed identities to obtain Microsoft Entra tokens without having to manage any credentials.
99+
88100
<h2>
89101
Supporting documents
90102
</h2>
91103

92-
### Additional resources
104+
## Resources
93105

94106
- [Azure AI Foundry documentation](https://learn.microsoft.com/en-us/azure/ai-studio/)
95107
- [Azure Well Architecture Framework documentation](https://learn.microsoft.com/en-us/azure/well-architected/)

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ param vmSize string = 'Standard_DS4_v2'
2525
@description('Specifies the name of the administrator account for the jump-box virtual machine. Defaults to "[name]vmuser". This is necessary to provide secure access to the private VNET via a jump-box VM with Bastion.')
2626
param vmAdminUsername string = '${name}vmuser'
2727

28-
@minLength(8)
28+
@minLength(4)
2929
@maxLength(70)
3030
@description('Specifies the password for the jump-box virtual machine. This is necessary to provide secure access to the private VNET via a jump-box VM with Bastion. Value should be meet 3 of the following: uppercase character, lowercase character, numberic digit, special character, and NO control characters.')
3131
@secure()

infra/main.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.33.93.31351",
9-
"templateHash": "3696806033148817293"
9+
"templateHash": "10384721894949341887"
1010
}
1111
},
1212
"definitions": {
@@ -1684,7 +1684,7 @@
16841684
},
16851685
"vmAdminPasswordOrKey": {
16861686
"type": "securestring",
1687-
"minLength": 8,
1687+
"minLength": 4,
16881688
"maxLength": 70,
16891689
"metadata": {
16901690
"description": "Specifies the password for the jump-box virtual machine. This is necessary to provide secure access to the private VNET via a jump-box VM with Bastion. Value should be meet 3 of the following: uppercase character, lowercase character, numberic digit, special character, and NO control characters."
@@ -22816,7 +22816,7 @@
2281622816
"_generator": {
2281722817
"name": "bicep",
2281822818
"version": "0.33.93.31351",
22819-
"templateHash": "11468708502826403477"
22819+
"templateHash": "10286244752482293080"
2282022820
}
2282122821
},
2282222822
"parameters": {
@@ -22987,13 +22987,15 @@
2298722987
}
2298822988
},
2298922989
"variables": {
22990+
"randomString": "[uniqueString(resourceGroup().id, parameters('vmName'), parameters('vmAdminPasswordOrKey'))]",
22991+
"adminPassword": "[if(less(length(parameters('vmAdminPasswordOrKey')), 8), format('{0}{1}', parameters('vmAdminPasswordOrKey'), take(variables('randomString'), 12)), parameters('vmAdminPasswordOrKey'))]",
2299022992
"linuxConfiguration": {
2299122993
"disablePasswordAuthentication": true,
2299222994
"ssh": {
2299322995
"publicKeys": [
2299422996
{
2299522997
"path": "[format('/home/{0}/.ssh/authorized_keys', parameters('vmAdminUsername'))]",
22996-
"keyData": "[parameters('vmAdminPasswordOrKey')]"
22998+
"keyData": "[variables('adminPassword')]"
2299722999
}
2299823000
]
2299923001
},
@@ -23035,7 +23037,7 @@
2303523037
"osProfile": {
2303623038
"computerName": "[take(parameters('vmName'), 15)]",
2303723039
"adminUsername": "[parameters('vmAdminUsername')]",
23038-
"adminPassword": "[parameters('vmAdminPasswordOrKey')]",
23040+
"adminPassword": "[variables('adminPassword')]",
2303923041
"linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), null(), variables('linuxConfiguration'))]"
2304023042
},
2304123043
"storageProfile": {

infra/modules/virtualMachine.bicep

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,18 @@ param workspaceId string
8181
@description('Specifies the resource tags.')
8282
param tags object
8383

84+
var randomString = uniqueString(resourceGroup().id, vmName, vmAdminPasswordOrKey)
85+
86+
var adminPassword = (length(vmAdminPasswordOrKey) < 8) ? '${vmAdminPasswordOrKey}${take(randomString, 12)}' : vmAdminPasswordOrKey
87+
8488
// Variables
8589
var linuxConfiguration = {
8690
disablePasswordAuthentication: true
8791
ssh: {
8892
publicKeys: [
8993
{
9094
path: '/home/${vmAdminUsername}/.ssh/authorized_keys'
91-
keyData: vmAdminPasswordOrKey
95+
keyData: adminPassword
9296
}
9397
]
9498
}
@@ -132,7 +136,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-11-01' = {
132136
osProfile: {
133137
computerName: take(vmName, 15)
134138
adminUsername: vmAdminUsername
135-
adminPassword: vmAdminPasswordOrKey
139+
adminPassword: adminPassword
136140
linuxConfiguration: (authenticationType == 'password') ? null : linuxConfiguration
137141
}
138142
storageProfile: {

0 commit comments

Comments
 (0)