<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arshad Badar Khan on Medium]]></title>
        <description><![CDATA[Stories by Arshad Badar Khan on Medium]]></description>
        <link>https://medium.com/@arshadbadarkhan?source=rss-10d171096c28------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q4ICfTJm8gqJMzugLUezzA.jpeg</url>
            <title>Stories by Arshad Badar Khan on Medium</title>
            <link>https://medium.com/@arshadbadarkhan?source=rss-10d171096c28------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:09:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arshadbadarkhan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Regulated Enterprises Can’t Ignore]]></title>
            <link>https://medium.com/@arshadbadarkhan/what-regulated-enterprises-cant-ignore-d5aec338ea8b?source=rss-10d171096c28------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5aec338ea8b</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <dc:creator><![CDATA[Arshad Badar Khan]]></dc:creator>
            <pubDate>Sun, 16 Aug 2026 01:27:14 GMT</pubDate>
            <atom:updated>2026-08-16T01:27:14.438Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oexcgt_LjbDhBp25" /></figure><p><em>Article 1 of a series on Kubernetes, Istio, C#/.NET, and Microsoft Entra ID — for architects who have to make this work, and then defend it in an audit.</em></p><p>You’re moving your web apps to Kubernetes. The kind of apps that ran happily on Windows servers for years. Back there, authentication was almost free. They sat inside the domain, Windows-integrated auth did the quiet work, LDAP answered “who is this and what can they do,” and nobody thought about it much.</p><p>Then you containerize it. The free lunch is over.</p><p>Kubernetes doesn’t know about your domain. A Linux container has no Windows-integrated anything. So the reflex kicks in: make each service talk to LDAP itself — bind, search, map groups to roles, repeat. It works on the first service. By the third, every service has its own auth code, its own claims mapping, its own private definition of a “role,” and its own quiet bugs. The same question — “who is this person, what are they allowed to do” — answered slightly differently in every service.</p><p>That’s not a microservice architecture. That’s a distributed monolith held together with auth tokens and prayer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ydERQPGMtrD4EDxZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gLSMNdcxuAhM_dUM" /></figure><p>Nobody designs it this way. It accretes. And here’s the part that bites later: none of it is visible from the outside. You can’t point at one place and say “this is how identity works.” It passes every demo. It’s what you’ll be sweating the week before the audit.</p><p>That gap — between “it works in the demo” and “it survives an audit” — is what this whole series is about. Call it the demo-to-audit gap. Most cloud content lives on the demo side. Regulated institutions live on the other one.</p><h3>The four questions, drawn once</h3><p>Strip away the tooling and every request into a regulated system has to answer four questions before it touches data. Not “should” — <em>has to</em>, because someone will eventually ask you to prove each one.</p><p>Who is the user? Is the workload making this call allowed to make it, and is the call encrypted end to end? Is this the least privilege that gets the job done? And — the one everyone forgets until the auditor arrives — can you prove all of the above actually happened, six months later, without editing a log?</p><p>The instinct is to answer those four questions in application code. That instinct is exactly how you end up with an LDAP client in every service. Identity, encryption, authorization, and audit are not business logic. They are infrastructure wearing a business-logic costume.</p><p>The service mesh is the argument that you should stop pretending otherwise.</p><h3>Why this bites enterprise institutions harder</h3><p>A consumer app that fumbles this ships a bug. A regulated institution that fumbles this fails an examination — and the clocks are unforgiving.</p><p>In India, CERT-In’s directions give you six hours from noticing a cyber incident to report it, with logs retained 180 days inside the country. Six hours is not a lot of time to reconstruct who called what if your audit trail is a dozen inconsistent log formats. Stack the DPDP Act’s breach-notification duty on top, the RBI IT Framework’s tier-wise obligations, payment-data localization — and “we’ll add proper logging later” stops being technical debt and becomes a regulatory one.</p><p>The Middle East tells the same story in a different accent. Saudi Arabia’s SAMA Cyber Security Framework grades you on a maturity model — you don’t pass once, you prove controls operate continuously. Add NCA’s controls and in-Kingdom data residency; in the UAE, CBUAE expectations and the DIFC and ADGM data-protection regimes, each with their own breach-notification duties. Different regulators, same demand: prove it, continuously, and don’t let the data leave the country to do so.</p><p>The uncomfortable truth: in this world you are not just securing the system. You are on a clock to <em>prove</em> what it did. Having mTLS and proving mTLS to an auditor are two different jobs, and only one of them shows up in the architecture diagram.</p><h3>How the pieces actually come together</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hc35fTQifvnNiBuL" /></figure><p>Two identity planes, and the trick is not confusing them.</p><p>Entra ID answers “who is the user.” End users, OIDC, JWTs, scopes, app roles. This is the human — or the app acting for a human — arriving at your edge.</p><p>Istio answers “who is the workload.” Pod A talking to Pod B, mutual TLS with certificates issued and rotated automatically, a cryptographic identity per service, and policy about which service may call which. No passwords in config. No service re-implementing anything.</p><p>The mesh terminates the user’s Entra token at the ingress gateway, enforces mTLS and authorization between every hop, and emits a uniform telemetry stream for all of it. Your service goes back to reading a validated principal and getting on with the business logic it was actually written for. Identity, encryption, and the audit trail move down, into the platform, implemented once instead of a dozen times.</p><p>That’s the whole pitch. Not “meshes are cool.” Answer the four questions once, in infrastructure, consistently, with evidence — instead of N times, in application code, inconsistently, with hope.</p><h3>The rebuttal I keep getting</h3><p>“Fine, but if Entra ID goes down, you’re just as stuck as when LDAP fell over. You’ve just moved the single point of failure.”</p><p>It’s a fair hit, and I won’t wave it away. Centralizing identity does concentrate risk. But the two failures are not the same animal.</p><p>LDAP-in-every-service was a <em>correctness</em> failure, spread thin. A dozen implementations meant a dozen chances to authorize someone who shouldn’t be — and the failure was invisible until it wasn’t. An Entra outage is an <em>availability</em> failure at a single, well-understood boundary. Availability is the kind of problem infrastructure engineers are actually good at: token lifetimes and caching so a blip doesn’t instantly lock the doors, mesh-level mTLS that keeps working service-to-service even when the user-identity provider is unreachable, sensible degraded modes, HA on the pieces you run yourself.</p><p>Concentrated-but-engineerable beats distributed-and-unknowable. I would rather defend one identity boundary I can reason about than a dozen I can’t. That’s not a religious position — it’s just the trade I’d make, and I’ll show the failure modes as we go so you can make your own.</p><h3>The alternatives, honestly</h3><p>A mesh is not the only answer, and it is not free.</p><p>Resilience libraries in-process (Polly and friends). No mesh, no sidecar, mTLS and retries as code. Genuinely simpler for a handful of services. It’s also how you get back to logic-smeared-everywhere the moment the fleet grows. Pick it when you have three services and no auditor.</p><p>Linkerd. Lighter than Istio, less to operate, deliberately fewer knobs. If you don’t need Istio’s authorization-policy and traffic-management surface, Linkerd will make your life quieter. Pick it when policy expressiveness isn’t the point.</p><p>Cilium’s eBPF mesh / Istio ambient mode. The sidecar-per-pod tax is real — I’ll die on that hill later in this series — and the sidecarless approaches are the industry’s answer to it. Worth watching hard; worth migrating to deliberately, not on day one.</p><p>The mesh earns its complexity when you have many services, real compliance pressure, and a need to prove things. If you have none of those, a mesh is a very expensive security guard for a building with nothing in it.</p><blockquote><em>Security · Audit · Integration — the through-line for this series</em></blockquote><h3>The vocabulary we’ll build — a glossary, and a teaser</h3><p>You don’t need all of this today. It’s the map of where we’re going. Skim it now; each line gets its own article as the series unfolds.</p><h3>The platform</h3><ul><li>Kubernetes (K8s): the system that runs your containers and keeps them running. The “where.”</li><li>Pod: the smallest thing Kubernetes schedules — one or more containers that live and die together.</li><li>Control plane: the brain that decides what runs where. You talk to it; you rarely touch it.</li></ul><h3>The mesh</h3><ul><li>Service mesh: infrastructure that handles service-to-service traffic — encryption, identity, routing, retries — so your code doesn’t.</li><li>Istio: the mesh this series uses. Powerful, opinionated, occasionally too clever for its own good.</li><li>Envoy: the proxy doing the actual work. Istio configures it; Envoy moves the packets.</li><li>Sidecar: an Envoy injected next to every pod. The classic model — and the source of the “tax” we’ll argue about.</li><li>Ambient mode / ztunnel / waypoint: the sidecarless direction. ztunnel does L4 mTLS cheaply; a waypoint proxy handles L7 when you need it. Where this series lands.</li><li>Gateway API: the modern, standard way to define edge/ingress traffic — the front door.</li></ul><h3>Identity</h3><ul><li>OAuth2 / OIDC: the protocols for “prove who you are” and “here’s what you may do.” OIDC is the login layer on top of OAuth2.</li><li>JWT: the signed token that carries identity and claims across the wire. Verify it — never just trust it.</li><li>Microsoft Entra ID: the identity provider for your users and apps. (Formerly Azure AD.)</li><li>Scopes vs app roles: two ways Entra says “allowed to do X.” We’ll map both onto mesh policy.</li><li>Workload identity / federation: how a pod proves who it is to Azure with no secret in config. The workload half of passwordless.</li><li>Passwordless: killing the credential — passkeys / FIDO2 / Windows Hello / certificate-based auth for people, federation + mTLS for machines.</li><li>mTLS + SPIFFE/SVID: mutual TLS where every workload carries a cryptographic identity. Encryption and identity in one handshake.</li></ul><h3>The guardrails</h3><ul><li>Zero trust / default-deny: nothing is allowed until you allow it. The opposite of “flat network, hope for the best.”</li><li>PeerAuthentication / RequestAuthentication / AuthorizationPolicy: Istio’s three levers — is the workload mutually authenticated, is the user’s token valid, is this call permitted.</li><li>NetworkPolicy: Kubernetes-native L3/L4 firewalling. Belt to the mesh’s suspenders.</li><li>OPA Gatekeeper / Kyverno: admission control that refuses to let non-compliant config into the cluster in the first place.</li></ul><h3>The proof</h3><ul><li>Telemetry / OpenTelemetry: the signals — logs, metrics, traces — your system emits about itself.</li><li>LGTM stack: Loki, Grafana, Tempo, Mimir — logs, dashboards, traces, metrics. The evidence machine.</li><li>Signed evidence / cosign / in-toto: tamper-evident proof that what you claim happened actually happened. The demo-to-audit gap, closed.</li><li>Drift / compliance posture: the distance between what you declared and what’s actually running, watched continuously.</li></ul><h3>The rules</h3><ul><li>PCI-DSS 4.0: the card-data security standard. Global, unavoidable the moment you touch payments.</li><li>RBI IT Framework / CERT-In / DPDP (India): the tier-wise IT rules, the six-hour incident clock, and the data-protection law.</li><li>SAMA CSF / NCA ECC / PDPL (Saudi), CBUAE / DIFC / ADGM (UAE): the Middle East equivalents — with a maturity model and data-residency teeth.</li><li>ISO 27001: the international control catalogue everyone maps back to.</li></ul><p>That’s the series in one screen. Each line is a promise we’ll pay off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eKZPfma7Rl4hVbA0" /></figure><h3>From here to the standard</h3><p>Start small. One service, one namespace, mTLS on, a default-deny policy, access logs flowing. That’s a weekend. The “industry standard” version — full framework mapping, signed evidence packs, drift detection, an ambient data plane, no passwords anywhere — is where this series lands over the coming months. We climb there one concept at a time, and every rung has real config you can run.</p><p>Next up: Kubernetes in five boxes — the only mental model you need before any of this makes sense.</p><p>Follow along if you’re building regulated workloads on Kubernetes. Twice a week.</p><p>#ServiceMesh #Istio #Azure #dotnet #ZeroTrust #Kubernetes</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5aec338ea8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduce Semantic Search to your app with Semantic Kernal, Azure AI and Azure Cosmos Db]]></title>
            <link>https://medium.com/@arshadbadarkhan/introduce-semantic-search-to-your-app-with-semantic-kernal-azure-ai-and-azure-cosmos-db-46d51ee06be1?source=rss-10d171096c28------2</link>
            <guid isPermaLink="false">https://medium.com/p/46d51ee06be1</guid>
            <category><![CDATA[azure-cosmos-db]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[azureopenai]]></category>
            <dc:creator><![CDATA[Arshad Badar Khan]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 12:31:35 GMT</pubDate>
            <atom:updated>2025-08-28T12:31:35.851Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Semantic Search Paradigm: Beyond Keywords</h3><p>In information retrieval, the traditional keyword-based search is a brittle system that relies on lexical matching. It struggles with the nuances of human language; for instance, a search for “HVAC” won’t find content on “Heating, Ventilation, and Air Conditioning” without explicit mapping. This is where semantic search shines. It’s a fundamental shift in how we find information, moving beyond simple term matching to interpret a query’s underlying intent and context.</p><p>Semantic search solves this by interpreting meaning and intent. Instead of matching words literally, it finds concepts. This is powered by:</p><ul><li>Natural Language Processing (NLP) → Understands context in queries.</li><li>Embeddings → Convert text into dense vector representations that encode semantic meaning.</li><li><em>(Optional)</em> Knowledge Graphs → Model relationships between entities (not part of our implementation but relevant in other systems).</li></ul><p>This approach delivers a more intelligent search experience that understands synonyms, handles context, and provides better user experience by getting to the core of what the user is truly looking for.</p><h3>The “EveryEng” Example</h3><p><em>EveryEng</em> is an upskilling platform for engineers offering:</p><ul><li>Courses (Title + Industry Domain)</li><li>Technical Blogs</li><li>Employment Opportunities</li></ul><p>A user searches:</p><blockquote><em>“Find me courses on HVAC”</em></blockquote><p>A keyword-based system might fail because <em>HVAC</em> is an acronym (<em>Heating, Ventilation, and Cooling</em>). Semantic search, however, interprets HVAC as a concept in building systems and retrieves the right courses.</p><h3>An Architectural Blueprint with Azure</h3><p>Let’s apply these concepts to a practical scenario for EveryEng, a technical upskilling platform. We’ll build a semantic search solution using Azure’s powerful services.</p><h3>The Foundation: Vector Embeddings</h3><p>The heart of our solution is the use of vector embeddings. A vector embedding is a numerical representation of a piece of data that captures its semantic meaning. The cosine similarity (or vectorDistance) between two vectors is a direct measure of how semantically similar the original pieces of text are.</p><p>The DTO: A Contract for Vectors</p><p>Our data transfer object must be designed to accommodate these embeddings. We’ll augment our CourseDto to include a list of floats, which will store the vector representation of our Title and other relevant fields. This denormalized data model is efficient for our specific use case.</p><pre>public record CourseDto<br>{<br>    public string Id { get; set; }<br>    public string Title { get; set; }<br>    public float[] TitleVector { get; set; }<br>    public string IndustryDomain { get; set; }<br>    public float[] IndustryDomainVector { get; set; }<br>}</pre><h3>Data Persistence with Azure Cosmos DB</h3><p>Azure Cosmos DB is an excellent choice for this architecture, as it now offers native support for vector search on its NoSQL API. This eliminates the need for a separate, specialized vector database.</p><ol><li>Enable Vector Search: Within your Cosmos DB instance, enable the Vector Search feature.</li><li>Container Configuration: When provisioning a new container, configure a vector embedding field. For our use case, we’ll designate TitleVector as the field to be indexed for efficient vector similarity queries.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*9eZI4Q7iJKC1vpcD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/0*iusy_opQisfVK7PT" /></figure><h3>Generating Embeddings with Azure OpenAI 🤖</h3><p>To create the embeddings, we’ll use Azure OpenAI’s embedding models (e.g., text-embedding-ada-002). The Semantic Kernel SDK for C# is a perfect choice, providing a clean interface for interacting with these models.Best practice: use the newer text-embedding-3-small (fast, cost-effective) or text-embedding-3-large (higher accuracy).</p><pre>public async Task&lt;List&lt;float&gt;&gt; EmbeddingGeneratorService(string term)<br>{<br>    OpenAIEmbeddingCollection response = await embeddingService.GenerateEmbeddingsAsync(<br>        &quot;text-embedding-ada-002&quot;, term);</pre><pre>    return response.SelectMany(item =&gt; item.ToFloats().ToArray()).ToList();<br>}</pre><p>This service generates and returns the vector representation for a given string.</p><h3>The Search Workflow: A Code-Driven Approach</h3><p>When a user searches <em>“find me courses on HVAC”</em>:</p><ul><li>Generate embeddings for the query.</li></ul><pre>var searchVector = await EmbeddingGeneratorService(&quot;find me courses on HVAC&quot;);</pre><ul><li>Run a parameterized vector query against CosmosDB.</li></ul><pre>var query = new QueryDefinition(<br>    &quot;SELECT TOP 5 * FROM c ORDER BY VectorDistance(c.TitleVector, @vector)&quot;<br>).WithParameter(&quot;@vector&quot;, searchVector);</pre><pre>using var feedIterator = container.GetItemQueryIterator&lt;CourseDto&gt;(<br>    query,<br>    requestOptions: new QueryRequestOptions { MaxConcurrency = -1 });</pre><pre>while (feedIterator.HasMoreResults)<br>{<br>    var response = await feedIterator.ReadNextAsync(cancellationToken);<br>    foreach (var course in response)<br>        yield return course;<br>}</pre><ul><li>✅ VectorDistance() is the correct function.</li><li>✅ Always use parameters (@vector) instead of interpolating raw embeddings into SQL.</li></ul><h3>Beyond the Basics</h3><p>To improve production-quality search:</p><ul><li>The Two-Stage Search Paradigm: A common practice in modern search architectures is a two-stage approach. The initial vector search acts as a recall stage (finding a broad set of semantically similar documents). A subsequent reranking or relevance stage can use a separate GPT model to reorder the results based on a user’s preferences, providing a more personalized experience.</li><li>Personalize with User IDs → Incorporate user history or preferences for tailored results.</li><li>Optimize updates → Use Patch Operations in CosmosDB to update embeddings without rewriting entire documents.</li><li>Cache embeddings → Store frequent query embeddings in a lightweight store for lower latency &amp; cost.</li></ul><h3>Key Takeaways</h3><ul><li>Semantic search transforms the problem from <em>string matching</em> to <em>vector similarity</em>.</li><li>Azure CosmosDB + OpenAI embeddings make it practical to build at scale.</li><li>DTOs, vector indexes, and embedding pipelines are the backbone of the solution.</li><li>For production, reranking, personalization, and caching are critical for performance and relevance.</li></ul><p>This isn’t just <em>search</em> anymore — it’s a full AI-powered information retrieval system</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46d51ee06be1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Azure Front Door and why you should you use it]]></title>
            <link>https://medium.com/@arshadbadarkhan/what-azure-front-door-and-why-you-should-you-use-it-9160345a62e3?source=rss-10d171096c28------2</link>
            <guid isPermaLink="false">https://medium.com/p/9160345a62e3</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-front-door]]></category>
            <dc:creator><![CDATA[Arshad Badar Khan]]></dc:creator>
            <pubDate>Sun, 17 Aug 2025 13:52:57 GMT</pubDate>
            <atom:updated>2025-08-17T13:55:03.109Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure Front Door: Global Load Balancing and Geo-Aware Routing</h3><p>Azure Front Door (AFD) is Microsoft’s modern, global Content Delivery Network (CDN) and Layer-7 load balancer. Positioned at edge Points of Presence (PoPs) around the world, AFD terminates client connections at the edge and forwards requests to the nearest healthy origin. This enables faster content delivery, improved reliability, and enhanced security through features like Web Application Firewall (WAF), advanced rules, and observability.</p><h3>How Azure Front Door Accelerates Content Delivery</h3><p>AFD delivers speed and performance through a combination of intelligent routing, caching, and optimization:</p><ol><li>Anycast to the Nearest Edge Users connect to the closest Front Door PoP via Anycast, minimizing first-mile latency.</li><li>Split TCP (Connection Termination at the Edge) AFD terminates TCP/TLS near the user, then establishes an optimized connection to your origin. This reduces round-trip times and head-of-line blocking.</li><li>Latency-Based Origin Selection <em>(Default)</em> Once an edge node receives a request, AFD routes it to the origin with the lowest measured latency, not just the geographically closest.</li><li>Global Edge Network + Caching/Compression AFD leverages Microsoft’s backbone network with support for caching and compression, reducing payload size and hop counts.</li><li>Health Probes and Smart Failover Continuous health probes keep track of endpoint availability. If an origin fails, traffic is automatically rerouted to healthy regions.</li><li>Rules Engine at the Edge Flexible rule sets allow rewrites, redirects, header manipulation, and route overrides — all evaluated at the edge before traffic is forwarded.</li></ol><h3>Static vs. Dynamic Content Delivery</h3><ul><li>Static content (e.g., product pages, blog posts) can be cached and served globally via Front Door’s CDN capabilities.</li><li>Dynamic or user-specific content (e.g., personalized dashboards, account data) requires fresh responses from regional origins.</li></ul><p>This is where geo-aware routing becomes essential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3USHghK1LvTYYg7ZklDgdg.jpeg" /></figure><h3>Geo-Aware Routing with Azure Front Door</h3><p>Imagine your business operates data centers across the USA, Europe, Africa, and India to serve a global customer base. You want users to experience responses in milliseconds, not seconds — always fresh, region-specific, and reliable.</p><p>With Geographic Routing, you can ensure:</p><ul><li>Users in the USA connect to the USA data center.</li><li>Users in Europe connect to the Europe data center.</li><li>Users in Africa connect to the Africa data center</li><li>Users in Asia connect to the India data center.</li></ul><p>This ensures minimal latency, regionally tailored content, and high availability.</p><h3>How Geographic Routing Works in AFD</h3><ol><li>A client request is routed to the nearest AFD edge via Anycast.</li><li>The request is matched against a Route configuration.</li><li>If a Rule Set is attached, conditions (such as geo-match) are evaluated.</li><li>Rules can override the default origin group and route traffic to the appropriate regional origin.</li><li>If no rules match, traffic is sent to the default origin group.</li></ol><h3>Core Components for Geo Routing</h3><h3>A) Origins &amp; Origin Groups</h3><p>Create origins pointing to regional entry points (e.g., Load Balancer, Application Gateway, or direct service endpoints):</p><ul><li>origin-usa → USA Data Center</li><li>origin-europe → Europe Data Center</li><li>origin-africa → Africa Data Center</li><li>origin-india → India Data Center (serves Asia)</li></ul><p>Group them into origin groups and configure health probes for availability monitoring.</p><h3>B) Routes</h3><p>Define a Route (e.g., www.rawtech.com/*) pointing to your origin group.</p><ul><li>This acts as the default route.</li><li>Rules will override this to ensure geo-based distribution.</li></ul><h3>C) Rule Set (Geo Router)</h3><p>Attach a Rule Set to the route.</p><ul><li>Add Geo Match conditions (e.g., if Remote Address → ClientCountry = US)</li><li>Use Route Configuration Override to redirect traffic to the correct origin group.</li><li>Define rules for each region, ordered top-to-bottom.</li></ul><h3>Step-by-Step Configuration</h3><ol><li>Create an Azure Front Door instance.</li><li>Set up an endpoint (e.g., frontend-endpoint).</li><li>Define origin groups per region (usa-origin-group, europe-origin-group, etc.).</li><li>Add a custom domain (www.rawtech.com) and provision SSL certificates.</li><li>Create a Rule Set (e.g., GeoRoutingRule).</li><li>Repeat rule creation for Europe, Africa, and India.</li><li>Associate the Rule Set with your route.</li><li>Save and apply the configuration.</li></ol><h3>Monitoring and Observability</h3><p>Enable diagnostics and monitor performance using Azure Monitor and Log Analytics.</p><h3>Enable Diagnostics</h3><pre>az monitor diagnostic-settings create \<br>  --resource &quot;/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.Network/frontdoors/{frontdoor-name}&quot; \<br>  --name &quot;frontdoor-diagnostics&quot; \<br>  --logs &#39;[{&quot;category&quot;: &quot;FrontdoorAccessLog&quot;, &quot;enabled&quot;: true}]&#39; \<br>  --metrics &#39;[{&quot;category&quot;: &quot;AllMetrics&quot;, &quot;enabled&quot;: true}]&#39; \<br>  --workspace &quot;/subscriptions/{subscription}/resourceGroups/{rg}/providers/Microsoft.OperationalInsights/workspaces/{workspace-name}&quot;</pre><h3>Example Queries</h3><p>Traffic by Country (last 24h):</p><pre>FrontdoorAccessLog<br>| where TimeGenerated &gt; ago(24h)<br>| summarize RequestCount = count() by ClientCountry<br>| order by RequestCount desc</pre><p>Average Response Time per Backend (last 1h):</p><pre>FrontdoorAccessLog  <br>| where TimeGenerated &gt; ago(1h)<br>| summarize AvgResponseTime = avg(TimeTaken) by BackendPool<br>| order by AvgResponseTime desc</pre><p>To see some of the code and script and more such practices please visit my github repository <a href="https://github.com/abkhan5/AgriTech">abkhan5/AgriTech</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9160345a62e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AzScale: Azure Event Grid and Azure blob store to the latency]]></title>
            <link>https://medium.com/@arshadbadarkhan/azscale-azure-event-grid-and-azure-blob-store-to-the-latency-7b85c7da1c80?source=rss-10d171096c28------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b85c7da1c80</guid>
            <category><![CDATA[azure-storage]]></category>
            <category><![CDATA[azure-service-bus]]></category>
            <category><![CDATA[azure-blob-storage-client]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-event-grid]]></category>
            <dc:creator><![CDATA[Arshad Badar Khan]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 16:30:32 GMT</pubDate>
            <atom:updated>2024-09-24T16:30:32.311Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s the setup. We have an application that generates content on an hourly basis. This content needs to be accessible with minimal latency. Preferably less than 200ms. Users are spread across the globe. Content is the same for everyone from anywhere.</p><p>So this is what we have. An application that is reactively or pre-emptively creating content. This content is an aggregation of multiple jobs creating datasets being structured and presented as a webpage. This webpage is saved to an azure blob store, let&#39;s call this the Source. The client will make a request to the web app that looks in the blob store for the web page which if present will be served. This is how content is created and served.</p><p>To achieve our goal of minimal latency we’ve chosen to deploy the web app in multiple locations. This location will intercept traffic and when deployed it will setup a job which will listen to events and copy web pages from the Source Blob store to its regional blob store.</p><p>So with the setup done this is how it would look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*bidF0XHCisBlLiXntgNcgw.jpeg" /></figure><p>With the broad pieces in place lets walk through all the components involved and their functions</p><p>Lets start at the Source Azure Blob store.</p><p>This blob store generates events usings event grids. The event grid is configured to send a Create and Delete event to a Topic in Azure Service bus. The json passed on to event grid looks like this.</p><pre>public record BlobData<br>{<br>    public string api { get; set; }<br>    public string contentType { get; set; }<br>    public string blobType { get; set; }<br>    public string url { get; set; }<br>    public int contentLength { get; set; }<br>}<br></pre><p>The Topic then has multiple subscriptions which are configured to forward messages to the queues. The binding between Topic, Subscription and Queues looks something like this</p><pre>internal class AzureEventBusSubscriptionsManager(ServiceBusClient client)<br><br>{<br>    private ServiceBusProcessor processor;<br><br><br>    public async Task Subscribe&lt;T&gt;(string topicName, string subscriptionName,string forwardingQueueName, bool toForward, Func&lt;T, CancellationToken, Task&lt;bool&gt;&gt; callBack, IDictionary&lt;string, string&gt; traits, CancellationToken cancellationToken)<br>    {<br>        await CreateTopic(topicName, cancellationToken);<br>        var options = new ServiceBusProcessorOptions<br>        {<br>            AutoCompleteMessages = true,<br>            MaxConcurrentCalls = 10,<br>            PrefetchCount = 2,<br>            ReceiveMode = ServiceBusReceiveMode.ReceiveAndDelete<br>        };<br>        if (toForward)<br>        {<br>            string forwardingQueueName = azureEntityManager.GetLocalizedName($&quot;{topicName}-{subscriptionName}&quot;);<br>            await CreateQueue(forwardingQueueName, cancellationToken);<br>            await CreateTopicSubscription(topicName, subscriptionName, forwardingQueueName, traits, cancellationToken);<br>            processor = client.CreateProcessor(forwardingQueueName, options);<br>        }<br>        else<br>        {<br><br>            await CreateTopicSubscription(topicName, subName, null, traits, cancellationToken);<br>            processor = client.CreateProcessor(topicName, subName, options);<br>        }<br><br>        processor.ProcessMessageAsync += async responseItem =&gt;<br>        {<br>            var body = responseItem.Message.Body;<br>            if (body == null)<br>                return;<br>            var payload = body.ToObjectFromJson&lt;T&gt;();<br>            await callBack(payload, responseItem.CancellationToken);<br>        };<br>        processor.ProcessErrorAsync += ErrorHandler;<br>        await processor.StartProcessingAsync(cancellationToken);<br>    }<br><br>public async Task CreateTopic(string topicName, CancellationToken cancellationToken)<br>{<br>    var client = GetClient();<br>    var topicExists = await client.TopicExistsAsync(topicName, cancellationToken);<br>    if (topicExists)<br>        return;<br>    await client.CreateTopicAsync(new CreateTopicOptions(topicName)<br>    {<br>        AutoDeleteOnIdle = TimeSpan.FromDays(7),<br>        DefaultMessageTimeToLive = TimeSpan.FromDays(2),<br>        DuplicateDetectionHistoryTimeWindow = TimeSpan.FromMinutes(1),<br>        EnableBatchedOperations = true,<br>        EnablePartitioning = false,<br>        MaxSizeInMegabytes = 2048,<br>        RequiresDuplicateDetection = true,<br>        Name = topicName,<br>        Status = EntityStatus.Active<br>    }, cancellationToken);<br>}<br>  private ServiceBusAdministrationClient GetClient() =&gt;<br>      new(&quot;ConnectionString&quot;);<br><br>  public async Task CreateQueue(string queueName, CancellationToken cancellation)<br>  {<br>      <br>      var serviceBusAdministrationClient = GetClient();<br>      var queueExists = await serviceBusAdministrationClient.QueueExistsAsync(queueName, cancellation);<br>      if (!queueExists)<br>          await serviceBusAdministrationClient.CreateQueueAsync(new CreateQueueOptions(queueName)<br>          {<br>              AutoDeleteOnIdle = new TimeSpan(1, 0, 0, 0),<br>              DeadLetteringOnMessageExpiration = true,<br>              DefaultMessageTimeToLive = new TimeSpan(24, 0, 0),<br>              Status = EntityStatus.Active,            <br>              UserMetadata = Envname<br>          }, cancellation);<br>  }<br>public async Task CreateTopicSubscription(string topicName, string subscriptionName, string forwardingQueueName, IDictionary&lt;string, string&gt; customRules, CancellationToken cancellationToken)<br>{<br>    var client = GetClient();    <br>    var subscriptionOptions = new CreateSubscriptionOptions(topicName, subscriptionName)<br>    {<br>        AutoDeleteOnIdle = TimeSpan.FromDays(7),<br>        DefaultMessageTimeToLive = TimeSpan.FromDays(2)<br>    };<br><br>    if (!string.IsNullOrEmpty(forwardingQueueName))<br>        subscriptionOptions.ForwardTo = forwardingQueueName;<br><br>    var topicSubExists = await client.SubscriptionExistsAsync(topicName, subscriptionName, cancellationToken);<br>    if (topicSubExists)<br>        await client.DeleteSubscriptionAsync(topicName, subscriptionName, cancellationToken);<br><br>    await client.CreateSubscriptionAsync(subscriptionOptions, cancellationToken);<br><br>    if (customRules is { Count: &gt; 0 })<br>        await CreateRules(topicName, subscriptionName, customRules, cancellationToken);<br>}<br> private async Task CreateRules(string topicName, string subscriptionName, IDictionary&lt;string, string&gt; custumRules, CancellationToken cancellationToken)<br> {<br>     try<br>     {<br>         var client = GetClient();<br><br>         var rules = client.GetRulesAsync(topicName, subscriptionName, cancellationToken);<br>         var ruleProperties = new List&lt;RuleProperties&gt;();<br>         await foreach (var rule in rules)<br>             ruleProperties.Add(rule);<br><br><br>         foreach (var rule in ruleProperties)<br>             await client.DeleteRuleAsync(topicName, subscriptionName, rule.Name, cancellationToken);<br><br>         foreach (var rule in custumRules)<br>             await client.CreateRuleAsync(topicName, subscriptionName, new CreateRuleOptions<br>             {<br>                 Name = rule.Key,<br>                 Filter = new SqlRuleFilter(rule.Value),<br>             }, cancellationToken);<br>     }<br>     catch (Exception ex)<br>     {<br>         logger.LogWarning(ex.ToString());<br>     }<br> }<br>}</pre><p>With the connection between Azure Blob storeage, Event Grid , Azure Topic and Azure Service Bus done lets move on to the part. Copying data from source to destinations.</p><p>This is where a copy job comes in. A c# microservice which starts with by receiving the azure service bus messages. These messages will have a metadata about what event was raised. This in turn is copied to the destination.</p><p>Now some important points that we learnt here. Azure has pricing model based on regions. For example transfer within South America is different compared to Europe or Asia. Similarly transfer between Asia and South America is different compared to North America and South America. Here’s a chart of the pricing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aq_70cIiYRk2ALSIkdUXkQ.png" /></figure><p>To copy data from blob store to another there are two options.</p><ol><li>Copy via stream</li><li>Copy via URL.</li></ol><p>A working code sample of above architecture is can be found in my github repo <a href="https://github.com/abkhan5/AgriTech">abkhan5/AgriTech (github.com)</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b85c7da1c80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>