Gatling jsonpath, save value - jsonpath

I have a json response I want to obtain a value from looking like this:
{
"resourceType": "Parameters",
"parameter": [
{
"name": "medication",
"resource": {
"resourceType": "Bundle",
"id": "cfa4fa3c-0e34-431c-ac0d-91653ebda972",
"meta": {
"lastUpdated": "2022-09-23T11:37:49.6022504+02:00",
"source": "http://xxx.xxx/Patient/$getMedication",
"profile": [
"http://xxxStructureDefinition/sfm-MedicationBundle"
]
},
"type": "document",
"timestamp": "2022-09-23T11:37:49.6022471+02:00",
"total": 6,
"link": [
{
"relation": "self",
"url": "http://xxx/Patient/$getMedication"
}
],
"entry": [
{
"fullUrl": "urn:uuid:fbb2bd18-a1c3-4f95-8384-d520fba283a5",
"resource": {
"resourceType": "Composition",
"id": "dfc4f003-4eb6-4802-8b8a-d2d53cf7698c",
"meta": {
"profile": [
"http://xxx/StructureDefinition/sfm-MedicationComposition"
]
},
"identifier": {
"use": "official",
"value": "28c2ae8d-39ed-4054-af46-22bc8c2c1e4a"
},
"status": "final",
"type": {
"coding": [
{
"system": "http://loinc.org",
"code": "11503-0",
"display": "Medical records"
}
]
},
"subject": {
"reference": "urn:uuid:67bb77c3-55dc-4643-b334-7f95e38bcf2f",
"type": "http://xxx/StructureDefinition/sfm-Patient",
"display": "Patient 05129997836"
},
"date": "2022-09-23",
"author": [
{
"reference": "urn:uuid:a443c8b2-a45a-4bad-baa6-f38904363673",
"type": "http://xxx/StructureDefinition/sfm-Practitioner",
"display": "xxx xxx, HPR: xxx"
}
],
"title": "Medication summary",
"confidentiality": "N",
"section": [
{
"title": "Medication",
"code": {
"coding": [
{
"system": "http://xxx/CodeSystem/sfm-section-types",
"code": "sectionMedication",
"display": "List of Medication statements"
}
]
},
"text": {
"status": "generated",
"div": "<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">List of medications</xhtml:div>"
},
"entry": [
{
"reference": "urn:uuid:8c714f72-0c90-403d-9e80-b08c61f82068",
"type": "http://xxx/fhir/StructureDefinition/sfm-MedicationStatement",
"display": "Paracetamol tab 1 g"
}
]
},
{
"title": "PllInfo",
"code": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-section-types",
"code": "sectionPLLinfo",
"display": "PLL Info"
}
]
},
"text": {
"status": "generated",
"div": "<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">Nil Known</xhtml:div>"
},
"emptyReason": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/list-empty-reason",
"code": "nilknown",
"display": "Nil Known"
}
],
"text": "Nil Known"
}
},
{
"title": "Allergies",
"code": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-section-types",
"code": "sectionAllergies",
"display": "Section allergies"
}
]
},
"text": {
"status": "generated",
"div": "<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">Nil Known</xhtml:div>"
},
"emptyReason": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/list-empty-reason",
"code": "nilknown",
"display": "Nil Known"
}
],
"text": "Nil Known"
}
},
{
"title": "Other Prescriptions",
"code": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-section-types",
"code": "sectionOtherPrescriptions",
"display": "List of non medical prescriptions"
}
]
},
"text": {
"status": "generated",
"div": "<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">Nil Known</xhtml:div>"
},
"emptyReason": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/list-empty-reason",
"code": "nilknown",
"display": "Nil Known"
}
],
"text": "Nil Known"
}
}
]
}
},
{
"fullUrl": "urn:uuid:a443c8b2-a45a-4bad-baa6-f38904363673",
"resource": {
"resourceType": "Practitioner",
"id": "1571880245",
"meta": {
"profile": [
"http://xxx/fhir/StructureDefinition/sfm-Practitioner"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://hl7.no/fhir/NamingSystem/HPR",
"code": "HPR-nummer"
}
]
},
"system": "urn:oid:2.16.578.1.12.4.1.4.4",
"value": "10055817"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://hl7.no/fhir/NamingSystem/FNR",
"code": "FNR-nummer"
}
]
},
"system": "urn:oid:2.16.578.1.12.4.1.4.1",
"value": "10099205569"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "xxx",
"given": [
"xxx"
]
}
],
"gender": "male",
"birthDate": "1992-09-10"
}
},
{
"fullUrl": "urn:uuid:67bb77c3-55dc-4643-b334-7f95e38bcf2f",
"resource": {
"resourceType": "Patient",
"id": "873788333",
"meta": {
"profile": [
"http://xxx/fhir/StructureDefinition/sfm-Patient"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://hl7.no/fhir/NamingSystem/FNR",
"code": "FNR-nummer"
}
]
},
"system": "urn:oid:2.16.578.1.12.4.1.4.1",
"value": "05129997836"
}
],
"active": true,
"name": [
{
"family": "05129997836",
"given": [
"Patient"
]
}
],
"gender": "female",
"birthDate": "1999-12-05",
"address": [
{
"type": "postal",
"text": "Autoveien 1",
"city": "Oslo",
"postalCode": "0150"
}
]
}
},
{
"fullUrl": "urn:uuid:f4c95e15-8e9f-416a-83c7-3a6847d69278",
"resource": {
"resourceType": "Practitioner",
"id": "1215535826",
"meta": {
"profile": [
"http://xxx/fhir/StructureDefinition/sfm-Practitioner"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://hl7.no/fhir/NamingSystem/HPR",
"code": "HPR-nummer"
}
]
},
"system": "urn:oid:2.16.578.1.12.4.1.4.4",
"value": "1010038"
}
],
"active": true,
"name": [
{
"extension": [
{
"url": "http://hl7.no/fhir/StructureDefinition/no-basis-middlename",
"valueString": "Psa"
}
],
"use": "official",
"family": "xx",
"given": [
"xx"
]
}
],
"gender": "male"
}
},
{
"fullUrl": "urn:uuid:4b4de0ae-3f2d-4030-a193-26713cf30260",
"resource": {
"resourceType": "Medication",
"id": "667718723",
"meta": {
"profile": [
"http://xxx/fhir/StructureDefinition/sfm-Medication"
]
},
"extension": [
{
"extension": [
{
"url": "prescriptiongroup",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.7421",
"code": "C",
"display": "Reseptgruppe C"
}
]
}
}
],
"url": "http://hl7.no/fhir/StructureDefinition/no-basis-prescriptiongroup"
},
{
"extension": [
{
"url": "registreringstype",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-festregistrationtype",
"code": "1",
"display": "Legemiddelvirkestoff"
}
]
}
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-medicationdetails"
}
],
"identifier": [
{
"use": "official",
"type": {
"text": "identifier"
},
"value": "ID_DF40453A-DAD1-450D-A58D-0FE411DCDB05"
}
],
"code": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/FEST",
"code": "ID_DF40453A-DAD1-450D-A58D-0FE411DCDB05",
"display": "Paracetamol tab 1 g"
},
{
"system": "http://www.whocc.no/atc",
"code": "N02BE01",
"display": "Paracetamol"
}
]
},
"status": "active",
"form": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.7448",
"code": "53",
"display": "Tablett"
}
]
}
}
},
{
"fullUrl": "urn:uuid:8c714f72-0c90-403d-9e80-b08c61f82068",
"resource": {
"resourceType": "MedicationStatement",
"id": "1850837775",
"meta": {
"profile": [
"http://xxx/fhir/StructureDefinition/sfm-MedicationStatement"
]
},
"extension": [
{
"extension": [
{
"url": "reseptdate",
"valueDate": "2022-09-21"
},
{
"url": "expirationdate",
"valueDate": "2023-09-20"
},
{
"url": "festUpdate",
"valueDateTime": "2022-08-25T13:54:02+00:00"
},
{
"url": "dssn",
"valueString": "1 tablett morgen daglig"
},
{
"url": "amount",
"valueQuantity": {
"value": 92.0,
"unit": "stk"
}
},
{
"url": "reit",
"valueString": "3"
},
{
"url": "itemgroup",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.7402",
"code": "L",
"display": "Legemiddel"
}
]
}
},
{
"extension": [
{
"url": "starttime",
"valueDate": "2022-09-21"
},
{
"extension": [
{
"url": "amount",
"valueQuantity": {
"value": 1.0,
"unit": "tablett"
}
},
{
"url": "interval",
"valueQuantity": {
"value": 1.0,
"unit": "Døgn"
}
},
{
"url": "accurate",
"valueBoolean": false
},
{
"url": "timerange",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.8325",
"code": "1",
"display": "Morgen"
}
]
}
}
],
"url": "repeatingdosage"
}
],
"url": "ereseptdosing"
},
{
"extension": [
{
"url": "status",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.7408",
"code": "E",
"display": "Ekspederbar"
}
]
}
}
],
"url": "rfstatus"
},
{
"url": "typeresept",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.7491",
"code": "E",
"display": "Eresept"
}
]
}
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-reseptamendment"
},
{
"extension": [
{
"url": "status",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-medicationstatement-registration-status",
"code": "3",
"display": "Godkjent"
}
]
}
},
{
"url": "type",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-performer-roles",
"code": "1",
"display": "Forskrevet av"
}
]
}
},
{
"url": "provider",
"valueReference": {
"reference": "urn:uuid:f4c95e15-8e9f-416a-83c7-3a6847d69278",
"type": "http://xxx/fhir/StructureDefinition/sfm-Practitioner",
"display": "Bjørn Psa Visjon, HPR: 1010038"
}
},
{
"url": "timestamp",
"valueDateTime": "2022-09-21T16:10:25.5229768+02:00"
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-regInfo"
},
{
"extension": [
{
"url": "genericSubstitutionAccepted",
"valueBoolean": true
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-generic-substitution"
},
{
"extension": [
{
"url": "nocombination",
"valueBoolean": false
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-administration"
}
],
"identifier": [
{
"use": "usual",
"type": {
"text": "ReseptId"
},
"value": "1dfa55d7-674d-4fc8-a182-1fbd3b2faa6a"
}
],
"status": "active",
"medicationReference": {
"reference": "urn:uuid:4b4de0ae-3f2d-4030-a193-26713cf30260",
"type": "http://xxx/fhir/StructureDefinition/sfm-Medication",
"display": "Paracetamol tab 1 g"
},
"subject": {
"reference": "urn:uuid:67bb77c3-55dc-4643-b334-7f95e38bcf2f",
"type": "http://xxx/fhir/StructureDefinition/sfm-Patient",
"display": "Patient 05129997836"
},
"dosage": [
{
"extension": [
{
"url": "http://xxx/fhir/StructureDefinition/sfm-use",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.578.1.12.4.1.1.9101",
"code": "1",
"display": "Fast"
}
]
}
},
{
"extension": [
{
"url": "text",
"valueString": "MOT SMERTER"
}
],
"url": "http://xxx/fhir/StructureDefinition/sfm-application-area"
}
],
"sequence": 1,
"text": "1 tablett morgen daglig"
}
]
}
}
]
}
},
{
"name": "KJHentetTidspunkt",
"valueDateTime": "2022-09-23T09:37:49.55+00:00"
},
{
"name": "RFHentetTidspunkt",
"valueDateTime": "2022-09-23T11:37:49.027+02:00"
},
{
"name": "KJFeilkode",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-kj-rf-error-code",
"code": "0"
}
],
"text": "OK"
}
},
{
"name": "RFM96Feilkode",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-kj-rf-error-code",
"code": "0"
}
],
"text": "OK"
}
},
{
"name": "RFM912Feilkode",
"valueCodeableConcept": {
"coding": [
{
"system": "http://xxx/fhir/CodeSystem/sfm-kj-rf-error-code",
"code": "0"
}
],
"text": "OK"
}
},
{
"name": "KJHarLegemidler",
"valueBoolean": false
},
{
"name": "KJHarLaste",
"valueBoolean": false
},
{
"name": "RFHarLaste",
"valueBoolean": false
}
]
}
The value I am looking for is the "fullUrl", as in urn:uuid:fbb2bd18-a1c3-4f95-8384-d520fba283a5
I tried to use this jsonpath expression:
.check(jsonPath("$..[?(#.resourceType=="Bundle")].entry.fullUrl").saveAs("fullUrl"))
However it says
jsonPath($..[?(#.resourceType=="Bundle")].entry.fullUrl).find. exists, found nothing
How can I construct an experssion to obtain the fullUrl?

It's because entry is array. So you have two options how to extract the value.
You can get all fullUrl values and then obtain via Gatling EL:
jsonPath("$..[?(#.resourceType=='Bundle')].entry..fullUrl").findAll.saveAs("fullUrls")
And then just get by index #{fullUrls(0)} (Documentation)
Or get by index in the json path:
|
|
ᐯ
jsonPath("$..[?(#.resourceType=='Bundle')].entry.[0].fullUrl").findAll.saveAs("fullUrl")

Related

Sabre BargainFinderMax REST API ResponseType field not working properly

Checking the BFM v4 Rest API docs we find that we can set a 'ResponseType' field to decide how the response will be formatted.
However, when testing this in Postman, we found some oddities. A request with the following Body to the endpoint /v4/offers/shop:
{
"OTA_AirLowFareSearchRQ": {
"POS": {
"Source": [
{
"PseudoCityCode": "{{pcc}}",
"RequestorID": {
"ID": "1",
"Type": "1",
"CompanyName": {
"Code": "TN",
"CodeContext": "TN"
}
}
}
]
},
"OriginDestinationInformation": [
{
"TPA_Extensions": {
"SegmentType": { "Code": "O"}
},
"RPH": "1",
"Fixed": false,
"DepartureDateTime": "{{start_date}}T11:00:00",
"OriginLocation": {
"AllAirports": false,
"LocationCode": "MIA",
"CodeContext": "IATA"
},
"DestinationLocation": {
"AllAirports": false,
"LocationCode": "MCO",
"CodeContext": "IATA"
}
}
],
"TravelPreferences": {
"CabinPref": [
{
"Cabin": "Y",
"PreferLevel": "Preferred"
}
],
"LookForAlternatives": false,
"TPA_Extensions": {
"TripType": { "Value": "OneWay" },
"JumpCabinLogic": { "Disabled": false },
"KeepSameCabin": { "Enabled": true },
"DiversityParameters": {
"AdditionalNonStopsNumber": 30
},
"ExcludeVendorPref": [
{
"Code": "G3"
}
]
},
"ETicketDesired": false,
"Hybrid": true,
"ValidInterlineTicket": true
},
"TravelerInfoSummary": {
"AirTravelerAvail": [
{
"PassengerTypeQuantity": [
{
"Code": "ADT",
"Quantity": 1,
"TPA_Extensions": {
"VoluntaryChanges": {
"Match": "Any"
}
}
}
]
}
],
"PriceRequestInformation": {
"NegotiatedFareCode": [],
"AccountCode": [{ "Code": "PROMAO" }],
"CurrencyCode": "BRL",
"TPA_Extensions": {
"BrandedFareIndicators": {
"SingleBrandedFare": true,
"MultipleBrandedFares": true
},
"Indicators": {
"MinMaxStay": { "Ind": true },
"RefundPenalty": { "Ind": true },
"ResTicketing": { "Ind": true }
},
"Priority": {
"Price": { "Priority": 1 },
"DirectFlights": { "Priority": 2 },
"Time": { "Priority": 3 },
"Vendor": { "Priority": 4 }
}
}
}
},
"TPA_Extensions": {
"IntelliSellTransaction": {
"RequestType": { "Name": "50ITINS" },
"CompressResponse": {
"Value": false
}
},
"AlternateAirportMileage": {
"Number": "25"
}
},
"DirectFlightsOnly": false,
"ResponseType": "OTA",
"SeparateMessages": false,
"Version": "v4"
}
}
produces a response in the GroupedItineraries format ("GIR" value), which is an undesired behavior for us.
Weirdly, the API accepts any string to this field 'ResponseType', not indicating any misuse, but always returning the GroupedItineraries format. The response contains the following messages:
{
"groupedItineraryResponse": {
"version": "6.5.2",
"messages": [
{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL549.ATSE.CERT.ASCINT.SABRECIRRUS.COM",
"text": "27138"
},
{
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "7100110708344235563"
},
{
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "18411"
},
{
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25916"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [FLL]-[ISM]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [MIA]-[ISM]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [OPF]-[ISM]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [OPF]-[MCO]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [OPF]-[ORL]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [TMB]-[ISM]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [TMB]-[MCO]"
},
{
"severity": "Info",
"type": "SCHEDULES",
"code": "MSG",
"text": "NO FLIGHT SCHEDULES FOR JOURNEY 2022-06-24 [TMB]-[ORL]"
}
] ...
Informing that there's no support for OTA using REST, the REST service answers will always be on GIR format.
Best regards.

Why is watcher giving errors?

I want to send slack notifications to a channel as soon as any log with loglevel ERROR appears in my index. I have configured watcher in the following way but it is giving me errors. The slack message must have the log message.
I am not able to configure this exactly.
{
"trigger": {
"schedule": {
"interval": "10s"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"index-log*",
"index-beat*"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"match": {
"loglevel": "ERROR"
},
"range": {
"#timestamp": {
"from": "{{ctx.trigger.scheduled_time}}||-5m",
"to": "{{ctx.trigger.triggered_time}}"
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"send_trigger": {
"webhook": {
"scheme": "https",
"host": "hooks.slack.com",
"port": 443,
"method": "post",
"path": "/services/XXXX/XXXX/XXXX",
"params": {},
"headers": {
"Content-type": "application/json"
},
"body": """{ "text": "{{ctx.payload}}"}"""
}
}
}
}
below is the structure of my logs in kibana
{
"_index": "index-beat",
"_type": "_doc",
"_id": "P3Toa34B1LVeuWotaVOY",
"_version": 1,
"_score": 1,
"_source": {
"#timestamp": "2022-01-18T06:38:19.559Z",
"name": "communication",
"loglevel": "ERROR",
"log": {
"file": {
"path": "/home/ubuntu/abc/abc/logs/communication.log"
},
"offset": 0
},
"timestamp": "2022-01-18T06:38:15.384279",
"exception": {
"ex_type": "None",
"ex": "None",
"tb": ""
},
"message": "{'err': 'Test'}"
},
"fields": {
"exception.ex_type": [
"None"
],
"loglevel.keyword": [
"ERROR"
],
"name.keyword": [
"communication"
],
"log.offset": [
0
],
"message": [
"{'err': 'Test'}"
],
"exception.tb": [
""
],
"exception.ex": [
"None"
],
"#timestamp": [
"2022-01-18T06:38:19.559Z"
],
"exception.tb.keyword": [
""
],
"loglevel": [
"ERROR"
],
"log.file.path": [
"/home/ubuntu/abc/abc/logs/communication.log"
],
"message.keyword": [
"{'err': 'Test'}"
],
"name": [
"communication"
],
"exception.ex_type.keyword": [
"None"
],
"exception.ex.keyword": [
"None"
],
"log.file.path.keyword": [
"/home/ubuntu/abc/abc/logs/communication.log"
],
"timestamp": [
"2022-01-18T06:38:15.384Z"
]
}
}
Please help me out in this one.

502 bad gateway error after installing WordPress and MySQL database on azure container instance in a virtual network

Following ARM template successfully deployed WordPress and MySQL database on the azure container instance in a virtual network but I'm facing 502 bad gateway error while updating WordPress. Also I'm get link expired when uploading theme of 30MB size.
azuredeploy.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vnetName": {
"type": "string",
"defaultValue": "aci-vnet",
"metadata": {
"description": "VNet name"
}
},
"vnetAddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"description": "Address prefix"
}
},
"subnet1AddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/24",
"metadata": {
"description": "Subnet prefix for ACI"
}
},
"subnet1Name": {
"type": "string",
"defaultValue": "aci-subnet",
"metadata": {
"description": "Subnet name for ACI"
}
},
"subnet2AddressPrefix": {
"type": "string",
"defaultValue": "10.0.1.0/24",
"metadata": {
"description": "Subnet prefix for application gateway"
}
},
"subnet2Name": {
"type": "string",
"defaultValue": "ag-subnet",
"metadata": {
"description": "Subnet name for application gateway"
}
},
"mysqlPassword": {
"type": "securestring",
"metadata": {
"description": "MySQL database password"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"storageAccountName": "[uniquestring(resourceGroup().id)]",
"storageAccountType": "Standard_LRS",
"publicIPAddressName": "publicIp1",
"publicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
"networkProfileName": "aci-networkProfile",
"interfaceConfigName": "eth0",
"interfaceIpConfig": "ipconfigprofile1",
"image": "microsoft/azure-cli",
"shareContainerGroupName": "createshare-containerinstance",
"wordpressContainerGroupName": "wordpress-containerinstance",
"mysqlContainerGroupName": "mysql-containerinstance",
"wordpressShareName": "wordpress-share",
"mysqlShareName": "mysql-share",
"cpuCores": "1.0",
"memoryInGb": "1.5",
"skuName": "Standard_Medium",
"capacity": "2",
"applicationGatewayName": "applicationGateway1",
"subnet2Ref": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnet2Name'))]",
"wordpressContainerGroupRef": "[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('wordpresscontainerGroupName'))]",
"mysqlContainerGroupRef": "[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('mysqlContainerGroupName'))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "2019-06-01",
"location": "[parameters('location')]",
"sku": {
"name": "[variables('storageAccountType')]"
},
"kind": "Storage",
"properties": {}
},
{
"apiVersion": "2020-05-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat('acisite', uniqueString(resourceGroup().id))]"
}
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('vnetName')]",
"apiVersion": "2020-05-01",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnet1Name')]",
"properties": {
"addressPrefix": "[parameters('subnet1AddressPrefix')]",
"serviceEndpoints": [
{
"service": "Microsoft.Storage",
"locations": [
"[parameters('location')]"
]
}
],
"delegations": [
{
"name": "DelegationService",
"properties": {
"serviceName": "Microsoft.ContainerInstance/containerGroups"
}
}
]
}
},
{
"name": "[parameters('subnet2Name')]",
"properties": {
"addressPrefix": "[parameters('subnet2AddressPrefix')]"
}
}
]
}
},
{
"name": "[variables('networkProfileName')]",
"type": "Microsoft.Network/networkProfiles",
"apiVersion": "2020-05-01",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
],
"properties": {
"containerNetworkInterfaceConfigurations": [
{
"name": "[variables('interfaceConfigName')]",
"properties": {
"ipConfigurations": [
{
"name": "[variables('interfaceIpConfig')]",
"properties": {
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnet1Name'))]"
}
}
}
]
}
}
]
}
},
{
"name": "[variables('shareContainerGroupName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2019-12-01",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
],
"properties": {
"containers": [
{
"name": "[variables('wordpressShareName')]",
"properties": {
"image": "[variables('image')]",
"command": [
"az",
"storage",
"share",
"create",
"--name",
"[variables('wordpressShareName')]"
],
"environmentVariables": [
{
"name": "AZURE_STORAGE_KEY",
"value": "[listKeys(variables('storageAccountName'),'2017-10-01').keys[0].value]"
},
{
"name": "AZURE_STORAGE_ACCOUNT",
"value": "[variables('storageAccountName')]"
}
],
"resources": {
"requests": {
"cpu": "[variables('cpuCores')]",
"memoryInGb": "[variables('memoryInGb')]"
}
}
}
},
{
"name": "[variables('mysqlShareName')]",
"properties": {
"image": "[variables('image')]",
"command": [
"az",
"storage",
"share",
"create",
"--name",
"[variables('mysqlShareName')]"
],
"environmentVariables": [
{
"name": "AZURE_STORAGE_KEY",
"value": "[listKeys(variables('storageAccountName'),'2017-10-01').keys[0].value]"
},
{
"name": "AZURE_STORAGE_ACCOUNT",
"value": "[variables('storageAccountName')]"
}
],
"resources": {
"requests": {
"cpu": "[variables('cpuCores')]",
"memoryInGb": "[variables('memoryInGb')]"
}
}
}
}
],
"restartPolicy": "OnFailure",
"osType": "Linux"
}
},
{
"name": "[variables('mysqlContainerGroupName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2019-12-01",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('shareContainerGroupName'))]",
"[resourceId('Microsoft.Network/networkProfiles/', variables('networkProfileName'))]"
],
"properties": {
"containers": [
{
"name": "mysql",
"properties": {
"image": "mysql:5.6",
"ports": [
{
"protocol": "Tcp",
"port": 3306
}
],
"environmentVariables": [
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "[parameters('mysqlPassword')]"
}
],
"volumeMounts": [
{
"mountPath": "/var/lib/mysql",
"name": "mysqlfile"
}
],
"resources": {
"requests": {
"cpu": "[variables('cpuCores')]",
"memoryInGb": "[variables('memoryInGb')]"
}
}
}
}
],
"volumes": [
{
"azureFile": {
"shareName": "[variables('mysqlShareName')]",
"storageAccountKey": "[listKeys(variables('storageAccountName'),'2017-10-01').keys[0].value]",
"storageAccountName": "[variables('storageAccountName')]"
},
"name": "mysqlfile"
}
],
"networkProfile": {
"Id": "[resourceId('Microsoft.Network/networkProfiles', variables('networkProfileName'))]"
},
"osType": "Linux"
}
},
{
"name": "[variables('wordpressContainerGroupName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2019-12-01",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('shareContainerGroupName'))]",
"[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('mysqlContainerGroupName'))]"
],
"properties": {
"containers": [
{
"name": "wordpress",
"properties": {
"image": "wordpress:4.9-apache",
"ports": [
{
"protocol": "Tcp",
"port": 80
}
],
"environmentVariables": [
{
"name": "WORDPRESS_DB_HOST",
"value": "[concat(reference(variables('mysqlContainerGroupRef')).ipAddress.ip, ':3306')]"
},
{
"name": "WORDPRESS_DB_PASSWORD",
"value": "[parameters('mysqlPassword')]"
}
],
"volumeMounts": [
{
"mountPath": "/var/www/html",
"name": "wordpressfile"
}
],
"resources": {
"requests": {
"cpu": "[variables('cpuCores')]",
"memoryInGb": "[variables('memoryInGb')]"
}
}
}
}
],
"volumes": [
{
"azureFile": {
"shareName": "[variables('wordpressShareName')]",
"storageAccountKey": "[listKeys(variables('storageAccountName'),'2017-10-01').keys[0].value]",
"storageAccountName": "[variables('storageAccountName')]"
},
"name": "wordpressfile"
}
],
"networkProfile": {
"Id": "[resourceId('Microsoft.Network/networkProfiles', variables('networkProfileName'))]"
},
"osType": "Linux"
}
},
{
"apiVersion": "2020-05-01",
"name": "[variables('applicationGatewayName')]",
"type": "Microsoft.Network/applicationGateways",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.ContainerInstance/containerGroups/', variables('wordpressContainerGroupName'))]"
],
"properties": {
"sku": {
"name": "[variables('skuName')]",
"tier": "Standard",
"capacity": "[variables('capacity')]"
},
"gatewayIPConfigurations": [
{
"name": "appGatewayIpConfig",
"properties": {
"subnet": {
"id": "[variables('subnet2Ref')]"
}
}
}
],
"frontendIPConfigurations": [
{
"name": "appGatewayFrontendIP",
"properties": {
"PublicIPAddress": {
"id": "[variables('publicIPRef')]"
}
}
}
],
"frontendPorts": [
{
"name": "appGatewayFrontendPort",
"properties": {
"Port": 80
}
}
],
"backendAddressPools": [
{
"name": "appGatewayBackendPool",
"properties": {
"BackendAddresses": [
{
"IpAddress": "[reference(variables('wordpressContainerGroupRef')).ipAddress.ip]"
}
]
}
}
],
"backendHttpSettingsCollection": [
{
"name": "appGatewayBackendHttpSettings",
"properties": {
"Port": 80,
"Protocol": "Http",
"CookieBasedAffinity": "Disabled"
}
}
],
"httpListeners": [
{
"name": "appGatewayHttpListener",
"properties": {
"FrontendIPConfiguration": {
"Id": "[resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', variables('applicationGatewayName'), 'appGatewayFrontendIP')]"
},
"FrontendPort": {
"Id": "[resourceId('Microsoft.Network/applicationGateways/frontendPorts', variables('applicationGatewayName'), 'appGatewayFrontendPort')]"
},
"Protocol": "Http"
}
}
],
"requestRoutingRules": [
{
"Name": "rule1",
"properties": {
"RuleType": "Basic",
"httpListener": {
"id": "[resourceId('Microsoft.Network/applicationGateways/httpListeners', variables('applicationGatewayName'), 'appGatewayHttpListener')]"
},
"backendAddressPool": {
"id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', variables('applicationGatewayName'), 'appGatewayBackendPool')]"
},
"backendHttpSettings": {
"id": "[resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', variables('applicationGatewayName'), 'appGatewayBackendHttpSettings')]"
}
}
}
]
}
}
],
"outputs": {
"SiteFQDN": {
"type": "string",
"value": "[reference(variables('publicIPRef')).dnsSettings.fqdn]"
}
}
}
azuredeploy.parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"mysqlPassword": {
"value": "GEN-PASSWORD"
}
}
}
Solution overview and deployed resources
The following resources are deployed as part of the solution
Azure Container Instance: Azure Container Instance to host the WordPress site.
Azure Container Instance: Azure Container Instance to host the MySQL database.
Azure Container Instance: A run-once Azure Container Instance, where the az-cli is executed to create the file shares
Storage Account: Storage account for the file shares to store the WordPress site content and MySQL database.
File share: Azure File shares to store WordPress site content and MySQL database.
Application gateway: Application gateway for WordPress site. It exposes public network access to WordPress site in VNet.
Virtual network: Virtual network for WordPress site, MySQL database, Application gateway.
One click deploy to Azure
Click here to deploy to Azure

