-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e645e2d
commit 609dd5b
Showing
3 changed files
with
43 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<# | ||
.SYNOPSIS | ||
<Overview of script> | ||
.DESCRIPTION | ||
<Brief description of script> | ||
.NOTES | ||
Version: 1.0 | ||
Author: <Name> | ||
Creation Date: <Date> | ||
Purpose/Change: Initial script development | ||
#> | ||
|
||
# Set Error Action to Stop | ||
$ErrorActionPreference = "Stop" | ||
|
||
# Grab the script path | ||
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition | ||
echo "the current script path is $scriptPath" | ||
|
||
# these are some of the env variables that are available to you | ||
echo "PlayFab Title ID is $env:PF_TITLE_ID" # e.g. 59F84 | ||
echo "PlayFab Build ID is $env:PF_BUILD_ID" # Guid, e.g. 09d91059-22d3-4d0a-8c99-f34f80525aae | ||
echo "PlayFab Virtual Machine ID is $env:PF_VM_ID" # e.g. vmss:SouthCentralUs:2458795A9259968E_12fe54be-fae1-41aa-83d9-09b809d5ef01:09d91059-22d3-4d0a-8c99-f34f80525aae | ||
echo "Region where the VM is deployed is $env:PF_REGION" # e.g. SouthCentralUs | ||
|
||
$telegrafConfPath = "$scriptPath\telegraf.conf" | ||
((Get-Content -path $telegrafConfPath -Raw) -replace '_%PF_TITLE_ID%_', "$env:PF_TITLE_ID") | Set-Content -Path $telegrafConfPath | ||
((Get-Content -path $telegrafConfPath -Raw) -replace '_%PF_BUILD_ID%_', "$env:PF_BUILD_ID") | Set-Content -Path $telegrafConfPath | ||
((Get-Content -path $telegrafConfPath -Raw) -replace '_%PF_VM_ID%_', "$env:PF_VM_ID") | Set-Content -Path $telegrafConfPath | ||
|
||
$telegrafPath = 'C:\Program Files\telegraf' | ||
New-Item -ItemType Directory -Force -Path "$telegrafPath" | ||
cp "$scriptPath\telegraf.*" "$telegrafPath" | ||
cd "$telegrafPath" | ||
.\telegraf.exe --service install --config "$telegrafPath\telegraf.conf" | ||
|
||
$registryPath = "HKLM:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\telegraf" | ||
$values = @("AZURE_TENANT_ID=", "AZURE_CLIENT_ID=", "AZURE_CLIENT_SECRET=") | ||
New-ItemProperty -Path $registryPath -Name "Environment" -Value $values -PropertyType MultiString -Force | ||
|
||
# start the telegraf service | ||
.\telegraf.exe --service start |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters