fiftyone.geolocation 4.3.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/ci/common-ci/.github/labels.yml +24 -1
  2. package/ci/common-ci/.github/workflows/sync-labels.yml +2 -0
  3. package/ci/common-ci/CiTips.md +30 -1
  4. package/ci/common-ci/README.md +73 -12
  5. package/ci/common-ci/build-and-test.yml +6 -1
  6. package/ci/common-ci/cloud-release-config.json +51 -0
  7. package/ci/common-ci/dotnet/shared-extract-and-publish-packages.yml +1 -5
  8. package/ci/common-ci/go/shared-go-list-stage.yml +64 -0
  9. package/ci/common-ci/java/readme.md +15 -1
  10. package/ci/common-ci/php/readme.md +15 -0
  11. package/ci/common-ci/release-config-schema.json +52 -0
  12. package/ci/common-ci/release-config-template.json +50 -1
  13. package/ci/common-ci/release-config.json +47 -189
  14. package/ci/common-ci/scripts/azure/checkSlot.ps1 +28 -0
  15. package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.psm1 +12 -5
  16. package/ci/common-ci/scripts/modules/51DDeployModule/51DDeployModule.psm1 +66 -0
  17. package/ci/common-ci/scripts/modules/51DDownloadDataFileModule/51DDownloadDataFileModule.psm1 +58 -0
  18. package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.psm1 +8 -8
  19. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.Tests.ps1 +347 -9
  20. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.psm1 +285 -54
  21. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.Tests.ps1 +9 -8
  22. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.psm1 +30 -13
  23. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.Tests.ps1 +342 -97
  24. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.psm1 +36 -2
  25. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/SharedVariables.psm1 +2 -2
  26. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-deploy-test-env-config.json +290 -0
  27. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-test-env-config.json +260 -0
  28. package/ci/common-ci/scripts/modules/AzurePortalModules/51DApplicationInsightsModule/51DApplicationInsightsModule.psm1 +104 -0
  29. package/ci/common-ci/scripts/modules/AzurePortalModules/51DChecksModule/51DChecksModule.psm1 +68 -0
  30. package/ci/common-ci/scripts/modules/AzurePortalModules/51DCloudModule/51DCloudModule.psm1 +155 -0
  31. package/ci/common-ci/scripts/modules/AzurePortalModules/51DConnectAzureModule/51DConnectAzureModule.psm1 +45 -0
  32. package/ci/common-ci/scripts/modules/AzurePortalModules/51DSSLBindingsModule/51DSSLBIndingsModule.psm1 +100 -0
  33. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStagingSlotModule/51DStagingSlotModule.psm1 +50 -0
  34. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStorageAccountModule/51DStorageAccountModule.psm1 +248 -0
  35. package/ci/common-ci/scripts/modules/AzurePortalModules/51DTrafficManagerModule/51DTrafficManagerModule.psm1 +58 -0
  36. package/ci/common-ci/shared-auto-complete-pr-stage.yml +16 -3
  37. package/ci/common-ci/shared-create-tag-job.yml +9 -0
  38. package/ci/common-ci/shared-docker-build-steps.yml +34 -0
  39. package/ci/common-ci/shared-docker-push-steps.yml +32 -0
  40. package/ci/common-ci/shared-docker-test-http-steps.yml +69 -0
  41. package/ci/common-ci/shared-git-version-job.yml +17 -2
  42. package/ci/common-ci/shared-publish-github-stage.yml +54 -51
  43. package/ci/common-ci/shared-submodule-trigger-stage.yml +56 -4
  44. package/ci/shared-build-and-test-stage.yml +5 -2
  45. package/examples/examples.test.js +3 -3
  46. package/geoLocationPipelineBuilder.js +9 -16
  47. package/package.json +11 -7
  48. package/setup.js +1 -0
