Skip to content

Commit 8110572

Browse files
committed
Populate cloud_RoleName on spot worker and disable console output
1 parent 7892e44 commit 8110572

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

deploy/bicep/spot-worker.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2021-11-01' = {
239239
autoUpgradeMinorVersion: true
240240
settings: {
241241
fileUris: customScriptExtensionFiles
242-
commandToExecute: 'powershell -ExecutionPolicy Unrestricted -File "${deploymentLabel}/Install-WorkerStandalone.ps1" -DeploymentLabel "${deploymentLabel}" -HostPattern "AzureFunctionsHost.zip" -AppPattern "Worker.zip" -EnvPattern "WorkerStandalone.env" -LocalHealthPort 80 -ApplicationInsightsConnectionString "${appInsights.properties.ConnectionString}" -UserManagedIdentityClientId "${userManagedIdentity.properties.clientId}" -ExpandOSPartition'
242+
commandToExecute: 'powershell -ExecutionPolicy Unrestricted -File "${deploymentLabel}/Install-WorkerStandalone.ps1" -DeploymentLabel "${deploymentLabel}" -HostPattern "AzureFunctionsHost.zip" -AppPattern "Worker.zip" -EnvPattern "WorkerStandalone.env" -LocalHealthPort 80 -ApplicationInsightsConnectionString "${appInsights.properties.ConnectionString}" -UserManagedIdentityClientId "${userManagedIdentity.properties.clientId}" -RoleName "${vmssName}" -ExpandOSPartition'
243243
}
244244
protectedSettings: {
245245
managedIdentity: {

deploy/scripts/Install-WorkerStandalone.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ param (
2121
[Parameter(Mandatory = $true)]
2222
[string]$UserManagedIdentityClientId,
2323

24+
[Parameter(Mandatory = $true)]
25+
[string]$RoleName,
26+
2427
[Parameter(Mandatory = $false)]
2528
[switch]$ExpandOSPartition
2629
)
@@ -105,6 +108,7 @@ $hostEnv = [ordered]@{
105108
"AzureWebJobsScriptRoot" = $appRoot;
106109
"NuGetInsights__DeploymentLabel" = $DeploymentLabel;
107110
"WEBSITE_HOSTNAME" = "localhost:$LocalHealthPort";
111+
"WEBSITE_SITE_NAME" = $RoleName;
108112
}
109113

110114
if ($ApplicationInsightsConnectionString) {

deploy/scripts/NuGet.Insights.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,9 @@ function New-WorkerStandaloneEnv($ResourceSettings) {
455455
$config = $ResourceSettings.WorkerConfig | ConvertTo-FlatConfig
456456

457457
# These set up the Azure Functions job host or match with the normal Azure Functions worker settings.
458+
$config["ASPNETCORE_SUPPRESSSTATUSMESSAGES"] = "true";
458459
$config["AzureFunctionsJobHost__logging__Console__IsEnabled"] = "false";
459460
$config["AzureFunctionsJobHost__logging__LogLevel__Default"] = $ResourceSettings.WorkerLogLevel;
460-
$config["logging__LogLevel__Default"] = $ResourceSettings.WorkerLogLevel;
461-
$config["logging__ApplicationInsights__LogLevel__Default"] = $ResourceSettings.WorkerLogLevel;
462461
$config["AzureFunctionsWebHost__hostId"] = $ResourceSettings.WorkerHostId;
463462
$config["AzureWebJobs.MetricsFunction.Disabled"] = "true";
464463
$config["AzureWebJobs.TimerFunction.Disabled"] = "true";
@@ -468,6 +467,8 @@ function New-WorkerStandaloneEnv($ResourceSettings) {
468467
$config["DOTNET_gcServer"] = "1";
469468
$config["FUNCTIONS_WORKER_RUNTIME_VERSION"] = "7.0";
470469
$config["FUNCTIONS_WORKER_RUNTIME"] = "dotnet-isolated";
470+
$config["logging__ApplicationInsights__LogLevel__Default"] = $ResourceSettings.WorkerLogLevel;
471+
$config["logging__LogLevel__Default"] = $ResourceSettings.WorkerLogLevel;
471472
$config["NUGET_INSIGHTS_ALLOW_ICU"] = "true";
472473
$config["NuGetInsights__LeaseContainerName"] = $ResourceSettings.LeaseContainerName;
473474
$config["NuGetInsights__StorageAccountName"] = $ResourceSettings.StorageAccountName;
@@ -484,6 +485,7 @@ function New-WorkerStandaloneEnv($ResourceSettings) {
484485
$config["NuGetInsights__UserManagedIdentityClientId"] = "PLACEHOLDER";
485486
$config["QueueTriggerConnection__clientId"] = "PLACEHOLDER";
486487
$config["WEBSITE_HOSTNAME"] = "PLACEHOLDER";
488+
$config["WEBSITE_SITE_NAME"] = "PLACEHOLDER";
487489

488490
return $config
489491
}

0 commit comments

Comments
 (0)