I am creating events using microsoft graph (using .net sdk) and i found out that 2 events have same id with in a mailbox

Is this a valid scenario or a bug? Both the events are copied below.
{
"#odata.etag": "W/\"xyy/ioMMpU+5PhLPRGcb5AAAHWKktw==\"",
"id": "AAMkADZlNDUzMDYxLTQ2OTEtNDNiOC1hMDNhLTY1ZjAyMTYwZTBkOQBGAAAAAACPfBk217UgTYo6zKN7dzZsBwDHLL_KgwylT7k_Es9EZxvkAAAAAAENAADHLL_KgwylT7k_Es9EZxvkAAAdZ_YbAAA=",
"subject": "TestUtilityRunNow7_51",
"bodyPreview": "",
"body": {
"contentType": "html",
"content": "\r\n\r\n\r\n\r\n \r\n\r\n\r\n"
},
"start": {
"dateTime": "2019-03-08T12:57:15.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-03-08T13:02:15.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"attendees": [
{
"type": "resource",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Training Room",
"address": "trainingroom#wmexchangeid.onmicrosoft.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Ravinder Singh Chahal",
"address": "ravindersingh.chahal#wmexchangeid.onmicrosoft.com"
}
}
}
{
"#odata.etag": "W/\"xyy/ioMMpU+5PhLPRGcb5AAAHWKiVA==\"",
"id": "AAMkADZlNDUzMDYxLTQ2OTEtNDNiOC1hMDNhLTY1ZjAyMTYwZTBkOQBGAAAAAACPfBk217UgTYo6zKN7dzZsBwDHLL_KgwylT7k_Es9EZxvkAAAAAAENAADHLL_KgwylT7k_Es9EZxvkAAAdZ_YBAAA=",
"subject": "TestUtilityRunNow7_25",
"bodyPreview": "",
"body": {
"contentType": "html",
"content": "\r\n\r\n\r\n\r\n \r\n\r\n\r\n"
},
"start": {
"dateTime": "2019-03-08T12:30:59.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-03-08T12:35:59.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"attendees": [
{
"type": "resource",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Training Room",
"address": "trainingroom#wmexchangeid.onmicrosoft.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Ravinder Singh Chahal",
"address": "ravindersingh.chahal#wmexchangeid.onmicrosoft.com"
}
}
}

How do I pass RegistrationKey to Azure DSC extenstion

I have template below which errors out during deployment with error below. Samples on documentation page seems to be erroneous and don't even compile.
"message": "VM has reported a failure when processing extension
'Microsoft.Powershell.DSC'. Error message: \"The DSC Extension failed
to install: Invalid type for parameter RegistrationKey of type
PSCredential.\nMore information about the failure can be found in the
logs located under
'C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\2.74.0.0'
on the VM.\nTo retry install, please remove the extension from the VM
first. \"."
Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[parameters('swarmmanager1Name')]",
"type": "Microsoft.Compute/virtualMachines",
"location": "[resourceGroup().location]",
"apiVersion": "2015-06-15",
"tags": {
"displayName": "swarmmanager1"
},
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('swarmmanager1VmSize')]"
},
"licenseType": "[parameters('LicenseType')]",
"osProfile": {
"computerName": "[parameters('swarmmanager1Name')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('swarmmanager1ImagePublisher')]",
"offer": "[parameters('swarmmanager1ImageOffer')]",
"sku": "[parameters('windowsOSVersion')]",
"version": "latest"
},
"osDisk": {
"name": "swarmmanager1OSDisk",
"vhd": {
"uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts', parameters('dockerswarmstorageaccountName')), '2016-01-01').primaryEndpoints.blob, parameters('swarmmanager1StorageAccountContainerName'), '/', parameters('swarmmanager1OSDiskName'), '.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('swarmmanager1NicName'))]"
}
]
}
},
"resources": [
{
"name": "Microsoft.Powershell.DSC",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2015-06-15",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('swarmmanager1Name'))]"
],
"tags": {
"displayName": "DSC"
},
"properties": {
"publisher": "Microsoft.Powershell",
"typeHandlerVersion": "2.26",
"type": "DSC",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "[parameters('DSCExtensionManagerTagVersion')]",
"settings": {
"wmfVersion": "latest",
"configurationArguments": {
//"RegistrationKey": {
// "UserName": "PLACEHOLDER_DONOTUSE",
// "Password": "PrivateSettingsRef:registrationKeyPrivate"
// },
"RegistrationKey": "[parameters('RegistrationKey')]",
"RegistrationUrl": "[parameters('registrationUrl')]",
"NodeConfigurationName": "SwarmManager.localhost",
"RebootNodeIfNeeded": true
}
},
"protectedSettings": {
"Items": {
"registrationKeyPrivate": "[parameters('RegistrationKey')]"
}
}
}
}
]
},
{
"name": "[parameters('dockerswarmstorageaccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"location": "[resourceGroup().location]",
"apiVersion": "2016-01-01",
"sku": {
"name": "[parameters('dockerswarmstorageaccountType')]"
},
"dependsOn": [],
"tags": {
"displayName": "dockerswarmstorageaccount"
},
"kind": "Storage"
},
{
"name": "[parameters('swarmmanager1NicName')]",
"type": "Microsoft.Network/networkInterfaces",
"location": "[resourceGroup().location]",
"apiVersion": "2016-03-30",
"tags": {
"displayName": "swarmmanager1Nic"
},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[parameters('swarmmanager1SubnetRef')]"
},
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('swarmmanagerpublicIPName'))]"
}
}
}
]
}
},
{
"apiVersion": "2016-03-30",
"dependsOn": [],
"location": "[resourceGroup().location]",
"name": "[parameters('swarmmanagerpublicIPName')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[parameters('swarmmanagerpublicIPDnsName')]"
}
},
"tags": {
"displayName": "swarmmanagerpublicIP"
},
"type": "Microsoft.Network/publicIPAddresses"
}
],
"parameters": {
"swarmmanager1Name": { "type": "string" },
"swarmmanager1VmSize": { "type": "string" },
"adminUsername": { "type": "string" },
"adminPassword": { "type": "securestring" },
"dockerswarmstorageaccountName": { "type": "string" },
"dockerswarmstorageaccountType": { "type": "string" },
"swarmmanager1NicName": { "type": "string" },
"swarmmanagerpublicIPName": { "type": "string" },
"swarmmanager1SubnetRef": { "type": "string" },
"swarmmanager1ImagePublisher": { "type": "string" },
"swarmmanager1ImageOffer": { "type": "string" },
"windowsOSVersion": { "type": "string" },
"swarmmanager1StorageAccountContainerName": { "type": "string" },
"swarmmanager1OSDiskName": { "type": "string" },
"swarmmanagerpublicIPDnsName": { "type": "string" },
"DSCConfigurationURL": { "type": "string" },
"DSCExtensionManagerTagVersion": { "type": "string" },
"RegistrationKey": { "type": "securestring" },
"RegistrationUrl": { "type": "string" },
"LicenseType": {"type": "string"}
},
"outputs": {
"returnedIPAddress": {
"type": "string",
"value": "[reference(parameters('swarmmanager1NicName')).ipConfigurations[0].properties.privateIPAddress]"
}
}
}
if you want to pass in ps credentials do this:
"protectedSettings": {
"configurationArguments": {
"RegistrationKey": {
"userName": "whatever",
"password": "[parameters('RegistrationKey')]"
}
}
}

Resources