-
- 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/dstamand-msft/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.
Start by initializing azd
azd init
- Set variables values for your first run :
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 GITHUB_ORG_NAME "YOUR_GITHUB_ORG_NAME"
# ObjectId of the User or Group that will be DevCenter Project Admin in the project
azd env set AZURE_DEVBOX_PROJECT_ADMIN_PRINCIPALID ""
# User or Group
azd env set AZURE_DEVBOX_PROJECT_ADMIN_ROLETYPE ""
azd env set keyVaultPatSecretValue "***********************************"
# only if you want to deploy a custom image
azd env set AZURE_IMAGE_BUILDER_IDENTITY "IMAGE BUILDER IDENTITY NAME"
azd env set AZURE_IMAGE_TEMPLATE_NAME "devbox-ibt-1"
# Allowed characters are English alphanumeric characters, with underscores and periods allowed in the middle, up to 80 characters total.
# All other special characters, including dashes, are disallowed.
azd env set AZURE_GALLERY_NAME "galdevboxdemo"
azd env set AZURE_GALLERY_IMAGE_DEF "myDevBoxCustomImage"
Azure Developer CLI uses an environment name to set the AZURE_ENV_NAME
environment variable that's used by Azure Developer CLI templates. AZURE_ENV_NAME
is also used to prefix the Azure resource group name. Because each environment has its own set of configurations, Azure Developer CLI stores all configuration files in environment directories.
This environment variable is set when you run azd init
or azd env new
.
- 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 subscription}
- 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: See
./infra/main.parameters.json
for list of environment variables to pass toazd env set
to configure those existing resources.
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 (objectId) and roleType (User or Group) for the principal that will be granted admin on the project -
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.