Azure IoT event subscription with ARM template - windows

I am trying to deploy Azure IoT device connected event subscription to Azure storage queue using ARM template and PowerShell. I have used the following template for deploying this. Also, I have read a lot of articles on Microsoft. But could not find any solution. Please help me to figure it out.
"resources": [
{
"type": "Microsoft.EventGrid/eventSubscriptions",
"name": "DeviceConnected",
"location": "[resourceGroup().location]",
"apiVersion": "2018-01-01",
"dependsOn": [
"[resourceId('Microsoft.Devices/IotHubs', variables('iotHubName'))]"
],
"properties": {
"destination": {
"endpointType": "storagequeue",
"properties": {
"queueName":"device-connnection-state-queue",
"resourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]"
}
},
"filter": {
"includedEventTypes": [
"Microsoft.Devices.DeviceConnected"
]
}
}
}
],
The error is showing like

The error you're seeing is related to the dependsOn property you've specified.
From MS documentation
Resources that must be deployed before this resource is deployed. Resource Manager evaluates the dependencies between resources and deploys them in the correct order. When resources aren't dependent on each other, they're deployed in parallel. The value can be a comma-separated list of a resource names or resource unique identifiers. Only list resources that are deployed in this template. Resources that aren't defined in this template must already exist. Avoid adding unnecessary dependencies as they can slow your deployment and create circular dependencies. For guidance on setting dependencies, see Defining dependencies in Azure Resource Manager templates.
So a resource that is not defined in an ARM template cannot be used in a DependsOn property.
Here is the documentation related to event subscription creation:
Microsoft.EventGrid eventSubscriptions template reference
There are not so much samples on how to create event subscription but you can extract some part of the template from the Azure Portal:
Click + Event Subscription
Fill in the details
Click the Advanced Editor button link on the top right corner
It will show you some of the details you need to create your ARM Template
Here is how a sample ARM template can look likes:
"resources": [
{
"type": "Microsoft.Devices/IotHubs/providers/eventSubscriptions",
"apiVersion": "2019-01-01",
"name": "[concat(parameters('iotHubName'), '/Microsoft.EventGrid/', parameters('eventSubName'))]",
"location": "[resourceGroup().location]",
"properties": {
"topic": "[resourceId('Microsoft.Devices/IotHubs', parameters('iotHubName'))]",
"destination": {
"endpointType": "StorageQueue",
"properties": {
"resourceId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
"queueName": "[parameters('queueName')]"
}
},
"filter": {
"includedEventTypes": [
"Microsoft.Devices.DeviceConnected"
],
"advancedFilters": []
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
}
}
]

Related

Search criteria for appointment slots in Epic FHIR

I'm using Epic's FHIR API (with Argonaut) to search for available appointments, in their private sandbox:
POST /api/FHIR/STU3/Appointment/$find
{
"resourceType": "Parameters",
"parameter": [
{
"name": "startTime",
"valueDateTime": "2022-03-22T08:15:00Z"
},
{
"name": "endTime",
"valueDateTime": "2022-04-02T08:15:00Z"
}
]
}
And this gives me some temporary appointments starting at the desired date and time. No problem. However, if I add service-type as a parameter in the body:
POST /api/FHIR/STU3/Appointment/$find
{
"resourceType": "Parameters",
"parameter": [
{
"name": "startTime",
"valueDateTime": "2022-03-23T15:30:00Z"
},
{
"name": "endTime",
"valueDateTime": "2022-04-02T15:30:00Z"
},
{
"name": "service-type",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:1.2.840.114350.1.13.861.1.7.3.808267.11",
"code": "40111223"
}
]
}
}
]
}
I get a slightly different response. I see temporary appointments with the same slot IDs (different appointment IDs of course), but also see an OperationOutcome at the end of the Bundle:
{
"fullUrl": "urn:uuid:00000000-0007-792f-cd9b-f1f44af2c17c",
"resource": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "value",
"details": {
"coding": [
{
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.657369",
"code": "59109",
"display": "An element value is invalid."
}
],
"text": "An element value is invalid."
},
"diagnostics": "1.2.840.114350.1.13.861.1.7.3.808267.11",
"location": [
"/f:service-type(oid)"
],
"expression": [
"service-type (oid)"
]
}
]
},
"search": {
"mode": "outcome"
}
}
The service-type system and code I used here were taken right from the example on Epic's page on the $find API. I see similar results when I use service-types from actual Slots in the Epic sandbox. And if I put in a location-reference, it seems to be ignored and appointments at other locations are sometimes returned. The net result of all this is that it seems only the start and end time are honored when finding appointments.
How can I narrow down the results of a $find call using criteria other than the start and end date?
The source of truth for this API should be the fhir.epic.com documentation, but since this is a common question, I'll post some information here:
$find is not a good option for patient open scheduling. I don't know if that is your use case or not, but it is a common question, so I'll address it anyway.
$find invokes a rules engine that is defined by each healthcare organization. The logic of that rules engine is 100% up to the healthcare organization to define. In order for $find to work for you, you'll need very specific pre-coordination to build the logic in that engine.
The Epic sandboxes only have a very basic rules engine built out. It isn't particularly "real-world"-y. And it is probably good that it isn't, as it serves as an early warning that this API may not be the API you are looking for.
The $find API is a way to support cross-organization scheduling. For example, if you want front desk staff to be able to schedule a follow up visit at another organization across town that they have an established business relationship. For example, if a PCP office wants to schedule a dermatology visit for you at an external org. Note that the user in this case is the organization's scheduling staff, not the patient.
Specifically, Epic's $find support is based on Use Case 1 and 2 in the Argonaut Implementation Guide.

