DataFlex
DataFlex
Azure Monitor - List Activity Logs
See more Azure Monitor Examples
Provides the list of records from the activity logs.Note: The $filter criteria cannot specify a time range that begins more than 90 days in the past.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Handle hoJsonToken
Variant vResp
Handle hoResp
Handle hoJsonResponse
String sNextLink
Integer i
Integer iCount_i
String sAuthorizationAction
String sAuthorizationRole
String sAuthorizationScope
String sCaller
String sClaimsAud
String sClaimsIss
String sClaimsIat
String sClaimsNbf
String sClaimsExp
String sClaimsVer
String sClaims_identity_claims_tenantid
String sClaims_claims_authnmethodsreferences
String sClaims_identity_claims_objectidentifier
String sClaims_ws_2005_05_identity_claims_upn
String sClaimsPuid
String sClaims_ws_2005_05_identity_claims_nameidentifier
String sClaims_ws_2005_05_identity_claims_givenname
String sClaims_ws_2005_05_identity_claims_surname
String sClaimsName
String sClaimsGroups
String sClaims_ws_2005_05_identity_claims_name
String sClaimsAppid
String sClaimsAppidacr
String sClaims_identity_claims_scope
String sClaims_claims_authnclassreference
String sCorrelationId
String sDescription
String sEventDataId
String sEventNameValue
String sEventNameLocalizedValue
String sHttpRequestClientRequestId
String sHttpRequestClientIpAddress
String sHttpRequestMethod
String sId
String sLevel
String sResourceGroupName
String sResourceProviderNameValue
String sResourceProviderNameLocalizedValue
String sOperationId
String sOperationNameValue
String sOperationNameLocalizedValue
String sPropertiesStatusCode
String sStatusValue
String sStatusLocalizedValue
String sSubStatusValue
String sSubStatusLocalizedValue
String sEventTimestamp
String sSubmissionTimestamp
String sSubscriptionId
String sTemp1
Integer iTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// Load an OAuth2 access token previously fetched by this example: Get Azure OAuth2 Access Token
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
If (Not(IsComObjectCreated(hoJsonToken))) Begin
Send CreateComObject of hoJsonToken
End
Get ComLoadFile Of hoJsonToken "qa_data/tokens/azureToken.json" To iSuccess
// Assuming success..
Get ComStringOf Of hoJsonToken "access_token" To sTemp1
Set ComAuthToken Of hoHttp To sTemp1
Get ComAuthToken Of hoHttp To sTemp1
Showln "AuthToken: " sTemp1
Set ComAccept Of hoHttp To "application/json"
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoResp to vResp
Get ComHttpNoBody Of hoHttp "GET" "https://management.azure.com/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp%20ge%20%272019-05-16T04%3A36%3A37.6407898Z%27%20and%20eventTimestamp%20le%20%272019-06-12T04%3A36%3A37.6407898Z%27" vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln "Response Status Code: " iTemp1
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get ComBodyStr Of hoResp To sTemp1
Get ComLoad Of hoJsonResponse sTemp1 To iSuccess
Set ComEmitCompact Of hoJsonResponse To False
Get ComEmit Of hoJsonResponse To sTemp1
Showln sTemp1
Get ComStatusCode Of hoResp To iTemp1
If (iTemp1 <> 200) Begin
Showln "Failed."
Procedure_Return
End
// Sample output...
// (See the parsing code below..)
//
// Use the this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// {
// "value": [
// {
// "authorization": {
// "action": "microsoft.support/supporttickets/write",
// "role": "Subscription Admin",
// "scope": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"
// },
// "caller": "admin@contoso.com",
// "claims": {
// "aud": "https://management.core.windows.net/",
// "iss": "https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/",
// "iat": "1421876371",
// "nbf": "1421876371",
// "exp": "1421880271",
// "ver": "1.0",
// "http://schemas.microsoft.com/identity/claims/tenantid": "1e8d8218-c5e7-4578-9acc-9abbd5d23315 ",
// "http://schemas.microsoft.com/claims/authnmethodsreferences": "pwd",
// "http://schemas.microsoft.com/identity/claims/objectidentifier": "2468adf0-8211-44e3-95xq-85137af64708",
// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": "admin@contoso.com",
// "puid": "20030000801A118C",
// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM",
// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": "John",
// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": "Smith",
// "name": "John Smith",
// "groups": "cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c",
// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": " admin@contoso.com",
// "appid": "c44b4083-3bq0-49c1-b47d-974e53cbdf3c",
// "appidacr": "2",
// "http://schemas.microsoft.com/identity/claims/scope": "user_impersonation",
// "http://schemas.microsoft.com/claims/authnclassreference": "1"
// },
// "correlationId": "1e121103-0ba6-4300-ac9d-952bb5d0c80f",
// "description": "",
// "eventDataId": "44ade6b4-3813-45e6-ae27-7420a95fa2f8",
// "eventName": {
// "value": "EndRequest",
// "localizedValue": "End request"
// },
// "httpRequest": {
// "clientRequestId": "27003b25-91d3-418f-8eb1-29e537dcb249",
// "clientIpAddress": "192.168.35.115",
// "method": "PUT"
// },
// "id": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776",
// "level": "Informational",
// "resourceGroupName": "MSSupportGroup",
// "resourceProviderName": {
// "value": "microsoft.support",
// "localizedValue": "microsoft.support"
// },
// "operationId": "1e121103-0ba6-4300-ac9d-952bb5d0c80f",
// "operationName": {
// "value": "microsoft.support/supporttickets/write",
// "localizedValue": "microsoft.support/supporttickets/write"
// },
// "properties": {
// "statusCode": "Created"
// },
// "status": {
// "value": "Succeeded",
// "localizedValue": "Succeeded"
// },
// "subStatus": {
// "value": "Created",
// "localizedValue": "Created (HTTP Status Code: 201)"
// },
// "eventTimestamp": "2015-01-21T22:14:26.9792776Z",
// "submissionTimestamp": "2015-01-21T22:14:39.9936304Z",
// "subscriptionId": "089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"
// }
// ],
// "nextLink": "https://management.azure.com/########-####-####-####-############$skiptoken=######"
// }
//
Get ComStringOf Of hoJsonResponse "nextLink" To sNextLink
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "value" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "value[i].authorization.action" To sAuthorizationAction
Get ComStringOf Of hoJsonResponse "value[i].authorization.role" To sAuthorizationRole
Get ComStringOf Of hoJsonResponse "value[i].authorization.scope" To sAuthorizationScope
Get ComStringOf Of hoJsonResponse "value[i].caller" To sCaller
Get ComStringOf Of hoJsonResponse "value[i].claims.aud" To sClaimsAud
Get ComStringOf Of hoJsonResponse "value[i].claims.iss" To sClaimsIss
Get ComStringOf Of hoJsonResponse "value[i].claims.iat" To sClaimsIat
Get ComStringOf Of hoJsonResponse "value[i].claims.nbf" To sClaimsNbf
Get ComStringOf Of hoJsonResponse "value[i].claims.exp" To sClaimsExp
Get ComStringOf Of hoJsonResponse "value[i].claims.ver" To sClaimsVer
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.microsoft.com/identity/claims/tenantid"' To sClaims_identity_claims_tenantid
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.microsoft.com/claims/authnmethodsreferences"' To sClaims_claims_authnmethodsreferences
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.microsoft.com/identity/claims/objectidentifier"' To sClaims_identity_claims_objectidentifier
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"' To sClaims_ws_2005_05_identity_claims_upn
Get ComStringOf Of hoJsonResponse "value[i].claims.puid" To sClaimsPuid
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"' To sClaims_ws_2005_05_identity_claims_nameidentifier
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"' To sClaims_ws_2005_05_identity_claims_givenname
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"' To sClaims_ws_2005_05_identity_claims_surname
Get ComStringOf Of hoJsonResponse "value[i].claims.name" To sClaimsName
Get ComStringOf Of hoJsonResponse "value[i].claims.groups" To sClaimsGroups
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"' To sClaims_ws_2005_05_identity_claims_name
Get ComStringOf Of hoJsonResponse "value[i].claims.appid" To sClaimsAppid
Get ComStringOf Of hoJsonResponse "value[i].claims.appidacr" To sClaimsAppidacr
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.microsoft.com/identity/claims/scope"' To sClaims_identity_claims_scope
Get ComStringOf Of hoJsonResponse 'value[i].claims."http://schemas.microsoft.com/claims/authnclassreference"' To sClaims_claims_authnclassreference
Get ComStringOf Of hoJsonResponse "value[i].correlationId" To sCorrelationId
Get ComStringOf Of hoJsonResponse "value[i].description" To sDescription
Get ComStringOf Of hoJsonResponse "value[i].eventDataId" To sEventDataId
Get ComStringOf Of hoJsonResponse "value[i].eventName.value" To sEventNameValue
Get ComStringOf Of hoJsonResponse "value[i].eventName.localizedValue" To sEventNameLocalizedValue
Get ComStringOf Of hoJsonResponse "value[i].httpRequest.clientRequestId" To sHttpRequestClientRequestId
Get ComStringOf Of hoJsonResponse "value[i].httpRequest.clientIpAddress" To sHttpRequestClientIpAddress
Get ComStringOf Of hoJsonResponse "value[i].httpRequest.method" To sHttpRequestMethod
Get ComStringOf Of hoJsonResponse "value[i].id" To sId
Get ComStringOf Of hoJsonResponse "value[i].level" To sLevel
Get ComStringOf Of hoJsonResponse "value[i].resourceGroupName" To sResourceGroupName
Get ComStringOf Of hoJsonResponse "value[i].resourceProviderName.value" To sResourceProviderNameValue
Get ComStringOf Of hoJsonResponse "value[i].resourceProviderName.localizedValue" To sResourceProviderNameLocalizedValue
Get ComStringOf Of hoJsonResponse "value[i].operationId" To sOperationId
Get ComStringOf Of hoJsonResponse "value[i].operationName.value" To sOperationNameValue
Get ComStringOf Of hoJsonResponse "value[i].operationName.localizedValue" To sOperationNameLocalizedValue
Get ComStringOf Of hoJsonResponse "value[i].properties.statusCode" To sPropertiesStatusCode
Get ComStringOf Of hoJsonResponse "value[i].status.value" To sStatusValue
Get ComStringOf Of hoJsonResponse "value[i].status.localizedValue" To sStatusLocalizedValue
Get ComStringOf Of hoJsonResponse "value[i].subStatus.value" To sSubStatusValue
Get ComStringOf Of hoJsonResponse "value[i].subStatus.localizedValue" To sSubStatusLocalizedValue
Get ComStringOf Of hoJsonResponse "value[i].eventTimestamp" To sEventTimestamp
Get ComStringOf Of hoJsonResponse "value[i].submissionTimestamp" To sSubmissionTimestamp
Get ComStringOf Of hoJsonResponse "value[i].subscriptionId" To sSubscriptionId
Move (i + 1) To i
Loop
End_Procedure