InstrumentationKey parameter using a default IngestionEndpoint
This commit is contained in:
Родитель
322877d296
Коммит
c728d89742
|
@ -1,5 +1,6 @@
|
|||
param (
|
||||
[Parameter(Mandatory=$true)][string]$ConnectionString
|
||||
[string]$ConnectionString,
|
||||
[string]$InstrumentationKey
|
||||
)
|
||||
|
||||
function ParseConnectionString {
|
||||
|
@ -17,6 +18,16 @@ function ParseConnectionString {
|
|||
return $Map
|
||||
}
|
||||
|
||||
# Exit with error if either both or neither of these parameters are provided
|
||||
if (("" -eq $ConnectionString) -eq ("" -eq $InstrumentationKey)) {
|
||||
Write-Error "Please provide one of the parameters: 'ConnectionString' or 'InstrumentationKey'" -ErrorAction Stop
|
||||
}
|
||||
|
||||
# Build the connection string using the instrumentation key
|
||||
If ($InstrumentationKey) {
|
||||
$ConnectionString = "InstrumentationKey=$InstrumentationKey;IngestionEndpoint=https://dc.services.visualstudio.com/"
|
||||
}
|
||||
|
||||
$Map = ParseConnectionString($ConnectionString)
|
||||
$Url = $Map["IngestionEndpoint"] + "v2/track"
|
||||
$IKey = $Map["InstrumentationKey"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче