<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dominic Robinson</title>
    <description>The latest articles on DEV Community by Dominic Robinson (@dominic_robinson_ff89e6b5).</description>
    <link>https://dev.to/dominic_robinson_ff89e6b5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3916486%2F095fdd27-77e0-419c-95f3-0cea90cf9838.png</url>
      <title>DEV Community: Dominic Robinson</title>
      <link>https://dev.to/dominic_robinson_ff89e6b5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dominic_robinson_ff89e6b5"/>
    <language>en</language>
    <item>
      <title>Automating SQL Server Database Administration with T-SQL Utility Scripts</title>
      <dc:creator>Dominic Robinson</dc:creator>
      <pubDate>Wed, 06 May 2026 18:17:53 +0000</pubDate>
      <link>https://dev.to/dominic_robinson_ff89e6b5/automating-sql-server-database-administration-with-t-sql-utility-scripts-2di6</link>
      <guid>https://dev.to/dominic_robinson_ff89e6b5/automating-sql-server-database-administration-with-t-sql-utility-scripts-2di6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ekx8iucfa0u50xnedlr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ekx8iucfa0u50xnedlr.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Database performance doesn't degrade overnight — it erodes quietly through fragmented indexes, bloated data files, and unchecked log growth. By the time your queries slow to a crawl, the damage is already done.&lt;/p&gt;

&lt;p&gt;To address this proactively, I built and open-sourced &lt;strong&gt;sql-database-admin-utility-scripts&lt;/strong&gt;: a focused collection of production-grade T-SQL scripts that automate the most critical — and most neglected — database administration tasks in SQL Server environments.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/robinsondominic/sql-database-admin-utilty-scripts" rel="noopener noreferrer"&gt;View the Repository on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: DBA Tasks That Fall Through the Cracks
&lt;/h2&gt;

&lt;p&gt;In enterprise environments, database administrators and developers are often juggling application delivery alongside infrastructure health. Routine but essential maintenance tasks — index management, file size optimization, fragmentation analysis — are frequently deferred until performance incidents occur.&lt;/p&gt;

&lt;p&gt;The consequences are real:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fragmented indexes&lt;/strong&gt; degrade query execution plans, increasing I/O and CPU overhead&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Oversized data and log files&lt;/strong&gt; consume storage unnecessarily, raising cloud infrastructure costs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Undetected index fragmentation&lt;/strong&gt; in columnstore indexes silently undermines analytical query performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's needed isn't just documentation of best practices — it's &lt;strong&gt;executable, reusable tooling&lt;/strong&gt; that makes doing the right thing the easy thing.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Scripts Do
&lt;/h2&gt;

&lt;p&gt;The repository provides four focused T-SQL utility scripts, each targeting a distinct operational concern:&lt;/p&gt;

&lt;h3&gt;
  
  
  🗜️ 1. Shrink Data File and Log Files
&lt;/h3&gt;

&lt;p&gt;Log files in SQL Server can grow unbounded if not managed. This script automates the safe shrinking of both data (&lt;code&gt;.mdf&lt;/code&gt;) and log (&lt;code&gt;.ldf&lt;/code&gt;) files — a task that, when done manually and ad hoc, frequently introduces risk through incorrect syntax or improper sequencing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Example: Shrink log file to reclaim space&lt;/span&gt;
&lt;span class="n"&gt;DBCC&lt;/span&gt; &lt;span class="n"&gt;SHRINKFILE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DatabaseLog&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Note:&lt;/strong&gt; Shrinking is applied judiciously in this toolkit — targeted for log files post-backup or after bulk operations, not as routine maintenance that could cause page fragmentation.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  🔄 2. Reorganize an Index
&lt;/h3&gt;

&lt;p&gt;Index reorganization is an &lt;strong&gt;online, low-impact operation&lt;/strong&gt; suited for indexes with moderate fragmentation (typically 10–30%). Unlike a full rebuild, it doesn't lock the table — making it safe to run against production workloads during business hours.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;IndexName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;].[&lt;/span&gt;&lt;span class="n"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;REORGANIZE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script makes reorganization scriptable and schedulable — ready to plug into SQL Server Agent jobs or CI/CD database pipelines.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔨 3. Rebuild an Index
&lt;/h3&gt;

