Forum Discussion

sshoaib's avatar
sshoaib
Copper Contributor
Aug 17, 2023
Solved

Issues with creatin event grid subscription for Keyvault notifications using bicep

Invalid event subscription request: Supplied URL is invalid. It cannot be null or empty and should be a proper HTTPS URL like https://www.example.com."}]}}

 

Getting the above when trying to create a deployment for this below code:

resource systemTopics_keyvault_resource 'Microsoft.EventGrid/systemTopics@2023-06-01-preview' = {
name: systemTopics_keyvault
location: location
properties: {
source: keyvault_externalid
topicType: 'microsoft.keyvault.vaults'
}
}

resource event_Subscription_keyvault 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2023-06-01-preview' = {
parent: systemTopics_keyvault_resource
name: event_subscription_name
properties: {
destination: {
properties: {
maxEventsPerBatch: 1
preferredBatchSizeInKilobytes: 64
}
endpointType: 'WebHook'
}
filter: {
includedEventTypes: [
'Microsoft.KeyVault.CertificateExpired'
'Microsoft.KeyVault.CertificateNearExpiry'
'Microsoft.KeyVault.CertificateNewVersionCreated'
'Microsoft.KeyVault.KeyExpired'
'Microsoft.KeyVault.KeyNearExpiry'
'Microsoft.KeyVault.KeyNewVersionCreated'
'Microsoft.KeyVault.SecretExpired'
'Microsoft.KeyVault.SecretNearExpiry'
'Microsoft.KeyVault.SecretNewVersionCreated'
]
}
eventDeliverySchema: 'EventGridSchema'
retryPolicy: {
maxDeliveryAttempts: 30
eventTimeToLiveInMinutes: 1440
}
}
}

 

End Goal is to have a logic app trigger the event of keyvaults to send email/via pagerduty

Thanks

  • ok I think I have fixed this

    When invoking a log app say via Event Grid ( endpointType: 'WebHook'), we need to specify endpointUrl.

     

    However in bicep using list call back url results in error. When looking at an existing event subscription the exact Logic app url is not reflected.

    I ended up adding the trigger webhook to the endpointUrl and it worked.

    This is not documented anywhere.

    Hope this helps someone

     

1 Reply

  • sshoaib's avatar
    sshoaib
    Copper Contributor

    ok I think I have fixed this

    When invoking a log app say via Event Grid ( endpointType: 'WebHook'), we need to specify endpointUrl.

     

    However in bicep using list call back url results in error. When looking at an existing event subscription the exact Logic app url is not reflected.

    I ended up adding the trigger webhook to the endpointUrl and it worked.

    This is not documented anywhere.

    Hope this helps someone

     

Resources