Skip to content

Commit 56839c5

Browse files
Merge pull request #8446 from arolshan/datasources-appinsights-support
Az.OperationalInsights- DataSources - Application-Insights data source support
2 parents f800db6 + c480301 commit 56839c5

File tree

15 files changed

+767
-8
lines changed

15 files changed

+767
-8
lines changed

src/Accounts/Accounts/AzureRmAlias/Mappings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,7 @@
16941694
"New-AzOperationalInsightsWindowsPerformanceCounterDataSource": "New-AzureRmOperationalInsightsWindowsPerformanceCounterDataSource",
16951695
"New-AzOperationalInsightsLinuxPerformanceObjectDataSource": "New-AzureRmOperationalInsightsLinuxPerformanceObjectDataSource",
16961696
"New-AzOperationalInsightsLinuxSyslogDataSource": "New-AzureRmOperationalInsightsLinuxSyslogDataSource",
1697+
"New-AzOperationalInsightsApplicationInsightsDataSource": "New-AzureRmOperationalInsightsApplicationInsightsDataSource",
16971698
"Disable-AzOperationalInsightsLinuxSyslogCollection": "Disable-AzureRmOperationalInsightsLinuxSyslogCollection",
16981699
"New-AzOperationalInsightsWindowsEventDataSource": "New-AzureRmOperationalInsightsWindowsEventDataSource",
16991700
"Get-AzOperationalInsightsSavedSearch": "Get-AzureRmOperationalInsightsSavedSearch",

src/OperationalInsights/OperationalInsights.Test/ScenarioTests/DataSourceTests.ps1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function Test-CreateAllKindsOfDataSource
109109
$wsname = Get-ResourceName
110110
$rgname = Get-ResourceGroupName
111111
$subId1 = "0b88dfdb-55b3-4fb0-b474-5b6dcbe6b2ef"
112+
$subId2 = "aaaadfdb-55b3-4fb0-b474-5b6dcbe6aaaa"
112113
$wslocation = Get-ProviderLocation
113114

114115
New-AzResourceGroup -Name $rgname -Location $wslocation -Force
@@ -134,7 +135,20 @@ function Test-CreateAllKindsOfDataSource
134135
# customlog
135136
$customLogRawJson = '{"customLogName":"Validation_CL","description":"test","inputs":[{"location":{"fileSystemLocations":{"linuxFileTypeLogPaths":null,"windowsFileTypeLogPaths":["C:\\e2e\\Evan\\ArubaSECURITY\\*.log"]}},"recordDelimiter":{"regexDelimiter":{"pattern":"\\n","matchIndex":0}}}],"extractions":[{"extractionName":"TimeGenerated","extractionType":"DateTime","extractionProperties":{"dateTimeExtraction":{"regex":null,"joinStringRegex":null}}}]}'
136137
$customLogDataSource = New-AzOperationalInsightsCustomLogDataSource -Workspace $workspace -CustomLogRawJson $customLogRawJson -Name "MyCustomLog"
137-
138+
139+
# ApplicationInsights data source
140+
$applicationInsightsDataSource1 = New-AzOperationalInsightsApplicationInsightsDataSource -Workspace $workspace -ApplicationSubscriptionId $subId1 -ApplicationResourceGroupName $rgname -ApplicationName "ai-app"
141+
Assert-NotNull $applicationInsightsDataSource1
142+
Assert-AreEqual "subscriptions/$subId1/resourceGroups/$rgname/providers/microsoft.insights/components/ai-app" $applicationInsightsDataSource1.Name
143+
Assert-AreEqual "ApplicationInsights" $applicationInsightsDataSource1.Kind
144+
Assert-AreEqual $rgname $applicationInsightsDataSource1.ResourceGroupName
145+
146+
# ApplicationInsights data source by application resourceId
147+
$applicationInsightsDataSource2 = New-AzOperationalInsightsApplicationInsightsDataSource -Workspace $workspace -ApplicationResourceId "/subscriptions/$subId2/resourceGroups/$rgname/providers/microsoft.insights/components/ai-app2"
148+
Assert-NotNull $applicationInsightsDataSource2
149+
Assert-AreEqual "subscriptions/$subId2/resourceGroups/$rgname/providers/microsoft.insights/components/ai-app2" $applicationInsightsDataSource2.Name
150+
Assert-AreEqual "ApplicationInsights" $applicationInsightsDataSource2.Kind
151+
Assert-AreEqual $rgname $applicationInsightsDataSource2.ResourceGroupName
138152
}
139153