FHIR - Contained Resources and Referencing

I am still new to FHIR and trying to connect the dots.
If I have a resource that I want to contain other resources, can I refer to it by element name (#myElementName) or do I need to use the contained resource id? (#myDeviceId).
I've included sample code below. What I would like to accomplish is to have a Basic resource that has two extensions: TestConfiguration(Device) and DigitalSample(ImagingStudy). I would like for both of these resources to be contained.
PS: I generated the code below using custom classes and the .net API.
Thank you much!
{
"resourceType": "TestInput",
"contained": [
{
"resourceType": "TestConfiguration",
"id": "TestConfigurationId",
"contained": [
{
"resourceType": "DeviceDefinition",
"modelNumber": "ABC123"
}
],
"definition": {
"reference": "#definition"
}
},
{
"resourceType": "DigitalSample",
"id": "DigitalSampleId"
}
],
"extension": [
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-TestConfiguration",
"valueReference": {
"reference": "#testConfiguration"
}
},
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-DigitalSample",
"valueReference": {
"reference": "#digitalSampleId"
}
}
]
}
Every local reference must point to an id of a contained resource.
In your case it should be:
"reference": "#TestConfigurationId"
"reference":"#DigitalSampleId"
Always check https://www.hl7.org/fhir/ for what you need to do. Always check the FHIR version

how to make callto: works in adaptive card

I am trying to initiate a call when pressing a button within an adaptive card (in microsoft teams)
I add URL as callto:[useremail]
eventhough when I write this in the search bar in chrome it works, but when pressing the button in the adaptive card it gives me an error on the chrome page.
any idea why might this happen?
Edit:
Here's a sample card of what I used:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"size": "small",
"style": "person",
"type": "Image",
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
"selectAction":{
"type": "Action.OpenUrl",
"url": "callto:rex#gmail.com"
}
}
]
}
]
}
]
}
]
}
It looks like links inside Teams don't support any protocols other than the usual HTTP/S. You can turn your callto link into an https link using a redirect URL service like these: https://www.cnet.com/news/10-links-to-shorten-your-links/
If you need to generate your callto links dynamically, I'm not sure how many of those services have API's your bot can use. TinyURL does though.
It's also pretty simple to just host your own redirection service in your own domain. You could even use the same domain that your bot is running on, so your link might end up looking something like this: https://rexbot.azurewebsites.net/api/callto/rex#gmail.com
Also, you might consider getting support for this from Teams directly. You can request that they support more URL protocols.

