Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use ARM to create EventGridTrigger subscription #9

Open
jwendl opened this issue Jul 6, 2018 · 1 comment
Open

Can't use ARM to create EventGridTrigger subscription #9

jwendl opened this issue Jul 6, 2018 · 1 comment

Comments

@jwendl
Copy link
Owner

jwendl commented Jul 6, 2018

Right now we can't have a function generate the systemkey needed in order to do an EventGrid subscription via ARM (similar to below)

    {
      "name": "[concat(parameters('eventGridTopicName'), '/Microsoft.EventGrid/RegistrationSubscription')]",
      "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
      "location": "[resourceGroup().location]",
      "apiVersion": "2018-01-01",
      "properties": {
        "destination": {
          "endpointType": "WebHook",
          "properties": {
            "endpointUrl": "[concat('https://', parameters('functionsApiAppName'), '.azurewebsites.net/runtime/webhooks/EventGridExtensionConfig?functionName=RegistrationConsumer&code=', listSecrets(resourceId('Microsoft.Web/sites/functions', parameters('functionsApiAppName'), 'RegistrationConsumer'), '2018-02-01').key)]"
          }
        },
        "filter": {
          "subjectEndsWith": "registration"
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('functionsApiAppName'))]",
        "[resourceId('Microsoft.Web/sites/sourcecontrols', parameters('functionsApiAppName'), 'web')]"
      ]
    },
    {
      "name": "[concat(parameters('eventGridTopicName'), '/Microsoft.EventGrid/SendEventConsumer')]",
      "type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
      "location": "[resourceGroup().location]",
      "apiVersion": "2018-01-01",
      "properties": {
        "destination": {
          "endpointType": "WebHook",
          "properties": {
            "endpointUrl": "[concat('https://', parameters('functionsApiAppName'), '.azurewebsites.net/runtime/webhooks/EventGridExtensionConfig?functionName=SendEventConsumer&code=', listSecrets(resourceId('Microsoft.Web/sites/functions', parameters('functionsApiAppName'), 'SendEventConsumer'), '2018-02-01').key)]"
          }
        },
        "filter": {
          "subjectEndsWith": "event"
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('functionsApiAppName'))]",
        "[resourceId('Microsoft.Web/sites/sourcecontrols', parameters('functionsApiAppName'), 'web')]"
      ]
    }

Because of this we will have to use Azure CLI instead...

az eventgrid event-subscription create -g $resourceGroupName -n RegistrationConsumer --endpoint "https://$functionName.azurewebsites.net/runtime/webhooks/EventGridExtensionConfig?functionName=RegistrationConsumer&code=$masterKey"
az eventgrid event-subscription create -g $resourceGroupName -n SendEventConsumer --endpoint "https://$functionName.azurewebsites.net/runtime/webhooks/EventGridExtensionConfig?functionName=SendEventConsumer&code=$masterKey"
@jwendl
Copy link
Owner Author

jwendl commented Jul 6, 2018

Creating a "generate.sh" for folks to run after the "Deploy to Azure" button is clicked... Maybe could have them run from cloud shell?

jwendl added a commit that referenced this issue Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant