@@ -80,6 +80,7 @@ function PromptForParameters {
8080 [string ]$location ,
8181 [string ]$modelLocation ,
8282 [string ]$email
83+
8384)
8485
8586 Clear-Host
@@ -148,7 +149,7 @@ function PromptForParameters {
148149 resourceGroupName = $resourceGroupName
149150 location = $location
150151 modelLocation = $modelLocation
151- email = $email
152+ email = $email
152153 }
153154}
154155
@@ -171,7 +172,6 @@ function LoginAzure([string]$subscriptionID) {
171172 -- password $env: AZURE_CLIENT_SECRET `
172173 -- tenant $env: AZURE_TENANT_ID `
173174 Write-Host " CI deployment mode"
174- $createdBy = ' pipeline'
175175 }
176176 else {
177177 az login -- tenant $tenantId
@@ -184,8 +184,6 @@ function LoginAzure([string]$subscriptionID) {
184184 Write-Host " Logged in to Azure with tenant ID '$tenantId ' successfully." - ForegroundColor Green
185185 }
186186 Write-Host " manual deployment mode"
187- $createdBy = $email.Split (' @' )[0 ]
188- Write-Host " CreatedBy user is $createdBy "
189187 }
190188 az account set -- subscription $subscriptionID
191189 Write-Host " Switched subscription to '$subscriptionID ' `r`n " - ForegroundColor Yellow
@@ -194,6 +192,13 @@ function LoginAzure([string]$subscriptionID) {
194192function DeployAzureResources ([string ]$location , [string ]$modelLocation ) {
195193 Write-Host " Started Deploying Knowledge Mining Solution Accelerator Service Azure resources.....`r`n " - ForegroundColor Yellow
196194
195+ if ($env: CI -eq " true" ){
196+ $createdBy = ' pipeline'
197+ }
198+ else {
199+ $createdBy = $email.Split (' @' )[0 ]
200+ }
201+
197202 try {
198203 # Generate a random number between 0 and 99999
199204 $randomNumber = Get-Random - Minimum 0 - Maximum 99999
@@ -233,16 +238,16 @@ function DeployAzureResources([string]$location, [string]$modelLocation) {
233238 Write-Host " Generated Resource Group Name: $resourceGroupName "
234239
235240 Write-Host " No RG provided. Creating new RG: $resourceGroupName " - ForegroundColor Yellow
236- az group create -- name $resourceGroupName -- location $location -- tags EnvironmentName= $environmentName TemplateName= " DKM" | Out-Null
241+ az group create -- name $resourceGroupName -- location $location -- tags EnvironmentName= $environmentName TemplateName= " DKM" createdBy = $createdBy | Out-Null
237242 }
238243 else {
239244 $exists = az group exists -- name $resourceGroupName | ConvertFrom-Json
240245 if (-not $exists ) {
241246 Write-Host " Specified RG does not exist. Creating RG: $resourceGroupName " - ForegroundColor Yellow
242- az group create -- name $resourceGroupName -- location $location -- tags EnvironmentName= $environmentName TemplateName= " DKM" | Out-Null
247+ az group create -- name $resourceGroupName -- location $location -- tags EnvironmentName= $environmentName TemplateName= " DKM" createdBy = $createdBy | Out-Null
243248 }
244249 else {
245- az group update -- name $resourceGroupName -- set tags.EnvironmentName= $environmentName tags.TemplateName= " DKM" | Out-Null
250+ az group update -- name $resourceGroupName -- set tags.EnvironmentName= $environmentName tags.TemplateName= " DKM" tags.createdBy = $createdBy | Out-Null
246251 Write-Host " Using existing RG: $resourceGroupName " - ForegroundColor Green
247252 }
248253 }
0 commit comments