Azure Event Grid Subscriptions on custom topic in different resource group

I am trying to subscribe to a custom event grid topic that exists on a different resource group. For example if I have a custom event grid topic my-custom-topic in a resource group publisher-group. How do I create an event grid subscription to my topic from within the resource group subscriber-group?
The following ARM template only works if the my-custom-topic is in the same resource group that I am applying the template too
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"eventGridSubscriptionName": {
"type": "String",
"metadata": {
"description": "The name of the Event Grid custom topic's subscription."
}
},
"location": {
"defaultValue": "[resourceGroup().location]",
"type": "String",
"metadata": {
"description": "The location in which the Event Grid resources should be deployed."
}
}
},
"resources": [
{
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2018-01-01",
"name": "[concat('my-custom-topic', '/Microsoft.EventGrid/', parameters('eventGridSubscriptionName'))]",
"location": "[parameters('location')]",
"properties": {
"destination": {
"endpointType": "EventHub",
"properties": {
"resourceId": "..."
}
},
"filter": {
"includedEventTypes": [
"All"
]
}
}
}
]
}
If I change name to be a the full path of the topic (e.g. subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/resourceGroups/publisher-group/providers/Microsoft.EventGrid/topics/my-custom-topic) then the template complains I have too many segments
I would have thought this was a very common use case having topics and subscriptions in different resource groups but I am unable to find concrete examples of this
How do I create an ARM template to subscribe to an event grid topic on a different resource group?
This isn't possible - Event Grid Topics and Subscriptions have to be in the same resource group.
I would suggest creating a separate resource group just for containing your Event Grid Topic and all of it's Subscriptions.
Logically you shouldn't think of a single event publisher as owning the Event Grid Topic it publishes to - rather think of a Topic as a shared resource which many publishers and subscribers depend on.

Jira Trigger plugin for Jenkins: Obtaining Value from issue object

I'm trying to set up some automation using Jenkins and Jira Trigger plugin for Jenkins. I've set up a web hook at Jira side which is able to invoke build on Jenkins as desired.
I've a trouble with obtaining value for a custom field from incoming Jira request.
I'm trying to use "Issue Attribute Path" feature and I've also referred to post (How to use the 'Issue attribute path' in the parameter mapping of jenkins-trigger-plugin)
Howevevr I'm still unable to get value for custom fields customfield_10010, customfield_10011. I've tried with mapping like fields.customfield_10010, fields.customfield_10010.value, fields.customfield_10010.0.value,customfield_10010.0.value and similar combinations. I'm able to get value for other standard fields as suggested in plugin help. ex: status.name, description etc.
I could not get any clue from Jira documentation site either.
Parts of incoming json data is below for easy reference.
"issue": {
"id": "1000x",
"self": "http://localhost:3080/rest/api/2/issue/10007",
"key": "ABC-2",
"fields": {
"issuetype": {
..
},
"parent": {
..
},
"components": [
],
"timespent": null,
"timeoriginalestimate": 28800,
"description": ".....",
"project": {
..
},
"customfield_10010": [
{
"self": "http://localhost:3080/rest/api/2/customFieldOption/10019",
"value": "ABC-Custom 1",
"id": "10019"
}
],
"fixVersions": [
],
"customfield_10011": [
{
"self": "http://localhost:3080/rest/api/2/customFieldOption/10021",
"value": "ABC-Custom 2",
"id": "10021"
}
],
.....
....
....
}
}
You can get the value of a custom field with the following syntax:
fields.find { it.id == "customfield_10010" }.value
I had the same problem and found this solution here:
https://issues.jenkins-ci.org/browse/JENKINS-13216

Resources