-
Notifications
You must be signed in to change notification settings - Fork 91
Bicep support for 'custom' azure environment #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Development
Are you sure you want to change the base?
Changes from all commits
3189555
3c53d89
ed97273
eb9a278
b6cda00
eaa483b
837ec8f
625d733
fac697c
88970c9
278d62d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,14 +5,12 @@ targetScope = 'subscription' | |||||||||||||
| - Region must align to the target cloud environment''') | ||||||||||||||
| param location string | ||||||||||||||
|
|
||||||||||||||
| @description('''The target Azure Cloud environment. | ||||||||||||||
| - Accepted values are: AzureCloud, AzureUSGovernment | ||||||||||||||
| - Default is AzureCloud''') | ||||||||||||||
| @allowed([ | ||||||||||||||
| 'AzureCloud' | ||||||||||||||
| 'AzureUSGovernment' | ||||||||||||||
| 'public' | ||||||||||||||
| 'usgovernment' | ||||||||||||||
| 'custom' | ||||||||||||||
| ]) | ||||||||||||||
| param cloudEnvironment string | ||||||||||||||
| param cloudEnvironment string = az.environment().name == 'AzureCloud' ? 'public' : (az.environment().name == 'AzureUSGovernment' ? 'usgovernment' : 'custom') | ||||||||||||||
|
||||||||||||||
|
|
||||||||||||||
| @description('''The name of the application to be deployed. | ||||||||||||||
| - Name may only contain letters and numbers | ||||||||||||||
|
|
@@ -143,13 +141,27 @@ param deploySpeechService bool | |||||||||||||
| - Default is false''') | ||||||||||||||
| param deployVideoIndexerService bool | ||||||||||||||
|
|
||||||||||||||
| // --- Custom Azure Environment Parameters (for 'custom' azureEnvironment) --- | ||||||||||||||
| @description('Custom blob storage URL suffix, e.g. blob.core.usgovcloudapi.net') | ||||||||||||||
| param customBlobStorageSuffix string = 'blob.${az.environment().suffixes.storage}' | ||||||||||||||
| @description('Custom Graph API URL, e.g. https://graph.microsoft.us') | ||||||||||||||
| param customGraphUrl string = az.environment().graph | ||||||||||||||
| @description('Custom Identity URL, e.g. https://login.microsoftonline.us') | ||||||||||||||
| param customIdentityUrl string = az.environment().authentication.loginEndpoint | ||||||||||||||
| @description('Custom Resource Manager URL, e.g. https://management.usgovcloudapi.net') | ||||||||||||||
| param customResourceManagerUrl string = az.environment().resourceManager | ||||||||||||||
| @description('Custom Cognitive Services scope ex: https://cognitiveservices.azure.com/.default') | ||||||||||||||
|
||||||||||||||
| @description('Custom Cognitive Services scope ex: https://cognitiveservices.azure.com/.default') | |
| @description('Custom Cognitive Services scope e.g. https://cognitiveservices.azure.com/.default') |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for customCognitiveServicesScope is hardcoded to 'https://cognitiveservices.azure.com/.default', which is the public Azure cloud endpoint. This default will be incorrect for users deploying to AzureUSGovernment or other custom clouds, as they use different cognitive services endpoints (e.g., 'https://cognitiveservices.azure.us/.default' for US Government). Consider making this value conditional based on the cloud environment or documenting that users must override this parameter when deploying to non-public clouds.
| @description('Custom Cognitive Services scope ex: https://cognitiveservices.azure.com/.default') | |
| param customCognitiveServicesScope string = 'https://cognitiveservices.azure.com/.default' | |
| @description('Custom Cognitive Services scope, e.g. https://cognitiveservices.azure.com/.default (public), https://cognitiveservices.azure.us/.default (US Gov)') | |
| param customCognitiveServicesScope string = az.environment().name == 'AzureUSGovernment' ? 'https://cognitiveservices.azure.us/.default' : 'https://cognitiveservices.azure.com/.default' |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for customCognitiveServicesScope uses the public Azure endpoint ('https://cognitiveservices.azure.com/.default'), but this may be incorrect for government or other custom clouds. When az.environment() detects a non-public cloud but cloudEnvironment is set to 'custom', this will use the wrong cognitive services scope. Consider providing environment-specific defaults based on az.environment().
| param customCognitiveServicesScope string = 'https://cognitiveservices.azure.com/.default' | |
| param customCognitiveServicesScope string = az.environment().name == 'AzureUSGovernment' ? 'https://cognitiveservices.azure.us/.default' : 'https://cognitiveservices.azure.com/.default' |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for customSearchResourceUrl is hardcoded to 'https://search.azure.com', which is the public Azure cloud endpoint. This default will be incorrect for users deploying to AzureUSGovernment or other custom clouds, as they use different search endpoints (e.g., 'https://search.azure.us' for US Government). Consider making this value conditional based on the cloud environment or documenting that users must override this parameter when deploying to non-public clouds.
| param customSearchResourceUrl string = 'https://search.azure.com' | |
| param customSearchResourceUrl string = cloudEnvironment == 'usgovernment' | |
| ? 'https://search.azure.us' | |
| : (cloudEnvironment == 'public' ? 'https://search.azure.com' : '') |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value for customSearchResourceUrl uses the public Azure endpoint ('https://search.azure.com'), but this may be incorrect for government or other custom clouds. When az.environment() detects a non-public cloud but cloudEnvironment is set to 'custom', this will use the wrong search endpoint. Consider using az.environment().suffixes or providing environment-specific defaults.
| param customSearchResourceUrl string = 'https://search.azure.com' | |
| param customSearchResourceUrl string = 'https://search.${az.environment().suffixes.search}' |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,25 @@ param keyVaultUri string | |||||||||||||||||||||||||||||||||||||
| param enablePrivateNetworking bool | ||||||||||||||||||||||||||||||||||||||
| param appServiceSubnetId string = '' | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // --- Custom Azure Environment Parameters (for 'custom' azureEnvironment) --- | ||||||||||||||||||||||||||||||||||||||
| @description('Custom blob storage URL suffix, e.g. blob.core.usgovcloudapi.net') | ||||||||||||||||||||||||||||||||||||||
| param customBlobStorageSuffix string? | ||||||||||||||||||||||||||||||||||||||
| @description('Custom Graph API URL, e.g. https://graph.microsoft.us') | ||||||||||||||||||||||||||||||||||||||
| param customGraphUrl string? | ||||||||||||||||||||||||||||||||||||||
| @description('Custom Identity URL, e.g. https://login.microsoftonline.us') | ||||||||||||||||||||||||||||||||||||||
| param customIdentityUrl string? | ||||||||||||||||||||||||||||||||||||||
| @description('Custom Resource Manager URL, e.g. https://management.usgovcloudapi.net') | ||||||||||||||||||||||||||||||||||||||
| param customResourceManagerUrl string? | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @description('Custom Cognitive Services scope ex: https://cognitiveservices.azure.com/.default') | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| @description('Custom Cognitive Services scope ex: https://cognitiveservices.azure.com/.default') | |
| @description('Custom Cognitive Services scope, e.g. https://cognitiveservices.azure.com/.default') |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting style for these app settings is inconsistent with the rest of the appSettings array. Lines 98-100 use compact formatting without spaces after braces (e.g., {name:), while most other entries in the array use spaced formatting (e.g., { name:). For consistency, these should match the predominant style used in the file with spaces.
| {name: 'AZURE_ENVIRONMENT', value: azurePlatform } | |
| {name: 'SCM_DO_BUILD_DURING_DEPLOYMENT', value: 'false'} | |
| {name: 'AZURE_COSMOS_ENDPOINT', value: cosmosDb.properties.documentEndpoint} | |
| { name: 'AZURE_ENVIRONMENT', value: azurePlatform } | |
| { name: 'SCM_DO_BUILD_DURING_DEPLOYMENT', value: 'false' } | |
| { name: 'AZURE_COSMOS_ENDPOINT', value: cosmosDb.properties.documentEndpoint } |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nullable parameters are passed directly to environment variables without null checking. If these parameters are not provided (which is valid for nullable parameters), the environment variables will be set to empty or undefined values. For the 'custom' environment, consider either making these parameters required when azurePlatform is 'custom', or adding validation to ensure they are provided when needed.
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable KEY_VAULT_DOMAIN is being set conditionally only for the 'custom' environment, but it's also used in the 'usgovernment' and default environments in config.py (lines 174, 183, 192). Consider setting this environment variable for all platforms to maintain consistency, or ensure the application code can handle its absence.
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace at the end of this line after the closing bracket. While this doesn't affect functionality, it violates best practices for clean code formatting.
| {name: 'CUSTOM_OIDC_METADATA_URL_VALUE', value: openIdMetadataUrl}] | |
| {name: 'CUSTOM_OIDC_METADATA_URL_VALUE', value: openIdMetadataUrl}] |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting style for these environment variable entries is inconsistent. They use compact formatting without spaces after braces (e.g., {name:), while most other entries in the appSettings array use spaced formatting (e.g., { name:). For consistency, these should match the predominant style used in the file with spaces.
| {name: 'CUSTOM_GRAPH_URL_VALUE', value: customGraphUrl} | |
| {name: 'CUSTOM_IDENTITY_URL_VALUE', value: customIdentityUrl} | |
| {name: 'CUSTOM_RESOURCE_MANAGER_URL_VALUE', value: customResourceManagerUrl} | |
| {name: 'CUSTOM_BLOB_STORAGE_URL_VALUE', value: customBlobStorageSuffix} | |
| {name: 'CUSTOM_COGNITIVE_SERVICES_URL_VALUE', value: customCognitiveServicesScope} | |
| {name: 'CUSTOM_SEARCH_RESOURCE_MANAGER_URL_VALUE', value: customSearchResourceUrl} | |
| {name: 'KEY_VAULT_DOMAIN', value: az.environment().suffixes.keyvaultDns} | |
| {name: 'CUSTOM_OIDC_METADATA_URL_VALUE', value: openIdMetadataUrl}] | |
| { name: 'CUSTOM_GRAPH_URL_VALUE', value: customGraphUrl } | |
| { name: 'CUSTOM_IDENTITY_URL_VALUE', value: customIdentityUrl } | |
| { name: 'CUSTOM_RESOURCE_MANAGER_URL_VALUE', value: customResourceManagerUrl } | |
| { name: 'CUSTOM_BLOB_STORAGE_URL_VALUE', value: customBlobStorageSuffix } | |
| { name: 'CUSTOM_COGNITIVE_SERVICES_URL_VALUE', value: customCognitiveServicesScope } | |
| { name: 'CUSTOM_SEARCH_RESOURCE_MANAGER_URL_VALUE', value: customSearchResourceUrl } | |
| { name: 'KEY_VAULT_DOMAIN', value: az.environment().suffixes.keyvaultDns } | |
| { name: 'CUSTOM_OIDC_METADATA_URL_VALUE', value: openIdMetadataUrl }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace at the end of this line after 'custom'. While this doesn't affect functionality, it violates best practices for clean code formatting.