Skip to content

Commit 99b3d70

Browse files
Merge pull request #14 from microsoft/azdupdates
env name var
2 parents e8749bb + 060c9cb commit 99b3d70

3 files changed

Lines changed: 17 additions & 247 deletions

File tree

infra/main.bicep

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ param Authorization bool = false
3333
param AiLocation string // The location used for all deployed resources. This location must be in the same region as the resource group.
3434
param capacity int = 5
3535

36+
@minLength(3)
37+
@maxLength(10)
38+
@description('A unique prefix for all resources in this deployment. This should be 3-10 characters long:')
39+
param environmentName string
40+
3641
@description('The location used for all deployed resources')
3742
// Generate a unique string based on the base name and a unique identifier
38-
var uniqueSuffix = uniqueString(resourceGroup().id, ResourcePrefix)
43+
//var uniqueSuffix = uniqueString(resourceGroup().id, ResourcePrefix)
3944

4045
// Take the first 4 characters of the unique string to use as a suffix
41-
var randomSuffix = substring(uniqueSuffix, 0, 4)
46+
var randomSuffix = substring(environmentName, 3, 10)
4247

4348
// Combine the base name with the random suffix
4449
var finalName = '${ResourcePrefix}-${randomSuffix}'

infra/main.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.33.93.31351",
8-
"templateHash": "10448854434840069172"
8+
"templateHash": "234966597453008945"
99
}
1010
},
1111
"parameters": {
@@ -56,11 +56,18 @@
5656
"capacity": {
5757
"type": "int",
5858
"defaultValue": 5
59+
},
60+
"environmentName": {
61+
"type": "string",
62+
"minLength": 3,
63+
"maxLength": 10,
64+
"metadata": {
65+
"description": "A unique prefix for all resources in this deployment. This should be 3-10 characters long:"
66+
}
5967
}
6068
},
6169
"variables": {
62-
"uniqueSuffix": "[uniqueString(resourceGroup().id, parameters('ResourcePrefix'))]",
63-
"randomSuffix": "[substring(variables('uniqueSuffix'), 0, 4)]",
70+
"randomSuffix": "[substring(parameters('environmentName'), 3, 10)]",
6471
"finalName": "[format('{0}-{1}', parameters('ResourcePrefix'), variables('randomSuffix'))]",
6572
"backEndVersion": "[if(parameters('Authorization'), 'rcauth', 'rcnoauth')]",
6673
"frontEndVersion": "[if(parameters('Authorization'), 'rcauth', 'rcnoauth')]",

infra/resources.bicep

Lines changed: 0 additions & 242 deletions
This file was deleted.

0 commit comments

Comments
 (0)