&lt;p&gt;For heavily fragmented indexes (&amp;gt;30%), a full rebuild is necessary. This script automates index rebuilds with options for &lt;code&gt;ONLINE&lt;/code&gt; mode where supported, preserving availability during maintenance windows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;IndexName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;Schema&lt;/span&gt;&lt;span class="p"&gt;].[&lt;/span&gt;&lt;span class="n"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;REBUILD&lt;/span&gt; &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ONLINE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rebuilding updates index statistics as a side effect — directly improving query optimizer decisions across the database.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔍 4. Check Rowstore &amp;amp; Columnstore Index Fragmentation
&lt;/h3&gt;

&lt;p&gt;This is arguably the most analytically valuable script in the collection. Using &lt;code&gt;sys.dm_db_index_physical_stats&lt;/code&gt;, it surfaces fragmentation metrics for both &lt;strong&gt;rowstore&lt;/strong&gt; (traditional B-tree) and &lt;strong&gt;columnstore&lt;/strong&gt; (analytical) indexes — giving DBAs and engineers a clear, data-driven basis for deciding between reorganize and rebuild operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;OBJECT_NAME&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;object_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;IndexName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index_type_desc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avg_fragmentation_in_percent&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dm_db_index_physical_stats&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DB_ID&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'SAMPLED'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;ips&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;indexes&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;object_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;object_id&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index_id&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;ips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avg_fragmentation_in_percent&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Columnstore index support is a deliberate inclusion — most open-source DBA toolkits focus exclusively on rowstore, leaving data warehouse and hybrid OLTP/OLAP environments underserved.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Open Source?
&lt;/h2&gt;

&lt;p&gt;Database administration knowledge is often siloed — locked in internal runbooks, tribal knowledge, or expensive vendor tooling. By releasing these scripts publicly under an open-source model, the goal is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lower the barrier&lt;/strong&gt; for developers who maintain databases without dedicated DBA support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standardize&lt;/strong&gt; common maintenance operations across teams and organizations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provide a reference implementation&lt;/strong&gt; for engineers learning SQL Server internals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The scripts are written to be readable and educational — not just functional. Every operation is intentional and can be understood, adapted, and extended by the community.&lt;/p&gt;




&lt;h2&gt;
  
  
  Practical Use Cases
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Recommended Script&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Scheduled weekly maintenance job&lt;/td&gt;
&lt;td&gt;Fragmentation Check → Reorganize or Rebuild&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Post-bulk-insert cleanup&lt;/td&gt;
&lt;td&gt;Shrink Log + Rebuild Index&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance incident investigation&lt;/td&gt;
&lt;td&gt;Fragmentation Check (Rowstore + Columnstore)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage cost optimization&lt;/td&gt;
&lt;td&gt;Shrink Data File&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pre-migration health check&lt;/td&gt;
&lt;td&gt;Full fragmentation report&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Who This Is For
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend developers&lt;/strong&gt; managing their own SQL Server databases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data engineers&lt;/strong&gt; working with hybrid OLTP/OLAP workloads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DBAs&lt;/strong&gt; looking for scriptable, version-controlled maintenance tooling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DevOps engineers&lt;/strong&gt; integrating database health checks into CI/CD pipelines&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;Planned additions to the repository include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📊 Automated maintenance decision logic (reorganize vs. rebuild threshold evaluation)&lt;/li&gt;
&lt;li&gt;🕐 SQL Server Agent job templates for scheduling&lt;/li&gt;
&lt;li&gt;📁 Statistics update scripts&lt;/li&gt;
&lt;li&gt;🔔 Alerting queries for critical fragmentation thresholds&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Get Involved
&lt;/h2&gt;

&lt;p&gt;The repository is open for contributions. Whether you want to add scripts, improve documentation, or raise issues — all input is welcome.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/robinsondominic/sql-database-admin-utilty-scripts" rel="noopener noreferrer"&gt;sql-database-admin-utility-scripts on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If this toolkit has saved you time or helped your team, leave a ⭐ on the repo — it helps others discover it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What T-SQL maintenance scripts do you rely on that aren't widely shared? Let's build a better open-source DBA toolkit together. Drop your thoughts in the comments 👇&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#sql&lt;/code&gt; &lt;code&gt;#sqlserver&lt;/code&gt; &lt;code&gt;#database&lt;/code&gt; &lt;code&gt;#dba&lt;/code&gt; &lt;code&gt;#tsql&lt;/code&gt; &lt;code&gt;#opensource&lt;/code&gt; &lt;code&gt;#devops&lt;/code&gt; &lt;code&gt;#dataengineering&lt;/code&gt; &lt;code&gt;#backend&lt;/code&gt; &lt;code&gt;#performance&lt;/code&gt;&lt;/p&gt;

</description>
      <category>automation</category>
      <category>database</category>
      <category>opensource</category>
      <category>sql</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Dominic Robinson</dc:creator>
      <pubDate>Wed, 06 May 2026 18:06:50 +0000</pubDate>
      <link>https://dev.to/dominic_robinson_ff89e6b5/-2486</link>
      <guid>https://dev.to/dominic_robinson_ff89e6b5/-2486</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8" class="crayons-story__hidden-navigation-link"&gt;Stop Manually Wiring Azure AD Auth — Here's a Secure-by-Default .NET 8 Template&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/dominic_robinson_ff89e6b5" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3916486%2F095fdd27-77e0-419c-95f3-0cea90cf9838.png" alt="dominic_robinson_ff89e6b5 profile" class="crayons-avatar__image" width="96" height="96"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/dominic_robinson_ff89e6b5" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Dominic Robinson
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Dominic Robinson
                
              
              &lt;div id="story-author-preview-content-3622453" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/dominic_robinson_ff89e6b5" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3916486%2F095fdd27-77e0-419c-95f3-0cea90cf9838.png" class="crayons-avatar__image" alt="" width="96" height="96"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Dominic Robinson&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;May 6&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8" id="article-link-3622453"&gt;
          Stop Manually Wiring Azure AD Auth — Here's a Secure-by-Default .NET 8 Template
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag crayons-tag--filled  " href="/t/showdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;showdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/azure"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;azure&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/dotnet"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;dotnet&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/security"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;security&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1&lt;span class="hidden s:inline"&gt; reaction&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Stop Manually Wiring Azure AD Auth — Here's a Secure-by-Default .NET 8 Template</title>
      <dc:creator>Dominic Robinson</dc:creator>
      <pubDate>Wed, 06 May 2026 18:04:15 +0000</pubDate>
      <link>https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8</link>
      <guid>https://dev.to/dominic_robinson_ff89e6b5/stop-manually-wiring-azure-ad-auth-heres-a-secure-by-default-net-8-template-46n8</guid>
      <description>&lt;p&gt;If you've ever spent days configuring OAuth 2.0 and OIDC just to get enterprise authentication working, you're not alone. It's tedious, error-prone, and honestly — it shouldn't be this hard.&lt;/p&gt;

&lt;p&gt;That's why I built and open-sourced &lt;strong&gt;AzureAdRazorLogin&lt;/strong&gt;: a ready-to-deploy C# .NET 8 Razor Pages template that handles Azure Active Directory integration out of the box.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem Worth Solving
&lt;/h2&gt;

&lt;p&gt;In distributed, cloud-native architectures, &lt;strong&gt;identity is the new perimeter&lt;/strong&gt;. Yet most teams still hand-roll their authentication setup — misconfiguring redirect URIs, mishandling token validation, or unknowingly introducing security drift across environments.&lt;/p&gt;

&lt;p&gt;The result? Technical debt baked into your security layer before you've shipped a single feature.&lt;/p&gt;




&lt;h2&gt;
  
  
  What AzureAdRazorLogin Does Differently
&lt;/h2&gt;

&lt;p&gt;Rather than following a tutorial and stitching together middleware, this solution gives you a &lt;strong&gt;secure baseline from line one&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 Zero-Trust by Default
&lt;/h3&gt;

&lt;p&gt;The app binds natively to Microsoft Entra ID (Azure AD) and enforces a global authorization fallback — every endpoint requires authentication unless explicitly exempted. No accidental public routes.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔄 Full OIDC Lifecycle Handled
&lt;/h3&gt;

&lt;p&gt;Token acquisition, encrypted cookie session persistence, and centralized logout — including terminating the session at the Azure AD identity provider — are all wired up and working on first run.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Environment-Agnostic Config
&lt;/h3&gt;

&lt;p&gt;Tenant IDs and Client IDs are abstracted via structured &lt;code&gt;appsettings.json&lt;/code&gt; templates, making transitions between local dev, staging, and production seamless and predictable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters for Engineering Teams
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Without This&lt;/th&gt;
&lt;th&gt;With AzureAdRazorLogin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Days of OIDC configuration&lt;/td&gt;
&lt;td&gt;Deployed in minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inconsistent security posture&lt;/td&gt;
&lt;td&gt;Deterministic, standards-aligned baseline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manual compliance checks&lt;/td&gt;
&lt;td&gt;Microsoft-recommended security posture built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom boilerplate per project&lt;/td&gt;
&lt;td&gt;Reusable, versioned open-source artifact&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The template is also &lt;strong&gt;CI/CD-ready and containerization-friendly&lt;/strong&gt; — drop it into Azure App Services or AWS without any additional scaffolding.&lt;/p&gt;




&lt;h2&gt;
  
  
  Built for the Long Haul
&lt;/h2&gt;

&lt;p&gt;This isn't just a snippet — it's governed like a real open-source project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📄 MIT License&lt;/li&gt;
&lt;li&gt;🤝 Contributor Covenant&lt;/li&gt;
&lt;li&gt;🔀 Defined pull-request guidelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is a living, community-maintained security baseline that evolves with the .NET ecosystem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;👉 Check out the full solution and docs: &lt;strong&gt;AzureAdRazorLogin on GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you've been burned by OIDC misconfigurations before, this is for you. Clone it, use it, contribute to it.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;How are you handling identity standardization across your .NET microservices? Drop your approach in the comments 👇&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#dotnet&lt;/code&gt; &lt;code&gt;#azure&lt;/code&gt; &lt;code&gt;#security&lt;/code&gt; &lt;code&gt;#opensource&lt;/code&gt; &lt;code&gt;#webdev&lt;/code&gt; &lt;code&gt;#csharp&lt;/code&gt; &lt;code&gt;#zerotrust&lt;/code&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>dotnet</category>
      <category>security</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
