forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-telemetryConfiguration.ps1
48 lines (35 loc) · 2.18 KB
/
start-telemetryConfiguration.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
.SYNOPSIS
This function prepares telemetry configuration data submission to Azure App Insights
.DESCRIPTION
This function prepares telemetry configuration data submission to Azure App Insights.
.PARAMETER allowTelemetryCollection
Boolean to allow for basic telemetry collection.
.OUTPUTS
None
.EXAMPLE
start-telemetryConfiguration -allowTelemetryConfiguration $TRUE
#>
Function start-telemetryConfiguration
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
[boolean]$allowTelemetryCollection,
[Parameter(Mandatory = $TRUE)]
[string]$appInsightAPIKey,
[Parameter(Mandatory = $TRUE)]
[string]$traceModuleName
)
$functionInstrumentationKey = $traceModuleName+".ApplicationInsights.InstrumentationKey"
$functionOptIn = $traceModuleName+".OptIn"
$functionIgnoreGDPR = $traceModuleName+".IgnoreGDPR"
$functionRemovePII = $traceModuleName+".RemovePII"
$functionModuleName = "TelemetryHelper"
Set-PSFConfig -Module $functionModuleName -Name $functionInstrumentationKey -Value $appInsightAPIKey -Initialize -Validation string -Description 'Your ApplicationInsights instrumentation key' -Hidden
#Set-PSFConfig -Module 'TelemetryHelper' -Name 'TelemetryHelper.OptInVariable' -Value 'TelemetryHelperTelemetryOptIn' -Initialize -Validation string -Description 'The name of the environment variable used to indicate that telemetry should be sent'
Set-PSFConfig -Module $functionModuleName -Name $functionOptIn -Value $allowTelemetryCollection -Initialize -Validation bool -Description 'Whether user opts into telemetry or not'
Set-PSFConfig -Module $functionModuleName -Name $functionIgnoreGDPR -Value $false -Initialize -Validation bool -Description 'Whether telemetry client should ignore user settings, e.g. if you are not bound by GDPR or other regulations'
Set-PSFConfig -Module $functionModuleName -Name $functionRemovePII -VAlue $true -Initialize -Validation bool -Description "Whether information like the computer name should be stripped from the data that is sent"
}