@@ -0,0 +1,290 @@
1
+ {
2
+ "name": "APIs Test Environment Configuration",
3
+ "repositories": {
4
+ "javascript": {},
5
+ "device-detection-data": {},
6
+ "common-ci": {
7
+ "tags": [
8
+ "4.3.10"
9
+ ],
10
+ "definitions": [
11
+ {
12
+ "name": "common-ci-test",
13
+ "defaultBranch": "main",
14
+ "yamlFileName": "build-and-test.yml"
15
+ },
16
+ {
17
+ "name": "common-ci-tag-repository",
18
+ "defaultBranch": "main",
19
+ "yamlFileName": "create-tag.yml"
20
+ },
21
+ {
22
+ "name": "common-ci-trigger-release",
23
+ "defaultBranch": "main",
24
+ "yamlFileName": "trigger-release-apis.yml"
25
+ }
26
+ ],
27
+ "policies": [
28
+ {
29
+ "definition": "common-ci-test",
30
+ "type": "Build",
31
+ "refName": "refs/heads/main",
32
+ "matchKind": "Exact"
33
+ }
34
+ ],
35
+ "pullRequests": [
36
+ {
37
+ "source": "feature/release-go",
38
+ "target": "hotfix/v4.3.11"
39
+ }
40
+ ]
41
+ },
42
+ "common-cxx": {
43
+ "definitions": [
44
+ {
45
+ "name": "common-cxx-test",
46
+ "defaultBranch": "master",
47
+ "yamlFileName": "ci/build-and-test.yml"
48
+ },
49
+ {
50
+ "name": "common-cxx-tag-repository",
51
+ "defaultBranch": "master",
52
+ "yamlFileName": "ci/create-tag.yml"
53
+ },
54
+ {
55
+ "name": "common-cxx-submodule-trigger",
56
+ "defaultBranch": "hotfix/v4.3.5",
57
+ "yamlFileName": "ci/submodule-trigger.yml",
58
+ "triggers": [
59
+ {
60
+ "definitionName": "common-ci-tag-repository",
61
+ "requiresSuccessfulBuild": true,
62
+ "branchFilters": [
63
+ "+refs/heads/main"
64
+ ],
65
+ "triggerType": "buildCompletion"
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "policies": [
71
+ {
72
+ "definition": "common-cxx-test",
73
+ "type": "Build",
74
+ "refName": "refs/heads/master",
75
+ "matchKind": "Exact"
76
+ }
77
+ ],
78
+ "pullRequests": [
79
+ {
80
+ "source": "feature/go-support",
81
+ "target": "hotfix/v4.3.5"
82
+ }
83
+ ],
84
+ "submodules": [
85
+ "common-ci"
86
+ ]
87
+ },
88
+ "device-detection-cxx": {
89
+ "definitions": [
90
+ {
91
+ "name": "device-detection-cxx-test",
92
+ "defaultBranch": "master",
93
+ "yamlFileName": "ci/build-and-test.yml"
94
+ },
95
+ {
96
+ "name": "device-detection-cxx-tag-repository",
97
+ "defaultBranch": "master",
98
+ "yamlFileName": "ci/create-tag.yml"
99
+ },
100
+ {
101
+ "name": "device-detection-cxx-submodule-trigger",
102
+ "defaultBranch": "hotfix/v4.3.5",
103
+ "yamlFileName": "ci/submodule-trigger.yml",
104
+ "triggers": [
105
+ {
106
+ "definitionName": "common-ci-tag-repository",
107
+ "requiresSuccessfulBuild": true,
108
+ "branchFilters": [
109
+ "+refs/heads/main"
110
+ ],
111
+ "triggerType": "buildCompletion"
112
+ },
113
+ {
114
+ "definitionName": "common-cxx-tag-repository",
115
+ "requiresSuccessfulBuild": true,
116
+ "branchFilters": [
117
+ "+refs/heads/master"
118
+ ],
119
+ "triggerType": "buildCompletion"
120
+ }
121
+ ]
122
+ }
123
+ ],
124
+ "policies": [
125
+ {
126
+ "definition": "device-detection-cxx-test",
127
+ "type": "Build",
128
+ "refName": "refs/heads/master",
129
+ "matchKind": "Exact"
130
+ }
131
+ ],
132
+ "pullRequests": [
133
+ {
134
+ "source": "feature/go-support",
135
+ "target": "hotfix/v4.3.5"
136
+ }
137
+ ],
138
+ "submodules": [
139
+ "common-ci",
140
+ "common-cxx",
141
+ "device-detection-data"
142
+ ]
143
+ },
144
+ "device-detection-go": {
145
+ "definitions": [
146
+ {
147
+ "name": "device-detection-go-test",
148
+ "defaultBranch": "master",
149
+ "yamlFileName": "ci/build-and-test.yml"
150
+ },
151
+ {
152
+ "name": "device-detection-go-tag-repository",
153
+ "defaultBranch": "master",
154
+ "yamlFileName": "ci/tag-repository.yml"
155
+ },
156
+ {
157
+ "name": "device-detection-go-deploy-external",
158
+ "defaultBranch": "master",
159
+ "yamlFileName": "ci/deploy.yml",
160
+ "triggers": [
161
+ {
162
+ "definitionName": "device-detection-go-tag-repository",
163
+ "requiresSuccessfulBuild": true,
164
+ "branchFilters": [
165
+ "+refs/heads/master"
166
+ ],
167
+ "triggerType": "buildCompletion"
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ "name": "device-detection-go-submodule-trigger",
173
+ "defaultBranch": "release/v4.3.0",
174
+ "yamlFileName": "ci/submodule-trigger.yml",
175
+ "triggers": [
176
+ {
177
+ "definitionName": "common-ci-tag-repository",
178
+ "requiresSuccessfulBuild": true,
179
+ "branchFilters": [
180
+ "+refs/heads/main"
181
+ ],
182
+ "triggerType": "buildCompletion"
183
+ },
184
+ {
185
+ "definitionName": "device-detection-cxx-tag-repository",
186
+ "requiresSuccessfulBuild": true,
187
+ "branchFilters": [
188
+ "+refs/heads/master"
189
+ ],
190
+ "triggerType": "buildCompletion"
191
+ }
192
+ ]
193
+ }
194
+ ],
195
+ "policies": [
196
+ {
197
+ "definition": "device-detection-go-test",
198
+ "type": "Build",
199
+ "refName": "refs/heads/master",
200
+ "matchKind": "Exact"
201
+ }
202
+ ],
203
+ "pullRequests": [
204
+ {
205
+ "source": "feature/init-interfaces",
206
+ "target": "release/v4.3.0"
207
+ }
208
+ ],
209
+ "submodules": [
210
+ "common-ci",
211
+ "device-detection-cxx"
212
+ ]
213
+ },
214
+ "device-detection-examples-go": {
215
+ "definitions": [
216
+ {
217
+ "name": "device-detection-examples-go-test",
218
+ "defaultBranch": "master",
219
+ "yamlFileName": "ci/build-and-test.yml"
220
+ },
221
+ {
222
+ "name": "device-detection-examples-go-tag-repository",
223
+ "defaultBranch": "master",
224
+ "yamlFileName": "ci/tag-repository.yml"
225
+ },
226
+ {
227
+ "name": "device-detection-examples-go-deploy-external",
228
+ "defaultBranch": "master",
229
+ "yamlFileName": "ci/deploy.yml",
230
+ "triggers": [
231
+ {
232
+ "definitionName": "device-detection-examples-go-tag-repository",
233
+ "requiresSuccessfulBuild": true,
234
+ "branchFilters": [
235
+ "+refs/heads/master"
236
+ ],
237
+ "triggerType": "buildCompletion"
238
+ }
239
+ ]
240
+ },
241
+ {
242
+ "name": "device-detection-examples-go-submodule-trigger",
243
+ "defaultBranch": "release/v4.3.0",
244
+ "yamlFileName": "ci/submodule-trigger.yml",
245
+ "triggers": [
246
+ {
247
+ "definitionName": "common-ci-tag-repository",
248
+ "requiresSuccessfulBuild": true,
249
+ "branchFilters": [
250
+ "+refs/heads/main"
251
+ ],
252
+ "triggerType": "buildCompletion"
253
+ },
254
+ {
255
+ "definitionName": "device-detection-examples-go-tag-repository",
256
+ "requiresSuccessfulBuild": true,
257
+ "branchFilters": [
258
+ "+refs/heads/master"
259
+ ],
260
+ "triggerType": "buildCompletion"
261
+ }
262
+ ]
263
+ }
264
+ ],
265
+ "policies": [
266
+ {
267
+ "definition": "device-detection-examples-go-test",
268
+ "type": "Build",
269
+ "refName": "refs/heads/master",
270
+ "matchKind": "Exact"
271
+ }
272
+ ],
273
+ "pullRequests": [
274
+ {
275
+ "source": "feature/initial-examples",
276
+ "target": "release/v4.3.0"
277
+ }
278
+ ],
279
+ "submodules": [
280
+ "common-ci",
281
+ "device-detection-go"
282
+ ]
283
+ }
284
+ },
285
+ "policies": [
286
+ {
287
+ "type": "Required reviewers"
288
+ }
289
+ ]
290
+ }
@@ -0,0 +1,260 @@
1
+ {
2
+ "name": "APIs Test Environment Configuration",
3
+ "repositories": {
4
+ "javascript": {},
5
+ "device-detection-data": {},
6
+ "common-ci": {
7
+ "tags": [
8
+ "4.3.10"
9
+ ],
10
+ "definitions": [
11
+ {
12
+ "name": "common-ci-test",
13
+ "defaultBranch": "main",
14
+ "yamlFileName": "build-and-test.yml"
15
+ },
16
+ {
17
+ "name": "common-ci-tag-repository",
18
+ "defaultBranch": "main",
19
+ "yamlFileName": "create-tag.yml"
20
+ },
21
+ {
22
+ "name": "common-ci-trigger-release",
23
+ "defaultBranch": "main",
24
+ "yamlFileName": "trigger-release-apis.yml"
25
+ }
26
+ ],
27
+ "policies": [
28
+ {
29
+ "definition": "common-ci-test",
30
+ "type": "Build",
31
+ "refName": "refs/heads/main",
32
+ "matchKind": "Exact"
33
+ }
34
+ ],
35
+ "pullRequests": [
36
+ {
37
+ "source": "feature/release-go",
38
+ "target": "hotfix/v4.3.11"
39
+ }
40
+ ]
41
+ },
42
+ "common-cxx": {
43
+ "definitions": [
44
+ {
45
+ "name": "common-cxx-test",
46
+ "defaultBranch": "master",
47
+ "yamlFileName": "ci/build-and-test.yml"
48
+ },
49
+ {
50
+ "name": "common-cxx-tag-repository",
51
+ "defaultBranch": "master",
52
+ "yamlFileName": "ci/create-tag.yml"
53
+ },
54
+ {
55
+ "name": "common-cxx-submodule-trigger",
56
+ "defaultBranch": "hotfix/v4.3.5",
57
+ "yamlFileName": "ci/submodule-trigger.yml",
58
+ "triggers": [
59
+ {
60
+ "definitionName": "common-ci-tag-repository",
61
+ "requiresSuccessfulBuild": true,
62
+ "branchFilters": [
63
+ "+refs/heads/main"
64
+ ],
65
+ "triggerType": "buildCompletion"
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "policies": [
71
+ {
72
+ "definition": "common-cxx-test",
73
+ "type": "Build",
74
+ "refName": "refs/heads/master",
75
+ "matchKind": "Exact"
76
+ }
77
+ ],
78
+ "pullRequests": [
79
+ {
80
+ "source": "feature/go-support",
81
+ "target": "hotfix/v4.3.5"
82
+ }
83
+ ],
84
+ "submodules": [
85
+ "common-ci"
86
+ ]
87
+ },
88
+ "device-detection-cxx": {
89
+ "definitions": [
90
+ {
91
+ "name": "device-detection-cxx-test",
92
+ "defaultBranch": "master",
93
+ "yamlFileName": "ci/build-and-test.yml"
94
+ },
95
+ {
96
+ "name": "device-detection-cxx-tag-repository",
97
+ "defaultBranch": "master",
98
+ "yamlFileName": "ci/create-tag.yml"
99
+ },
100
+ {
101
+ "name": "device-detection-cxx-submodule-trigger",
102
+ "defaultBranch": "hotfix/v4.3.5",
103
+ "yamlFileName": "ci/submodule-trigger.yml",
104
+ "triggers": [
105
+ {
106
+ "definitionName": "common-ci-tag-repository",
107
+ "requiresSuccessfulBuild": true,
108
+ "branchFilters": [
109
+ "+refs/heads/main"
110
+ ],
111
+ "triggerType": "buildCompletion"
112
+ },
113
+ {
114
+ "definitionName": "common-cxx-tag-repository",
115
+ "requiresSuccessfulBuild": true,
116
+ "branchFilters": [
117
+ "+refs/heads/master"
118
+ ],
119
+ "triggerType": "buildCompletion"
120
+ }
121
+ ]
122
+ }
123
+ ],
124
+ "policies": [
125
+ {
126
+ "definition": "device-detection-cxx-test",
127
+ "type": "Build",
128
+ "refName": "refs/heads/master",
129
+ "matchKind": "Exact"
130
+ }
131
+ ],
132
+ "pullRequests": [
133
+ {
134
+ "source": "feature/go-support",
135
+ "target": "hotfix/v4.3.5"
136
+ }
137
+ ],
138
+ "submodules": [
139
+ "common-ci",
140
+ "common-cxx",
141
+ "device-detection-data"
142
+ ]
143
+ },
144
+ "device-detection-go": {
145
+ "definitions": [
146
+ {
147
+ "name": "device-detection-go-test",
148
+ "defaultBranch": "master",
149
+ "yamlFileName": "ci/build-and-test.yml"
150
+ },
151
+ {
152
+ "name": "device-detection-go-tag-repository",
153
+ "defaultBranch": "master",
154
+ "yamlFileName": "ci/tag-repository.yml"
155
+ },
156
+ {
157
+ "name": "device-detection-go-submodule-trigger",
158
+ "defaultBranch": "release/v4.3.0",
159
+ "yamlFileName": "ci/submodule-trigger.yml",
160
+ "triggers": [
161
+ {
162
+ "definitionName": "common-ci-tag-repository",
163
+ "requiresSuccessfulBuild": true,
164
+ "branchFilters": [
165
+ "+refs/heads/main"
166
+ ],
167
+ "triggerType": "buildCompletion"
168
+ },
169
+ {
170
+ "definitionName": "device-detection-cxx-tag-repository",
171
+ "requiresSuccessfulBuild": true,
172
+ "branchFilters": [
173
+ "+refs/heads/master"
174
+ ],
175
+ "triggerType": "buildCompletion"
176
+ }
177
+ ]
178
+ }
179
+ ],
180
+ "policies": [
181
+ {
182
+ "definition": "device-detection-go-test",
183
+ "type": "Build",
184
+ "refName": "refs/heads/master",
185
+ "matchKind": "Exact"
186
+ }
187
+ ],
188
+ "pullRequests": [
189
+ {
190
+ "source": "feature/init-interfaces",
191
+ "target": "release/v4.3.0"
192
+ }
193
+ ],
194
+ "submodules": [
195
+ "common-ci",
196
+ "device-detection-cxx"
197
+ ]
198
+ },
199
+ "device-detection-examples-go": {
200
+ "definitions": [
201
+ {
202
+ "name": "device-detection-examples-go-test",
203
+ "defaultBranch": "main",
204
+ "yamlFileName": "ci/build-and-test.yml"
205
+ },
206
+ {
207
+ "name": "device-detection-examples-go-tag-repository",
208
+ "defaultBranch": "main",
209
+ "yamlFileName": "ci/tag-repository.yml"
210
+ },
211
+ {
212
+ "name": "device-detection-examples-go-submodule-trigger",
213
+ "defaultBranch": "release/v4.3.0",
214
+ "yamlFileName": "ci/submodule-trigger.yml",
215
+ "triggers": [
216
+ {
217
+ "definitionName": "common-ci-tag-repository",
218
+ "requiresSuccessfulBuild": true,
219
+ "branchFilters": [
220
+ "+refs/heads/main"
221
+ ],
222
+ "triggerType": "buildCompletion"
223
+ },
224
+ {
225
+ "definitionName": "device-detection-go-tag-repository",
226
+ "requiresSuccessfulBuild": true,
227
+ "branchFilters": [
228
+ "+refs/heads/master"
229
+ ],
230
+ "triggerType": "buildCompletion"
231
+ }
232
+ ]
233
+ }
234
+ ],
235
+ "policies": [
236
+ {
237
+ "definition": "device-detection-examples-go-test",
238
+ "type": "Build",
239
+ "refName": "refs/heads/main",
240
+ "matchKind": "Exact"
241
+ }
242
+ ],
243
+ "pullRequests": [
244
+ {
245
+ "source": "feature/initial-examples",
246
+ "target": "release/v4.3.0"
247
+ }
248
+ ],
249
+ "submodules": [
250
+ "common-ci",
251
+ "device-detection-go"
252
+ ]
253
+ }
254
+ },
255
+ "policies": [
256
+ {
257
+ "type": "Required reviewers"
258
+ }
259
+ ]
260
+ }
@@ -0,0 +1,104 @@
1
+ <#
2
+ ==================== ApplicationInsights =====================
3
+ .Description
4
+ This module contains a function to add application insights extension to an
5
+ Azure App Service
6
+ #>
7
+
8
+ function Add-ApplicationInsightsExt {
9
+
10
+ param(
11
+ # The web app instance retreived using Get-AzWebApp
12
+ [Parameter(Mandatory=$true)]
13
+ [Object]$Webapp,
14
+
15
+ # The name of the application insights resouce
16
+ [Parameter(Mandatory=$true)]
17
+ [string]$AppInsightsName,
18
+
19
+ # The name of the application insights resource group
20
+ [Parameter(Mandatory=$true)]
21
+ [string]$AppInsightsResourceGroup
22
+ )
23
+
24
+ # Create the site extension needed for Application Insights.
25
+ $resourceNameString = $Webapp.Name + "/Microsoft.ApplicationInsights.AzureWebSites"
26
+ New-AzResource `
27
+ -ResourceType "Microsoft.Web/sites/siteextensions" `
28
+ -ResourceGroupName $Webapp.ResourceGroup `
29
+ -Name $resourceNameString `
30
+ -ApiVersion "2018-02-01" `
31
+ -Force `
32
+ -ErrorAction Stop
33
+
34
+ # Get instrumentation key from ENV application insights resource.
35
+ $appInsightsInstrumentationKey = (Get-AzApplicationInsights `
36
+ -Name $AppInsightsName `
37
+ -ResourceGroupName $AppInsightsResourceGroup).InstrumentationKey
38
+
39
+ # Set the appseting to send telemetry to common applicaiton insights.
40
+ $webAppSettings = $Webapp.SiteConfig.AppSettings
41
+ $hash = @{ }
42
+ Write-Host "Clearing hash table"
43
+ foreach ($setting in $webAppSettings) {
44
+ $hash[$setting.Name] = $setting.Value
45
+ }
46
+
47
+ # Its important to include the syntax around the variable eg. "$($var)"" if not
48
+ # supplied like this it will change the hash table's object type.
49
+ $hash['APPINSIGHTS_INSTRUMENTATIONKEY'] = "$($appInsightsInstrumentationKey)"
50
+
51
+ # Write back app settings into web app.
52
+ Write-Host "Writing back updated appsettings to app service" $Webapp.Name
53
+ Set-AzWebApp `
54
+ -ResourceGroupName $Webapp.ResourceGroup `
55
+ -Name $Webapp.Name `
56
+ -AppSettings $hash `
57
+ -verbose
58
+
59
+ # Restart the web app to link to application insights.
60
+ Restart-AzWebApp `
61
+ -ResourceGroupName $Webapp.ResourceGroup `
62
+ -Name $Webapp.Name
63
+ }
64
+
65
+ # Create a new Application Insights API Key.
66
+ function New-ApplicationInsightsAPIKey {
67
+
68
+ param (
69
+ [Parameter(Mandatory=$true)]
70
+ [string]$ResourceGroup,
71
+
72
+ [Parameter(Mandatory=$true)]
73
+ [string]$AppInsightsName,
74
+
75
+ [Parameter(Mandatory=$true)]
76
+ [string]$Description
77
+
78
+ )
79
+
80
+ # Get the Application Insights resource.
81
+ $appInsights = Get-AzApplicationInsights `
82
+ -ResourceGroupName $ResourceGroup `
83
+ -Name $AppInsightsName `
84
+ -ErrorAction SilentlyContinue
85
+
86
+ $apiKey = ""
87
+
88
+ if(-not $appInsights) {
89
+ Write-Host "No App Insights found, cannot create an API Key."
90
+ } else {
91
+ # Create a app insights API key.
92
+ $permissions = @("AuthenticateSDKControlChannel")
93
+ $apiKey = New-AzApplicationInsightsApiKey `
94
+ -ApplicationInsightsComponent $appInsights `
95
+ -Description "$($Description) - $(Get-Date)" `
96
+ -Permissions $permissions
97
+ }
98
+
99
+ return $apiKey
100
+ }
101
+
102
+ Export-ModuleMember -Function Add-ApplicationInsightsExt
103
+ Export-ModuleMember -Function New-ApplicationInsightsAPIKey
104
+ Export-ModuleMember -Function New-ApplicationInsightsResource