DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Building a Real-Time Alerting Solution With Zero Code
  • Microsoft Azure Event Hubs
  • Data Mining in IoT: From Sensors to Insights
  • Self-Hosted Gateway Design Patterns Discussion

Trending

  • Chat With Your Knowledge Base: A Hands-On Java and LangChain4j Guide
  • MCP Servers: The Technical Debt That Is Coming
  • GitHub Copilot's New AI Coding Agent Saves Developers Time – And Requires Their Oversight
  • The Future of Java and AI: Coding in 2025
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Getting Started With Azure Event Grid Viewer

Getting Started With Azure Event Grid Viewer

In the article, we will go to the next step to create a subscription and use webhook event handlers to view those logs in our Azure web application.

By 
Sarthak Vijayvergiya user avatar
Sarthak Vijayvergiya
·
Sep. 17, 20 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
3.9K Views

Join the DZone community and get the full member experience.

Join For Free

In the last article, we had a look at how to start with  Azure DevOps: Getting Started With Audit Streaming With Event Grid

In the article, we will go to the next step to create a subscription and use webhook event handlers to view those logs in our Azure web application.

Azure DevOps Audit Logs Event Grid Viewer

Azure Event Grid  helps you to build event-driven architecture based applications and serverless applications. The event grid supports built-in azure resource events and own events using the custom topics.

Terminologies Used in Azure Event Grid:

  1. Events: What occurs
  2. Events source: Where it occurs
  3. Topic: Where event gird received the events
  4. Event Subscription: Build-in a mechanism where we define route mapping of events to the event handlers, we can also define filter expression to filters events.
  5. Event Handler: There are predefined event handlers available that received the events after we create a subscription

Event Grid Security:

Here we are going to use ValidationCode handshake when we will create a subscription, the event grid will send the validation request to the webhook. It will consist same schema body and it includes validationCode property inside the data portion, the application will verify the request.

An Example of SubscriptionValidationEvent Is Shown in the Following Example:

JSON
 




x
30


 
1
[
2
  {
3
    "id": "2d1781af-3a4c-4d7c-bd0c-e34b19da4e66",
4
    "topic": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
5
    "subject": "",
6
    "data": {
7
      "validationCode": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6",
8
      "validationUrl": "https://rp-eastus2.eventgrid.azure.net:553/eventsubscriptions/estest/validate?id=512d38b6-c7b8-40c8-89fe-f46f9e9622b6&t=2018-04-26T20:30:54.4538837Z&apiVersion=2018-05-01-preview&token=1A1A1A1A"
9
    },
10
    "eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
11
    "eventTime": "2018-01-25T22:12:19.4556811Z",
12
    "metadataVersion": "1",
13
    "dataVersion": "1"
14
  }
15
]



To Validate the Ownership We Need to Send Back the ValidaitonCode in ValidationReponse Property.

JSON
 




xxxxxxxxxx
1


 
1
{
2
  "validationResponse": "512d38b6-c7b8-40c8-89fe-f46f9e9622b6"
3
}



In This Demo, You Will Get To Learn the Following Topics:

  1. Deploy azure resource from a custom deployment template.
  2. Configure Azure DevOps to receive Audit Events in Event Grid Topic.
  3. Create an event grid topic subscription.
  4. Deploy azure resource from a custom deployment template.
  5. Azure DevOps Audit Logs Viewer.

Deploy Azure Resources From a Custom Deployment Template

  1. Login to azure portal https://portal.azure.com.
  2. Let’s deploy azure resources from a custom deployment template click on this link.
  3. Fill all the required details, make sure to note down the azure resource group name, event grid topic name, app site name.
  4. This will be your site link https://{siteName}.azurewebsites.net

Configure Azure DevOps to Receive Audit Events in Event Grid Topic

  1. Follow the steps from here
  2. Get event grid topic URL and access keys from event grid topic
  3. Create an azure event grid stream in the azure DevOps auditing section and paste the above URL and access key.

Create an Event Grid Topic Subscription

There are multiple options available to create a subscription for an event grid topic in the following demo we will be going to use the bash shell.

  1. Log in to the Azure portal https://portal.azure.com.
  2. Launch Cloud Shellin the Azure portal and must select bash, all the below commands should be executed in the bash shell.
    1. azure cloud
  3. Fetch subscription id from this command and noted down for further use.
    1.  “az account show --subscription "" | jq -r '.id'”
  4. We need a resource group and event grid topic name that we noted down when we deployed the azure resources.
  5. The webhook endpoint is {siteLink}/api/trigger.
  6. In the below command all the variables are repressed by $variableName ($subscriptionId, $resourceGroupName, $myTopicName, $webhookEndpoint) just replace with the values you fetch in the above steps and get executed in the bash shell this will create an event grid topic subscription.

az eventgrid event-subscription create --source-resource-id /

"/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.EventGrid/topics/$myTopicName" \

 --name demoViewerSub \

 --endpoint $webhookEndpoint

Azure DevOps Audit Logs Viewer

Have a look at your site link https://{siteName}.azurewebsites.net

azure devops

Today we learned about the event grid custom topic, subscription, and event grid viewer.

Event azure

Opinions expressed by DZone contributors are their own.

Related

  • Building a Real-Time Alerting Solution With Zero Code
  • Microsoft Azure Event Hubs
  • Data Mining in IoT: From Sensors to Insights
  • Self-Hosted Gateway Design Patterns Discussion

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!