- Azure Developer CLI
- Git
- Powershell 7+ (pwsh) - For Windows users only.
- Important: Ensure you can run
pwsh.exe
from a PowerShell command. If this fails, you likely need to upgrade PowerShell.
- Important: Ensure you can run
NOTE: Your Azure Account must have
Microsoft.Authorization/roleAssignments/write
permissions, such as User Access Administrator or Owner.
You can run this repo virtually by using GitHub Codespaces or VS Code Remote Containers. Click on one of the buttons below to open this repo in one of those options.
- Create a new folder your_folder_name
- git clone https://github.com/Keayoub/AzureDevBoxDevEnvironments.git your_folder_name
- switch to your your_folder_name in the terminal
- Run
azd auth login
Execute the following command, if you don't have any pre-existing Azure services and want to start from a fresh deployment.
- Set variables values for your first run :
azd env set AZURE_ENV_NAME="YOUR ENVIRONNEMENT NAME"
azd env set AZURE_IMAGE_BUILDER_IDENTITY="IMAGE BUILDER IDENTITY NAME"
azd env set AZURE_LOCATION="LOCATION"
azd env set AZURE_RESOURCE_GROUP="YOUR RESOURCE GROUP NAME"
azd env set AZURE_SUBSCRIPTION_ID="************************************"
azd env set keyVaultPatSecretValue="***********************************"
- Change the property deployVnet to true if you want to create a new VNET
"deployVnet": {
"value": true
},
- If you want to deploy custom Image Template with your DevCenter Change the property deployCustomImage to true otherwise keep it as false
"deployCustomImage": {
"value": true
},
- Run
azd up
- This will provision Azure resources and deploy this sample to those resources.
- Run
azd env set AZURE_SUBSCRIPTION_ID {Name of existing OpenAI service}
- Run
azd env set AZURE_RESOURCE_GROUP {Name of existing resource group that provisioned to}
- Run
azd env set AZURE_DEVBOX_NAME {Name of existing DevBox deployment}
- Run
azd env set AZURE_DEVBOX_VNET_NAME {Name of existing VNET deployment}
. You need also to change in your main.parameters.json value of deployVnet to false - Run
azd env set keyVaultPatSecretValue {Value of your github PAT_TOKEN Providing a PAT, which will create the keyvault to store it}
- Run
azd up
NOTE: You can also use existing Search and Storage Accounts. See
./infra/main.parameters.json
for list of environment variables to pass toazd env set
to configure those existing resources.
If you've only changed the backend/frontend code in the app
folder, then you don't need to re-provision the Azure resources. You can just run:
azd deploy
If you've changed the infrastructure files (infra
folder or azure.yaml
), then you'll need to re-provision the Azure resources. You can do that by running:
azd up
if you want to use Az or powershell deployment your can use the follow commands (using Az PowerShell)
Providing a PAT, which will create the keyvault to store it
$ghPATToken = ConvertTo-SecureString -String "PAT_TOKEN" -AsPlainText -Force
New-AzDeployment -Name DevBox -Location EastUS2 -TemplateFile .\src\main.bicep -TemplateParameterFile .\src\main.parameters.jsonc -keyVaultPatSecretValue $ghPATToken -Verbose
-
Open the Bicep parameters file, located under \src\main.parameters.jsonc
-
Configure the following parameters
Variable Type Required Description environmentName Text Yes Name of the environment which is used to generate a short unique hash used in all resources Location Text Yes Primary location for all resources, determine availbility in desired region resourceGroupName Text Yes The resource group name where the resources will be deployed deployVnet Boolean Yes True for initial deployment of the virtual network. If it's already created, this should be false devboxRbac GUID/Text Yes Provide the principalId and roleType (User or Group) -
Open the YAML pipeline located under .pipelines\devbox-deply.yml and modify the parameters.
-
As indicated, ensure the Service connection has 'Microsoft.Authorization/roleAssignments/write' permissions.