140154
<#

src/OperationalInsights/OperationalInsights.Test/SessionRecords/Microsoft.Azure.Commands.OperationalInsights.Test.DataSourceTests/TestCreateAllKindsOfDataSource.json

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,282 @@
10651065
]
10661066
},
10671067
"StatusCode": 200
1068+
},
1069+
{
1070+
"RequestUri": "/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourcegroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/dataSources/ApplicationInsights?api-version=2015-11-01-preview",
1071+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTYzODNiZTMtZjBlOC00OTY4LTkzZDUtMTBmMjYyNWY1YmI1L3Jlc291cmNlZ3JvdXBzL29uZXNkazk5NjcvcHJvdmlkZXJzL01pY3Jvc29mdC5PcGVyYXRpb25hbEluc2lnaHRzL3dvcmtzcGFjZXMvQXpUZXN0b25lc2RrNTIwNi9kYXRhU291cmNlcy9BcHBsaWNhdGlvbkluc2lnaHRzP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDEtcHJldmlldw==",
1072+
"RequestMethod": "GET",
1073+
"RequestBody": "",
1074+
"RequestHeaders": {
1075+
"x-ms-client-request-id": [
1076+
"01663d0e-5642-426d-8b98-8460420c7a32"
1077+
],
1078+
"accept-language": [
1079+
"en-US"
1080+
],
1081+
"User-Agent": [
1082+
"FxVersion/4.7.2046.0",
1083+
"OSName/Windows_10_Enterprise",
1084+
"OSVersion/6.3.15063",
1085+
"Microsoft.Azure.Management.OperationalInsights.OperationalInsightsManagementClient/0.18.0-preview"
1086+
]
1087+
},
1088+
"ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"DataSourceNotFound\",\r\n \"message\": \"DataSource 'ApplicationInsights' could not be found.\"\r\n }\r\n}",
1089+
"ResponseHeaders": {
1090+
"Content-Length": [
1091+
"95"
1092+
],
1093+
"Content-Type": [
1094+
"application/json; charset=utf-8"
1095+
],
1096+
"Expires": [
1097+
"-1"
1098+
],
1099+
"Pragma": [
1100+
"no-cache"
1101+
],
1102+
"Strict-Transport-Security": [
1103+
"max-age=31536000; includeSubDomains"
1104+
],
1105+
"X-Content-Type-Options": [
1106+
"nosniff"
1107+
],
1108+
"x-ms-ratelimit-remaining-subscription-reads": [
1109+
"14828"
1110+
],
1111+
"x-ms-request-id": [
1112+
"39a15c60-ee42-417a-b529-162ec471b9f8"
1113+
],
1114+
"x-ms-correlation-request-id": [
1115+
"39a15c60-ee42-417a-b529-162ec471b9f8"
1116+
],
1117+
"x-ms-routing-request-id": [
1118+
"WESTUS2:20170504T002627Z:39a15c60-ee42-417a-b529-162ec471b9f8"
1119+
],
1120+
"Cache-Control": [
1121+
"no-cache"
1122+
],
1123+
"Date": [
1124+
"Thu, 04 May 2017 00:26:27 GMT"
1125+
],
1126+
"Server": [
1127+
"Microsoft-IIS/8.5"
1128+
],
1129+
"X-Powered-By": [
1130+
"ASP.NET"
1131+
]
1132+
},
1133+
"StatusCode": 404
1134+
},
1135+
{
1136+
"RequestUri": "/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourcegroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/dataSources/ApplicationInsights?api-version=2015-11-01-preview",
1137+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTYzODNiZTMtZjBlOC00OTY4LTkzZDUtMTBmMjYyNWY1YmI1L3Jlc291cmNlZ3JvdXBzL29uZXNkazk5NjcvcHJvdmlkZXJzL01pY3Jvc29mdC5PcGVyYXRpb25hbEluc2lnaHRzL3dvcmtzcGFjZXMvQXpUZXN0b25lc2RrNTIwNi9kYXRhU291cmNlcy9BcHBsaWNhdGlvbkluc2lnaHRzP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDEtcHJldmlldw==",
1138+
"RequestMethod": "PUT",
1139+
"RequestBody": "{\r\n \"properties\": {\r\n \"linkedResourceId\": \"subscriptions/0b88dfdb-55b3-4fb0-b474-5b6dcbe6b2ef/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app\",\r\n \"status\": \"Succeeded\" },\r\n \"kind\": \"ApplicationInsights\"\r\n}",
1140+
"RequestHeaders": {
1141+
"Content-Type": [
1142+
"application/json; charset=utf-8"
1143+
],
1144+
"Content-Length": [
1145+
"713"
1146+
],
1147+
"x-ms-client-request-id": [
1148+
"3a712d5e-832f-4dd2-8cfe-b39dc4f3b80b"
1149+
],
1150+
"accept-language": [
1151+
"en-US"
1152+
],
1153+
"User-Agent": [
1154+
"FxVersion/4.7.2046.0",
1155+
"OSName/Windows_10_Enterprise",
1156+
"OSVersion/6.3.15063",
1157+
"Microsoft.Azure.Management.OperationalInsights.OperationalInsightsManagementClient/0.18.0-preview"
1158+
]
1159+
},
1160+
"ResponseBody": "{\r\n \"kind\": \"ApplicationInsights\",\r\n \"properties\": {\r\n \"linkedResourceId\": \"subscriptions/0b88dfdb-55b3-4fb0-b474-5b6dcbe6b2ef/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app\",\r\n \"status\": \"Succeeded\" },\r\n \"id\": \"/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourceGroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/datasources/subscriptions/0b88dfdb-55b3-4fb0-b474-5b6dcbe6b2ef/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app\",\r\n \"etag\": \"W/\\\"datetime'2017-05-04T00%3A26%3A31.2865595Z'\\\"\",\r\n \"name\": \"subscriptions/0b88dfdb-55b3-4fb0-b474-5b6dcbe6b2ef/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/datasources\"\r\n}",
1161+
"ResponseHeaders": {
1162+
"Content-Length": [
1163+
"769"
1164+
],
1165+
"Content-Type": [
1166+
"application/json; charset=utf-8"
1167+
],
1168+
"Expires": [
1169+
"-1"
1170+
],
1171+
"Pragma": [
1172+
"no-cache"
1173+
],
1174+
"Strict-Transport-Security": [
1175+
"max-age=31536000; includeSubDomains"
1176+
],
1177+
"X-Content-Type-Options": [
1178+
"nosniff"
1179+
],
1180+
"x-ms-ratelimit-remaining-subscription-writes": [
1181+
"1193"
1182+
],
1183+
"x-ms-request-id": [
1184+
"f84325f6-3ea3-4b44-89d8-1fc05971adec"
1185+
],
1186+
"x-ms-correlation-request-id": [
1187+
"f84325f6-3ea3-4b44-89d8-1fc05971adec"
1188+
],
1189+
"x-ms-routing-request-id": [
1190+
"WESTUS2:20170504T002713Z:f84325f6-3ea3-4b44-89d8-1fc05971adec"
1191+
],
1192+
"Cache-Control": [
1193+
"no-cache"
1194+
],
1195+
"Date": [
1196+
"Thu, 04 May 2017 00:27:12 GMT"
1197+
],
1198+
"Server": [
1199+
"Microsoft-IIS/8.5"
1200+
],
1201+
"X-Powered-By": [
1202+
"ASP.NET"
1203+
]
1204+
},
1205+
"StatusCode": 200
1206+
},
1207+
{
1208+
"RequestUri": "/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourcegroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/dataSources/ApplicationInsights?api-version=2015-11-01-preview",
1209+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTYzODNiZTMtZjBlOC00OTY4LTkzZDUtMTBmMjYyNWY1YmI1L3Jlc291cmNlZ3JvdXBzL29uZXNkazk5NjcvcHJvdmlkZXJzL01pY3Jvc29mdC5PcGVyYXRpb25hbEluc2lnaHRzL3dvcmtzcGFjZXMvQXpUZXN0b25lc2RrNTIwNi9kYXRhU291cmNlcy9BcHBsaWNhdGlvbkluc2lnaHRzP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDEtcHJldmlldw==",
1210+
"RequestMethod": "GET",
1211+
"RequestBody": "",
1212+
"RequestHeaders": {
1213+
"x-ms-client-request-id": [
1214+
"01663d0e-5642-426d-8b98-8460420c7a32"
1215+
],
1216+
"accept-language": [
1217+
"en-US"
1218+
],
1219+
"User-Agent": [
1220+
"FxVersion/4.7.2046.0",
1221+
"OSName/Windows_10_Enterprise",
1222+
"OSVersion/6.3.15063",
1223+
"Microsoft.Azure.Management.OperationalInsights.OperationalInsightsManagementClient/0.18.0-preview"
1224+
]
1225+
},
1226+
"ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"DataSourceNotFound\",\r\n \"message\": \"DataSource 'ApplicationInsights' could not be found.\"\r\n }\r\n}",
1227+
"ResponseHeaders": {
1228+
"Content-Length": [
1229+
"95"
1230+
],
1231+
"Content-Type": [
1232+
"application/json; charset=utf-8"
1233+
],
1234+
"Expires": [
1235+
"-1"
1236+
],
1237+
"Pragma": [
1238+
"no-cache"
1239+
],
1240+
"Strict-Transport-Security": [
1241+
"max-age=31536000; includeSubDomains"
1242+
],
1243+
"X-Content-Type-Options": [
1244+
"nosniff"
1245+
],
1246+
"x-ms-ratelimit-remaining-subscription-reads": [
1247+
"14828"
1248+
],
1249+
"x-ms-request-id": [
1250+
"39a15c60-ee42-417a-b529-162ec471b9f8"
1251+
],
1252+
"x-ms-correlation-request-id": [
1253+
"39a15c60-ee42-417a-b529-162ec471b9f8"
1254+
],
1255+
"x-ms-routing-request-id": [
1256+
"WESTUS2:20170504T002627Z:39a15c60-ee42-417a-b529-162ec471b9f8"
1257+
],
1258+
"Cache-Control": [
1259+
"no-cache"
1260+
],
1261+
"Date": [
1262+
"Thu, 04 May 2017 00:26:27 GMT"
1263+
],
1264+
"Server": [
1265+
"Microsoft-IIS/8.5"
1266+
],
1267+
"X-Powered-By": [
1268+
"ASP.NET"
1269+
]
1270+
},
1271+
"StatusCode": 404
1272+
},
1273+
{
1274+
"RequestUri": "/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourcegroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/dataSources/ApplicationInsights?api-version=2015-11-01-preview",
1275+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTYzODNiZTMtZjBlOC00OTY4LTkzZDUtMTBmMjYyNWY1YmI1L3Jlc291cmNlZ3JvdXBzL29uZXNkazk5NjcvcHJvdmlkZXJzL01pY3Jvc29mdC5PcGVyYXRpb25hbEluc2lnaHRzL3dvcmtzcGFjZXMvQXpUZXN0b25lc2RrNTIwNi9kYXRhU291cmNlcy9BcHBsaWNhdGlvbkluc2lnaHRzP2FwaS12ZXJzaW9uPTIwMTUtMTEtMDEtcHJldmlldw==",
1276+
"RequestMethod": "PUT",
1277+
"RequestBody": "{\r\n \"properties\": {\r\n \"linkedResourceId\": \"subscriptions/aaaadfdb-55b3-4fb0-b474-5b6dcbe6aaaa/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app2\",\r\n \"status\": \"Succeeded\" },\r\n \"kind\": \"ApplicationInsights\"\r\n}",
1278+
"RequestHeaders": {
1279+
"Content-Type": [
1280+
"application/json; charset=utf-8"
1281+
],
1282+
"Content-Length": [
1283+
"713"
1284+
],
1285+
"x-ms-client-request-id": [
1286+
"3a712d5e-832f-4dd2-8cfe-b39dc4f3b80b"
1287+
],
1288+
"accept-language": [
1289+
"en-US"
1290+
],
1291+
"User-Agent": [
1292+
"FxVersion/4.7.2046.0",
1293+
"OSName/Windows_10_Enterprise",
1294+
"OSVersion/6.3.15063",
1295+
"Microsoft.Azure.Management.OperationalInsights.OperationalInsightsManagementClient/0.18.0-preview"
1296+
]
1297+
},
1298+
"ResponseBody": "{\r\n \"kind\": \"ApplicationInsights\",\r\n \"properties\": {\r\n \"linkedResourceId\": \"subscriptions/aaaadfdb-55b3-4fb0-b474-5b6dcbe6aaaa/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app2\",\r\n \"status\": \"Succeeded\" },\r\n \"id\": \"/subscriptions/a6383be3-f0e8-4968-93d5-10f2625f5bb5/resourceGroups/onesdk9967/providers/Microsoft.OperationalInsights/workspaces/AzTestonesdk5206/datasources/subscriptions/aaaadfdb-55b3-4fb0-b474-5b6dcbe6aaaa/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app2\",\r\n \"etag\": \"W/\\\"datetime'2017-05-04T00%3A26%3A31.2865595Z'\\\"\",\r\n \"name\": \"subscriptions/aaaadfdb-55b3-4fb0-b474-5b6dcbe6aaaa/resourceGroups/onesdk9967/providers/microsoft.insights/components/ai-app2\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/datasources\"\r\n}",
1299+
"ResponseHeaders": {
1300+
"Content-Length": [
1301+
"769"
1302+
],
1303+
"Content-Type": [
1304+
"application/json; charset=utf-8"
1305+
],
1306+
"Expires": [
1307+
"-1"
1308+
],
1309+
"Pragma": [
1310+
"no-cache"
1311+
],
1312+
"Strict-Transport-Security": [
1313+
"max-age=31536000; includeSubDomains"
1314+
],
1315+
"X-Content-Type-Options": [
1316+
"nosniff"
1317+
],
1318+
"x-ms-ratelimit-remaining-subscription-writes": [
1319+
"1193"
1320+
],
1321+
"x-ms-request-id": [
1322+
"f84325f6-3ea3-4b44-89d8-1fc05971adec"
1323+
],
1324+
"x-ms-correlation-request-id": [
1325+
"f84325f6-3ea3-4b44-89d8-1fc05971adec"
1326+
],
1327+
"x-ms-routing-request-id": [
1328+
"WESTUS2:20170504T002713Z:f84325f6-3ea3-4b44-89d8-1fc05971adec"
1329+
],
1330+
"Cache-Control": [
1331+
"no-cache"
1332+
],
1333+
"Date": [
1334+
"Thu, 04 May 2017 00:27:12 GMT"
1335+
],
1336+
"Server": [
1337+
"Microsoft-IIS/8.5"
1338+
],
1339+
"X-Powered-By": [
1340+
"ASP.NET"
1341+
]
1342+
},
1343+
"StatusCode": 200
10681344
}
10691345
],
10701346
"Names": {

src/OperationalInsights/OperationalInsights/Az.OperationalInsights.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ CmdletsToExport = 'New-AzOperationalInsightsAzureActivityLogDataSource',
8585
'New-AzOperationalInsightsWindowsPerformanceCounterDataSource',
8686
'New-AzOperationalInsightsLinuxPerformanceObjectDataSource',
8787
'New-AzOperationalInsightsLinuxSyslogDataSource',
88+
'New-AzOperationalInsightsApplicationInsightsDataSource',
8889
'Disable-AzOperationalInsightsLinuxSyslogCollection',
8990
'New-AzOperationalInsightsWindowsEventDataSource',
9091
'Get-AzOperationalInsightsSavedSearch',

src/OperationalInsights/OperationalInsights/ChangeLog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21-
21+
* Additional support for New and Get ApplicationInsights data source.
22+
- Added new 'ApplicationInsights' kind to support Get specific and Get all ApplicationInsights data sources for given workspace.
23+
- Added New-AzOperationalInsightsApplicationInsightsDataSource cmdlet for creating data source by given Application-Insights resource parameters: subscription Id, resourceGroupName and name.
2224
## Version 1.0.0
2325
* General availability of `Az.OperationalInsights` module
2426
* Default parameter set for Get-AzOperationalInsightsDataSource is removed, and ByWorkspaceNameByKind has become the default parameter set

src/OperationalInsights/OperationalInsights/DataSources/GetAzureOperationalInsightsDataSourceCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public class GetAzureOperationalInsightsDataSourceCommand : OperationalInsightsB
6464
PSDataSourceKinds.LinuxPerformanceObject,
6565
PSDataSourceKinds.LinuxSyslog,
6666
PSDataSourceKinds.WindowsEvent,
67-
PSDataSourceKinds.WindowsPerformanceCounter)]
67+
PSDataSourceKinds.WindowsPerformanceCounter,
68+
PSDataSourceKinds.ApplicationInsights)]
6869
[ValidateNotNullOrEmpty]
6970
public string Kind { get; set; }
7071

0 commit comments

Comments
 (0)