<?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 Dijin Augustine on Medium]]></title>
        <description><![CDATA[Stories by Dijin Augustine on Medium]]></description>
        <link>https://medium.com/@dijin123?source=rss-5dfa347e2ba6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fqW3oMcLAzpdNNA5LQ5vyQ.png</url>
            <title>Stories by Dijin Augustine on Medium</title>
            <link>https://medium.com/@dijin123?source=rss-5dfa347e2ba6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:54:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dijin123/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[Complete Installation Guide: AdGuard Home on Raspberry Pi Zero 2W]]></title>
            <link>https://medium.com/@dijin123/complete-installation-guide-adguard-home-on-raspberry-pi-zero-2w-b3c22be77a0c?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3c22be77a0c</guid>
            <category><![CDATA[adguard]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[ad-booking]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 05 Dec 2025 16:31:13 GMT</pubDate>
            <atom:updated>2025-12-05T16:31:13.599Z</atom:updated>
            <content:encoded><![CDATA[<p>AdGuard Home is an excellent choice for network-wide ad blocking and DNS filtering on your Raspberry Pi Zero 2W. Here’s the comprehensive installation guide:<a href="https://adguard.com/en/adguard-home/overview.html">adguard+1</a>​</p><h3>Prerequisites</h3><p>Before beginning the installation, ensure you have the following:<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><ul><li>Raspberry Pi Zero 2W with Raspberry Pi OS installed</li><li>Network connectivity (Ethernet via USB adapter or Wi-Fi)</li><li>SSH access enabled on your Pi</li><li>Basic terminal knowledge</li></ul><h3>Step-by-Step Installation</h3><h3>Step 1: Prepare Your Raspberry Pi</h3><p>Connect to your Pi via SSH. First, find its IP address by running:</p><p>Enter the default password raspberry (unless you&#39;ve changed it).<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><h3>Step 1: Update Your System</h3><p>Before installing AdGuard Home, update your system:</p><pre>sudo apt update<br>sudo apt full-upgrade<br>sudo reboot</pre><p>Wait for the Pi to reboot, then SSH back in.<a href="https://ubuntu.com/appliance/adguard/raspberry-pi2">ubuntu</a>​</p><h3>Step 3: Download and Extract AdGuard Home</h3><p>For Raspberry Pi Zero 2W, which uses ARM architecture, download the appropriate binary. The Zero 2W uses ARMv7 or ARMv8 architecture:<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><pre>cd<br>wget &#39;https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv7.tar.gz&#39;<br>tar -f AdGuardHome_linux_armv7.tar.gz -x -v</pre><p>If you need the ARMv6 version instead, replace armv7 with armv6 in the download URL.<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><h3>Step 4: Install AdGuard Home as a Service</h3><p>Navigate to the extracted directory and install it as a system service:</p><pre>cd ./AdGuardHome/<br>sudo ./AdGuardHome -s install</pre><p>This command installs AdGuard Home as a system service that will automatically start on boot.<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><h3>Step 5: Access the Web Interface</h3><p>Open a web browser on any computer connected to your network and navigate to:</p><pre>http://&lt;YOUR_PI_IP&gt;:3000</pre><p>Replace &lt;YOUR_PI_IP&gt; with your Raspberry Pi&#39;s IP address (e.g., http://192.168.10.20:3000).<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><h3>Step 6: Complete the Setup Wizard</h3><p>The web interface will launch an installation wizard. Follow these steps:<a href="https://ubuntu.com/appliance/adguard/raspberry-pi2">ubuntu</a>​</p><ol><li>Click “Get Started” to begin configuration</li><li>Set Network Interfaces: Configure the Admin Web Interface and DNS Server addresses and ports (default: port 3000 for admin, port 53 for DNS)</li><li>Create Admin Credentials: Set a username and password for administrative access</li><li>Review Settings: Proceed through the configuration review pages</li><li>Complete Setup: Click “Open Dashboard” on the congratulations page</li><li>Log In: Use your admin credentials to access the dashboard</li></ol><h3>Step 7: Verify Filtering Works</h3><p>Test that AdGuard Home is properly blocking ads by running this command on the Pi:</p><pre>host doubleclick.net 127.0.0.1</pre><p>If working correctly, you should see output indicating the domain was not found:</p><pre>Using domain server:<br>Name: 127.0.0.1<br>Address: 127.0.0.1#53<br>Aliases:</pre><pre>Host doubleclick.net not found: 3(NXDOMAIN)</pre><h3>Service Management Commands</h3><p>After installation, control AdGuard Home with these commands:<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><pre>sudo /opt/AdGuardHome/AdGuardHome -s start      # Start the service<br>sudo /opt/AdGuardHome/AdGuardHome -s stop       # Stop the service<br>sudo /opt/AdGuardHome/AdGuardHome -s restart    # Restart the service<br>sudo /opt/AdGuardHome/AdGuardHome -s status     # Check status<br>sudo /opt/AdGuardHome/AdGuardHome -s uninstall  # Remove the service</pre><h3>Configure Your Devices to Use AdGuard Home</h3><p>Once AdGuard Home is running, configure your devices to use it as their DNS server. You can do this in two ways:<a href="https://adguard.com/en/adguard-home/overview.html">adguard</a>​</p><p>Router Configuration (Recommended): This automatically covers all connected devices. Access your router settings and set the DNS server to your Pi’s IP address.</p><p>Individual Device Configuration: On each device, change DNS settings to your Pi’s IP address (specific steps vary by device type).​</p><p>Your Raspberry Pi Zero 2W is now ready to protect your entire network from ads and trackers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3c22be77a0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Self-Signed Certificate Using OpenSSL with “Code Signing” feature]]></title>
            <link>https://medium.com/@dijin123/create-a-self-signed-certificate-using-openssl-with-code-signing-feature-9d5e18f5db56?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d5e18f5db56</guid>
            <category><![CDATA[certificate]]></category>
            <category><![CDATA[dot-net-core]]></category>
            <category><![CDATA[microsoft-store]]></category>
            <category><![CDATA[self-signed-certificate]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 12 Sep 2025 09:21:26 GMT</pubDate>
            <atom:updated>2025-09-12T09:21:26.462Z</atom:updated>
            <content:encoded><![CDATA[<h3>Steps to Create a Self-Signed Certificate with OpenSSL</h3><ol><li>Install OpenSSL:<br>Make sure OpenSSL is installed on your system. It is available by default on most Linux/macOS systems. For Windows, you can download it from official sources like <a href="https://slproweb.com/products/Win32OpenSSL.html">Shining Light Productions</a>.</li><li>Open a Command Prompt or Terminal where OpenSSL is available.</li></ol><h3>Steps to Generate a Code Signing Certificate with OpenSSL</h3><ol><li>Create an OpenSSL Configuration File (e.g., codesign.cnf):</li></ol><blockquote>[ req ]<br>default_bits = 2048<br>default_md = sha256<br>prompt = no<br>distinguished_name = dn<br>x509_extensions = v3_req</blockquote><blockquote>[ dn ]<br>CN = Your Name or Organization</blockquote><blockquote>[ v3_req ]<br>keyUsage = critical, digitalSignature<br>extendedKeyUsage = critical, codeSigning</blockquote><p>2. Generate the Certificate and Private Key:</p><blockquote>openssl req -x509 -config codesign.cnf -days 365 -out codesign_cert.pem -keyout codesign_key.pem -newkey rsa:2048 -nodes</blockquote><ul><li>This creates a self-signed certificate and key with the code signing EKU.</li><li>The -config codesign.cnf option tells OpenSSL to use your custom EKU override.</li></ul><p>3. Verify Certificate EKU:</p><blockquote>openssl x509 -in codesign_cert.pem -noout -text</blockquote><p>Look for the section:</p><blockquote>X509v3 Extended Key Usage: <br> Code Signing, critical</blockquote><h3>Optional: Convert to PFX (for Windows apps)</h3><p>If you need a PKCS#12 (.pfx) format to import into Windows Certificate Store or for signing apps, run:</p><blockquote>openssl pkcs12 -export -out codesign_cert.pfx -inkey codesign_key.pem -in codesign_cert.pem</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d5e18f5db56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detailed Steps for Cross-Account (Friend’s Account)Azure  CI/CD Deployment of Azure Web Apps : .NET]]></title>
            <link>https://medium.com/@dijin123/detailed-steps-for-cross-account-friends-account-azure-ci-cd-deployment-of-azure-web-apps-net-df1f572196f5?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/df1f572196f5</guid>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 11:40:39 GMT</pubDate>
            <atom:updated>2025-08-26T11:40:39.904Z</atom:updated>
            <content:encoded><![CDATA[<h3>Detailed Steps for Cross-Account (Friend’s Account)Azure CI/CD Deployment of Azure Web Apps : .NET 8</h3><h3>Detailed Steps for Cross-Account CI/CD Deployment</h3><h3>Step 1: Prepare Your Friend’s Azure Environment</h3><ol><li><strong>Friend’s Account : Creates a Web App:</strong></li></ol><ul><li>Your friend logs into their Azure portal.</li><li>Creates an Azure Web App in a Resource Group for your .NET 8 application.</li><li>Sets the runtime stack to .NET 8 to ensure compatibility.</li></ul><p><strong>2. Fried’s Account: Assign Permissions to Your Service Principal:</strong></p><ul><li>Your friend goes to the Resource Group or Web App.</li><li>Opens Access control (IAM).</li><li>Clicks Add &gt; Add role assignment.</li><li>Assigns the Contributor role to the service principal (which you will create next) or gives access to deploy to that Web App.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSoKFs9AEDnBhd8rRlHI7w.png" /></figure><h3>Step 2: Create a Service Principal &amp; Service Connection in Your Azure DevOps Project</h3><ol><li><strong>Create Service Principal with Contributor Access:</strong></li></ol><ul><li>You (or your friend) create a service principal in your friend’s Azure AD using Azure CLI or Portal.</li><li>Assign this service principal the Contributor role on the friend’s Azure subscription/resource group/web app.</li><li>Example Azure CLI command (run in your friend’s Azure subscription context):</li></ul><p>az ad sp create-for-rbac --name &lt;sp-name&gt; --role contributor --scopes /subscriptions/&lt;subscription-id&gt;/resourceGroups/&lt;resource-group&gt;</p><ul><li>Save the service principal appId, tenantId, and secret.</li></ul><p>2. <strong>Configure Service Connection in Azure DevOps:</strong></p><ul><li>In your Azure DevOps project, go to Project Settings &gt; Service connections.</li><li>Click New service connection.</li><li>Select Azure Resource Manager &gt; Service principal (manual).</li><li>Enter the service principal details: Subscription ID, Subscription name, Service principal client ID, Tenant ID, and Client secret.</li><li>Verify and save. Name it something clear like FriendAzureConnection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*fYHMNk85K2Emxw3ssDk-LQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*Eq22JNeFbLkH9BtmmCg34Q.png" /></figure><h3>Step 3: Update Your Azure DevOps Pipeline to Use the New Service Connection</h3><ol><li><strong>Build and Publish Your .NET 8 Application Artifact:</strong></li></ol><ul><li>Use Azure DevOps pipeline task to build and publish:</li></ul><p><em>- task: DotNetCoreCLI@2<br> inputs:<br> command: ‘publish’<br> publishWebProjects: true<br> arguments: ‘ — configuration Release — output $(Build.ArtifactStagingDirectory)/publish’<br> zipAfterPublish: true</em></p><p><strong>2. Publish the Build Artifacts:</strong></p><p><em>- task: PublishBuildArtifacts@1<br> inputs:<br> pathToPublish: ‘$(Build.ArtifactStagingDirectory)/publish’<br> artifactName: ‘drop’<br> publishLocation: ‘Container’</em></p><p><strong>3. Deploy to Friend’s Azure Web App using the Service Connection:</strong></p><p>Use AzureRmWebAppDeployment task with your friend’s service connection:</p><p><em>- task: AzureRmWebAppDeployment@4<br> inputs:<br> ConnectionType: ‘AzureRM’<br> azureSubscription: ‘FriendAzureConnection’ # Service connection created above<br> appType: ‘webApp’<br> WebAppName: ‘&lt;Friend-Web-App-Name&gt;’<br> packageForLinux: ‘$(Build.ArtifactStagingDirectory)/publish/**/*.zip’</em></p><h3>Step 4: Run and Verify</h3><ul><li>Commit and push your pipeline changes.</li><li>Trigger the pipeline manually or by code push.</li><li>The pipeline will build your .NET 8 app, package it, and deploy it directly to your friend’s Azure Web App using the service connection.</li><li>Your friend can verify the deployment by accessing the Web App URL.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df1f572196f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Observability Services Part 2— Webhook for Application Log push to Fluentd]]></title>
            <link>https://medium.com/@dijin123/observability-services-part-2-webhook-for-application-log-push-to-fluentd-156e38ae43ff?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/156e38ae43ff</guid>
            <category><![CDATA[webhooks]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[fluentd]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[error-handling]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 11 Feb 2022 11:49:29 GMT</pubDate>
            <atom:updated>2022-02-11T11:49:29.178Z</atom:updated>
            <content:encoded><![CDATA[<p>Please follow the Part 1 for setup the Fluentd-ElasticSearch-Kiban in Kuberenetes : Link is given below,</p><p><a href="https://medium.com/@dijin123/fuentd-elasticsearch-kibana-centralized-logging-for-kubernetes-containers-97ba1d359a29"><strong>Observability Services Part 1 : Fuentd-ElasticSearch-Kibana : Centralized Logging in Kubernetes | by Dijin Augustine | Feb, 2022 | Medium</strong></a></p><h3>http-Fuentd</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*1A9DRLbRkJcMd-03qp7oeA.png" /></figure><p>The in_http Input plugin allows you to send events through HTTP requests. Using this plugin, you can trivially launch a REST endpoint to gather data.</p><p>Modify the configmapfile fluentd-configmap.yaml</p><p><strong>Note :</strong> the configmap is an API object used to store non-confidential data in key-value pairs. <a href="https://kubernetes.io/docs/concepts/workloads/pods/">Pods</a> can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a <a href="https://kubernetes.io/docs/concepts/storage/volumes/">volume</a>. A configmapallows you to decouple environment-specific configuration from your <a href="https://kubernetes.io/docs/reference/glossary/?all=true#term-image">container images</a>, so that your applications are easily portable. Link : <a href="https://kubernetes.io/docs/concepts/configuration/configmap/">ConfigMaps | Kubernetes</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*nOG_ajHqjFX52dX57oW9Og.png" /></figure><p>Add the below configuration details into the same fluentd-configmap.yaml file.</p><pre>pods-http-fluent.conf: |-<br>&lt;source&gt;<br>@type http<br>port 8080<br>bind 0.0.0.0<br>body_size_limit 32m<br>keepalive_timeout 10s<br>&lt;/source&gt;</pre><h3>Re-Deploye the Fluentd Configmap</h3><p>Let’s deploy our configmap:</p><pre>kubectl apply -f fluentd-configmap.yaml</pre><p>Delete the existing fluentdpod. The new pod will spin-up by kubernetes with new configmap.</p><pre>kubectl delete pod <strong>&lt;Pod_Name&gt;</strong> -n fluentd</pre><h3>Access the HTTP Webhook URL</h3><p>Let run the code in PowerShell,</p><pre>kubectl -n fluentd port-forward <strong>&lt;Pod_Name&gt;</strong> — address localhost,<strong>&lt;externalIP&gt;</strong> 8080:8080</pre><h3>Test the HTTP Webhook URL</h3><p>Post the JSON value to HTTP Webhook URL using Postman tool,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vbpd0UXyG1qXCHv9EfU9Tw.png" /></figure><h3>Access Kibana</h3><pre>kubectl -n elastic-kibana port-forward svc/kibana 5601</pre><p>Check Kibana Dashboard : <a href="http://localhost:5601/">http://localhost:5601</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=156e38ae43ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure AD Role Management]]></title>
            <link>https://medium.com/@dijin123/azure-ad-role-management-b1921f101be4?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1921f101be4</guid>
            <category><![CDATA[aspdotnet-development]]></category>
            <category><![CDATA[permission]]></category>
            <category><![CDATA[azure-ad]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 08:58:01 GMT</pubDate>
            <atom:updated>2022-02-04T08:58:01.483Z</atom:updated>
            <content:encoded><![CDATA[<p>Azure AD Role Management</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*tcafalWfxKdOH-x2" /></figure><p><strong>Roles using Azure AD App Roles</strong><br>In this approach, The SaaS provider defines the application roles by adding them to the application manifest. After a customer signs up, an <strong>admin for the customer’s AD directory</strong> assigns users to the roles. When a user signs in, the user’s assigned roles are sent as claims.</p><p><strong>Note</strong><br>If the customer has Azure AD Premium, the admin can assign a security group to a role, and user members of the group will inherit the app role. This is a convenient way to manage roles, because the group owner doesn’t need to be an admin or app owner.</p><p><strong>Advantages of this approach:</strong></p><ul><li>Simple programming model.</li><li>Roles are specific to the application. The role claims for one application are not sent to another application.</li><li>If the customer removes the application from their Azure AD tenant, the roles go away.</li><li>The application doesn’t need any extra Azure AD permissions, other than reading the user’s profile.</li></ul><p><strong>Drawbacks:</strong></p><ul><li>Customers without Azure AD Premium cannot assign app roles to security groups. For these customers, all app role assignments to users must be done by individually, by an administrator or an owner of the app.</li><li>If you have a backend web API which is separate from the web app, the app role assignments for the web app don’t apply to the web API. (Securing a backend web API.)</li><li>Azure AD admin for that tenant or an app owner (under Enterprise apps) can create role and assign app roles to users</li><li>There is no UI for Adding App Roles in Azure AD B2C Application. We can add this thorough manifest. <a href="https://docs.microsoft.com/en-us/answers/questions/229991/azure-ad-b2c-application-won39t-show-up-as-an-opti.html">https://docs.microsoft.com/en-us/answers/questions/229991/azure-ad-b2c-application-won39t-show-up-as-an-opti.html</a></li></ul><p><strong>Define the roles.</strong> The SaaS provider declares the app roles in the application manifest. For example:</p><pre>&quot;appRoles&quot;: [<br>  {<br>    &quot;allowedMemberTypes&quot;: [<br>      &quot;User&quot;<br>    ],<br>    &quot;description&quot;: &quot;Creators can create Surveys&quot;,<br>    &quot;displayName&quot;: &quot;SurveyCreator&quot;,<br>    &quot;id&quot;: &quot;1b4f816e-5eaf-48b9-8613-7923830595ad&quot;,<br>    &quot;isEnabled&quot;: true,<br>    &quot;value&quot;: &quot;SurveyCreator&quot;<br>  },<br>  {<br>    &quot;allowedMemberTypes&quot;: [<br>      &quot;User&quot;<br>    ],<br>    &quot;description&quot;: &quot;Administrators can manage the Surveys in their tenant&quot;,<br>    &quot;displayName&quot;: &quot;SurveyAdmin&quot;,<br>    &quot;id&quot;: &quot;c20e145e-5459-4a6c-a074-b942bbd4cfe1&quot;,<br>    &quot;isEnabled&quot;: true,<br>    &quot;value&quot;: &quot;SurveyAdmin&quot;<br>  }<br>],</pre><p>The value property appears in the role claim. The id property is the unique identifier for the defined role. Always generate a new GUID value for id.</p><p><strong>Assign users.</strong> When a new customer signs up, the application is registered in the customer’s Azure AD tenant. At this point, an <strong>Azure AD admin for that tenant or an app owner (under Enterprise apps) can assign app roles to users.</strong></p><p><strong>Link:</strong></p><p><a href="https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/app-roles">Application roles — Azure Architecture Center | Microsoft Docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1921f101be4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure AD Authentication Implementation in Angular]]></title>
            <link>https://medium.com/@dijin123/azure-ad-authentication-implementation-in-angular-d6e936b7b099?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6e936b7b099</guid>
            <category><![CDATA[azure-ad]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 08:46:19 GMT</pubDate>
            <atom:updated>2022-02-04T08:46:19.256Z</atom:updated>
            <content:encoded><![CDATA[<p>Azure AD Implementation</p><ol><li>In the Azure Portal, open Azure Active Directory</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/0*aQHucGSIUaaWSetk.png" /></figure><ol><li>Under the Manage menu, open “App registrations” and click “New registration”</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/0*CcYez27vEQ3c5agX.png" /></figure><ol><li>Enter a name and select the supported account types. Also create a Redirect URI for <a href="https://localhost:5001/">https://localhost:5001/</a> and ensure the type is set to “Single-page application (SPA)”. Click Register.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/0*jADw_T7E4hdClgLk.png" /></figure><ol><li>On the Overview screen for the app registration, you should see an Application (client) ID and Directory (tenant) ID. Make note of these as we’ll need them later when we configure the web app for authentication.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*O0oPD4gkZMDf9uce.png" /></figure><ol><li>Under the Authentication section, under Single-page application Redirect URIs, add a new URI for the URL of the App Service (i.e. <a href="https://myauthenticatedapp.azurewebsites.net/">https://myauthenticatedapp.azurewebsites.net/</a> )</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*7ANUPNSgZY1oxQBB.png" /></figure><h3>Configure Angular app with MSAL</h3><p><strong>Install packages</strong></p><p>From the ClientApp folder, run npm i msal @azure/msal-browser @azure/msal-angular</p><p><strong>Configure environment settings</strong></p><ul><li>Replace ENTER_DEV_URL_HERE with your development URL (i.e. “<a href="https://localhost:5001/">https://localhost:5001/</a> “)</li><li>Replace ENTER_PUBLIC_URL_HERE with the App Service’s URL (i.e. “<a href="https://myauthenticatedapp.azurewebsites.net/">https://myauthenticatedapp.azurewebsites.net/</a> “)</li><li>Replace ENTER_CLIENT_ID_GUID_HERE with the client ID from the app registration</li><li>Replace ENTER_TENANT_NAME_HERE with the tenant name. This can be found in the Azure portal URL when viewing the App Service page</li></ul><p><strong><em>environment.ts</em></strong></p><pre>adAuth: {<br>    enabled: false,<br>    clientId: &quot;700c6b4f-174e-44da-924b-63bb0859fcf1&quot;,<br>    authority: &quot;https://login.microsoftonline.com/20c7d70b-c84c-4e31-9005-78f68e2bf1be/&quot;,<br>    redirectUri: &quot;http://localhost:4200&quot;,<br>    apiScopeUrl: [`https://mariappssmartpal.onmicrosoft.com/700c6b4f-174e-44da-924b-63bb0859fcf1/general`]<br>  },</pre><p><strong><em>app.module.ts</em></strong></p><pre>providers: [<br>    { provide: HTTP_INTERCEPTORS, useClass: AppCommonHttpInterceptor, multi: true },<br>    { provide: HTTP_INTERCEPTORS, useClass: MsalInterceptor, multi: true },<br>   { provide: MSAL_INSTANCE, useFactory: MsalConfigService.MSAInstanceFactory },<br>   { provide: MSAL_INTERCEPTOR_CONFIG, useFactory: MsalConfigService.MSAInterceptorConfigFactory },<br>   MsalService<br>  ],</pre><p><strong><em>msal-config.service.ts</em></strong></p><pre>import { MsalInterceptorConfiguration } from &#39;@azure/msal-angular&#39;;<br>import { BrowserCacheLocation, InteractionType, IPublicClientApplication, PublicClientApplication } from &#39;@azure/msal-browser&#39;;<br>import { environment } from &#39;projects/web-app/src/environments/environment&#39;;<br></pre><pre>export class MsalConfigService {</pre><pre>  static MSAInstanceFactory(): IPublicClientApplication {</pre><pre>    const isIE = window.navigator.userAgent.indexOf(&quot;MSIE &quot;) &gt; -1 || window.navigator.userAgent.indexOf(&quot;Trident/&quot;) &gt; -1; // Remove this line to use Angular Universal</pre><pre>    return new PublicClientApplication({<br>      auth: {<br>        clientId: environment.adAuth.clientId,<br>        authority: environment.adAuth.authority,<br>        redirectUri: environment.adAuth.redirectUri,<br>      },<br>      cache: {<br>        cacheLocation: BrowserCacheLocation.LocalStorage,<br>        storeAuthStateInCookie: isIE, // set to true for IE 11<br>      },<br>    })<br>  }</pre><pre>  static MSAInterceptorConfigFactory(): MsalInterceptorConfiguration {<br>    const protectedResourceMap = new Map&lt;string, Array&lt;string&gt;&gt;();</pre><pre>    if(environment.adAuth.enabled){<br>      protectedResourceMap.set(`${environment.apiUrl}/*`, environment.adAuth.apiScopeUrl);<br>    }<br>    <br>    return {<br>      interactionType: InteractionType.Redirect,<br>      protectedResourceMap: protectedResourceMap<br>    }<br>  }<br>}</pre><p><strong><em>auth.guard.ts</em></strong></p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from &#39;@angular/router&#39;;<br>import { environment } from &#39;projects/web-app/src/environments/environment&#39;;<br>import { Observable } from &#39;rxjs&#39;;</pre><pre>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class AuthGuard implements CanActivate {</pre><pre>  constructor(private _router: Router) {</pre><pre>  }<br>  canActivate(<br>    route: ActivatedRouteSnapshot,<br>    state: RouterStateSnapshot): Observable&lt;boolean | UrlTree&gt; | Promise&lt;boolean | UrlTree&gt; | boolean | UrlTree {</pre><pre>    if (!environment.adAuth.enabled) {<br>      return true;<br>    }<br>    if (localStorage.getItem(&#39;adUserInfo&#39;) != null) {<br>      return true;<br>    }<br>    else {<br>      this._router.navigate([&#39;/User/Login&#39;]);<br>      return false;<br>    }</pre><pre>  }</pre><pre>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6e936b7b099" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SonarQube Scan Azure DevOps Build Pipeline Integration]]></title>
            <link>https://medium.com/@dijin123/sonarqube-scan-azure-devops-build-pipeline-integration-ea5558e9e3be?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea5558e9e3be</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[code-quality-tools]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 07:43:27 GMT</pubDate>
            <atom:updated>2022-02-04T08:48:25.622Z</atom:updated>
            <content:encoded><![CDATA[<p>Code Quality : SonarQube Scan in Azure DevOps Pipeline</p><h3>SonarQube Configuration</h3><p>Navigate to web interface of SonarQube and refresh the page.</p><p>There we’ll see the report summary:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IhI_9tohxzlwFKYj_Mro1g.png" /></figure><p>Discovered issues can either be a Bug, Vulnerability, Code Smell, Coverage or Duplication. Each category has a corresponding number of issues or a percentage value.</p><p>Moreover, issues can have one of five different severity levels: blocker, critical, major, minor and info. Just in front of the project name is an icon that displays the Quality Gate status — passed (green) or failed (red).</p><p>Clicking on the project name will take us to a dedicated dashboard where we can explore issues particular to the project in greater detail.</p><p>We can see the project code, activity and perform administration tasks from the project dashboard — each available on a separate tab.</p><p>Though there is a global Issues tab, the Issues tab on the project dashboard display issues specific to the project concerned alone:</p><p>The issues tab always display the category, severity level, tag(s), and the calculated effort (regarding time) it will take to rectify an issue.</p><p>From the issues tab, it’s possible to assign an issue to another user, comment on it, and change its severity level. Clicking on the issue itself will show more detail about the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*282Q3P5Fk9k5c5qewbZh8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6tuA0jckLhmgZNCiVkAuKg.png" /></figure><h3><strong>Quality Gate :</strong></h3><p>A Quality Gate is a set of conditions the project must meet before it can qualify for production release. It answers one question: can I push my code to production in its current state or not?</p><p>Ensuring code quality of “new” code while fixing existing ones is one good way to maintain a good codebase over time. The Quality Gate facilitates setting up rules for validating every new code added to the codebase on subsequent analysis.</p><p>The conditions set in the Quality Gate still affect unmodified code segments. If we can prevent new issues arising, over time, we’ll eliminate all issues.</p><p>This approach is comparable to fixing the water leakage from the source. This brings us to a particular term — Leakage Period. This is the period between two analyses/versions of the project.</p><p>If we rerun the analysis, on the same project, the overview tab of the project dashboard will show results for the leak period:</p><p><strong>Adding Custom Quality Gate :</strong></p><p>First, we need to click on the Quality Gates tab and then click on the Create button which is on the left of the page. We’ll need to give it a name.</p><p>Now we can set the conditions we want:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*grE9MN3E3kv769_zjj5aSw.png" /></figure><p><strong>From the <em>Add Condition</em> drop-down, let’s choose <em>Blocker Issues</em></strong><em>; </em>it’ll immediately show up on the list of conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*opeMTAzk5m2wctBZmplLMg.png" /></figure><p>Assign this quality gate to Sonar Project,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0gIxrzZ-FFSdvOoF0W16A.png" /></figure><h3>Create a SonarQube service connection in Azure DevOps</h3><p>Complete the following steps to create a service connection for Azure Pipelines.</p><ol><li>Sign in to your organization (https://dev.azure.com/{yourorganization}) and select your project.</li><li>Select <strong>Project settings &gt; Service connections.</strong></li><li>Select <strong>+ New service connection</strong>, select the type of service connection that you need, and then select <strong>Next</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8foavrjur91GR160mYJp6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*CaLp9n_71v0-fOcoDEBDyg.png" /></figure><h3>DevOps Setup (YAML):</h3><p>You’ll need the Azure DevOps extension installed in your organization. Download link is given below,</p><p><a href="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube">SonarQube — Visual Studio Marketplace</a></p><p>Add the below SonarQube Task in the Build Pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*6HoGkmb-v9p3roeQFk4m4g.png" /></figure><p>Modify the<strong> Prepare analysis on SonarQube </strong>Task in Azure Pipeline,</p><pre>steps:<br>- task: sonarsource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4<br>  displayName: &#39;Prepare analysis on SonarQube&#39;<br>  inputs:<br>    SonarQube: SonarQubeConnectionBuildServer<br>    projectKey: &#39;&lt;SonarQubeProjectKey&gt;&#39;<br>    projectName: &lt;SonarQubeProjectName&gt;<br>    extraProperties: &#39;sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/TestResults/coverage.opencover.xml&#39;</pre><h3>Preventing pull request merges when the Quality Gate fails :</h3><p>Prevent the merge of pull requests with a failed Quality Gate by adding a SonarQube/quality gate status check branch policy on the target branch. And this only works in <strong>SonarCloud</strong> or with the <strong>SonarQube Developer Edition</strong>!</p><p>Check out this YouTube <a href="https://www.youtube.com/watch?v=be5aw9_7bBU">link</a> video for a quick overview on preventing pull requests from being merged when they are failing the Quality Gate.</p><p><strong>Links :</strong> <a href="https://next.sonarqube.com/sonarqube/documentation/analysis/pull-request/">https://next.sonarqube.com/sonarqube/documentation/analysis/pull-request/</a></p><p><strong>Configuration Steps :</strong> <a href="https://writeabout.net/2019/04/18/use-pull-request-decoration-in-azure-devops-with-sonarcloud/">https://writeabout.net/2019/04/18/use-pull-request-decoration-in-azure-devops-with-sonarcloud/</a></p><p><strong>Release deployment control using gates</strong><br>Gates allow automatic collection of health signals from external services, and then promote the release when all the signals are successful at the same time or stop the deployment on timeout.</p><p><strong>Source :</strong> <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/release/approvals/gates?view=azure-devops">https://docs.microsoft.com/en-us/azure/devops/pipelines/release/approvals/gates?view=azure-devops</a></p><p><strong>Links :</strong> <a href="https://dev.to/vivekanandrapaka/sonar-cloud-quality-check-and-pre-deployment-gates-with-azure-devops-2pd7">https://dev.to/vivekanandrapaka/sonar-cloud-quality-check-and-pre-deployment-gates-with-azure-devops-2pd7</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea5558e9e3be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real-time Code Quality Scan with SonarLint in Visual Studio Code]]></title>
            <link>https://medium.com/@dijin123/real-time-code-quality-scan-with-sonarlint-in-visual-studio-code-64c3c7b34131?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c3c7b34131</guid>
            <category><![CDATA[sonarlint]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[code-quality-tools]]></category>
            <category><![CDATA[aspdotnet-development]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 07:10:40 GMT</pubDate>
            <atom:updated>2022-02-04T07:10:40.269Z</atom:updated>
            <content:encoded><![CDATA[<p>Code Quality using SonarLint : Visual Studio Code</p><h3>What is SonarLint?</h3><p>SonarLint an extension you can add to an IDE such as Visual Studio that can provide developers real-time feedback on the quality of the code. It can detect issues in seconds, which can improve productivity. SonarSource describes SonarLint as a capability that can work like a spell checker for text since it detects issues in your code as you go.</p><h3>Instant View</h3><p>Markers automatically appear on quality issues when opening a file.</p><p>SonarLint highlights code issues with markers on open files. It also provides an issues summary table for a selected component in the IDE, including the creation time of the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*w0JhlPsJU39HhsPw.png" /></figure><h3>On-the-fly Detection</h3><p>Issues appear as you type code.</p><p>SonarLint offers the ability to see problems as you code, like a spell checker for text. This is done by subtly pointing out the issue without distracting the developer so that he can focus on code but is still notified of the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*cmXXY8c8s851be2F.png" /></figure><h3>Smart Education</h3><p>Error descriptions come with issue detection.</p><p>Once SonarLint detects an issue, it also shows the associated documentation to help the developer understand the issue and why it is a problem. It gives a compliant and non compliant code example and shows how to resolve the example issue. Easy, powerful and fun to use: a good way for developers to learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*UvTN7s76geLruPsp.png" /></figure><h3>Push Notifications</h3><p>Get real-time code quality notifications in your IDE as you work. Track Quality Gate status (failed, passed, warning) or that an analysis has assigned a new issue to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*CdWFC3JM0HsqmvJL.png" /></figure><h3>Adding SonarLint to Visual Studio Code</h3><p><strong>Prerequisites</strong></p><ul><li>A computer that works and is connected to the Internet. (Install the SonarLint plugin)</li><li>A working SonarQube (6.7.4+) server.</li><li>A recent version of Visual Studio Code.</li><li><strong><em>A Java Runtime (JRE) 8 or 11 installed on your computer</em></strong>.</li></ul><p><strong>Installation &amp; Configuration</strong></p><ul><li>In Visual Studio Code, go to the Marketplace and download SonarLint</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFXrgr8WVztCRpJJNDX5Vg.png" /></figure><ul><li>Restart/Reload Visual Studio Code.</li><li>In the Visual Studio Code Settings, search SonarLint</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-4u17g7a--1ytI4Mq1wQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMKIC4duhmlarxceleGpcw.png" /></figure><pre>{<br>    &quot;sonarlint.connectedMode.project&quot;: {<br>        &quot;projectKey&quot;: &quot;SampleAngularApp&quot;<br>    },<br>    &quot;sonarlint.ls.javaHome&quot;: &quot;C:\\Program Files\\Java\\jre1.8.0_291&quot;,<br>    &quot;sonarlint.connectedMode.connections.sonarqube&quot;: [<br>        {   <br>            &quot;serverUrl&quot;: &quot;http://sonarqubece.abcd.com:443&quot;,<br>            &quot;token&quot;: &quot;51df88dd4ea115f9f6afd7a5f457859b1d24b9f2&quot;<br>        }<br>    ]<br>}</pre><p>Now hit <strong>Ctrl+Shift+P (Windows/Linux)</strong> or Shift+Command+P(Mac) to open the Command Palette, and type inSonarLint to bring up the SonarLint commands and run “<strong>SonarLint: Update all bindings to SonarQube/SonarCloud</strong>”. If any changes are made on the SonarQube server you should repeat this step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jowMEg29ddF6SDwfOarUNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNAHj8vM63D3a7pqoab-cg.png" /></figure><p>SonarLint in Visual Studio Code is that you will see a helper notify you with errors or warnings as you write code. This allows you to fix code right away in real time. This can drastically improve efficiency for developers and it will help reduce time needed for code checks.</p><p><strong>Token Generation in SonarQube:</strong></p><p>Navigate to SonarQube Dashboard page. <em>Administration &gt; Security &gt; Tokens</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prhttpP4aTE6bzIZpW7D1w.png" /></figure><p><strong>Java JRE Path setting in Visual Studio Code:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lpSJzanRpKleAMUKJyf_gQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c3c7b34131" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real-time Code Quality with SonarLint in Visual Studio]]></title>
            <link>https://medium.com/@dijin123/real-time-code-quality-with-sonarlint-in-visual-studio-452691476b82?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/452691476b82</guid>
            <category><![CDATA[code-quality-tools]]></category>
            <category><![CDATA[sonarlint]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 06:49:04 GMT</pubDate>
            <atom:updated>2022-02-04T06:49:04.249Z</atom:updated>
            <content:encoded><![CDATA[<p>Code Quality using SonarLint</p><h3><strong>What is SonarLint?</strong></h3><p>SonarLint an extension you can add to an IDE such as Visual Studio that can provide developers real-time feedback on the quality of the code. It can detect issues in seconds, which can improve productivity. SonarSource describes SonarLint as a capability that can work like a spell checker for text since it detects issues in your code as you go.</p><h3>Instant View</h3><p>Markers automatically appear on quality issues when opening a file.</p><p>SonarLint highlights code issues with markers on open files. It also provides an issues summary table for a selected component in the IDE, including the creation time of the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*OmXsYgQI3s5r73LX.png" /></figure><h3>On-the-fly Detection</h3><p>Issues appear as you type code.</p><p>SonarLint offers the ability to see problems as you code, like a spell checker for text. This is done by subtly pointing out the issue without distracting the developer so that he can focus on code but is still notified of the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*TT0GivEDvYWlDPgs.png" /></figure><h3>Smart Education</h3><p>Error descriptions come with issue detection.</p><p>Once SonarLint detects an issue, it also shows the associated documentation to help the developer understand the issue and why it is a problem. It gives a compliant and non compliant code example and shows how to resolve the example issue. Easy, powerful and fun to use: a good way for developers to learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*fK_5LAKOyI7bU96u.png" /></figure><h3>Push Notifications</h3><p>Get real-time code quality notifications in your IDE as you work. Track Quality Gate status (failed, passed, warning) or that an analysis has assigned a new issue to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1PmM_j6RfW1T8GTn.png" /></figure><h3><strong>Adding SonarLint to Visual Studio</strong></h3><p>In Visual Studio, SonarLint is an extension that can be installed by going to the following:</p><p><strong>Extenstions -&gt; Mange Extenstions -&gt; Online<br>OR<br>Download Link</strong> — <a href="https://www.sonarlint.org/visualstudio/">https://www.sonarlint.org/visualstudio/</a></p><p>Then in the search box, search for “SonarLint”. Once you see SonarLint, press “Download”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0HTuZK1AYoXH1HEqvDB7Q.png" /></figure><p>You must now sign out of Visual Studio to let the changes save properly. VSIX Installer will prompt you to allow for it to modify Visual Studio. After this is completed, you can now use SonarLint for your project.</p><p><strong>Using SonarLint in your project</strong></p><p>To connect an existing project with SonarQube, click on the following:</p><p><strong>Analyze -&gt; Manage SonarQube Connections</strong></p><p>Then you will need to press “Connect” to connect to your SonarQube Server. Add in the SonarQube server, username, and password information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*ZXOPUpbginbfbLNrUOKAVw.png" /></figure><p>Once you connect, you will see SonarLint connect to the SonarQube server. Then you will see a screen that will ask you to select a SonarQube project to bind your solution to. When you do this, your changes in SonarQube will now be synced to Visual Studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*rk4NukBMsPhI4bjo4UWlug.png" /></figure><p><strong>Analyzing your code</strong></p><p>You can now analyze your code. You can do this with the following:</p><p><strong>Right click solution -&gt; Analysis and Code Clenup -&gt; Run Code Analysis on Solution</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*mUjywOoFEV_HCziFn-pjyA.png" /></figure><p>If there are any errors or issue with your code, you will see it in the “Error List” box built into Visual Studio. Moreover, you will be able to see the UI line items directly in Visual Studio. Normally, you would need to log into the SonarQube web application directly to get this information.</p><p>Another benefit of SonarLint in Visual Studio is that you will see a helper notify you with errors or warnings as you write code. This allows you to fix code right away in real time. This can drastically improve efficiency for developers and it will help reduce time needed for code checks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=452691476b82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Unit Testing Code Coverage Report in Azure DevOps Build Pipeline]]></title>
            <link>https://medium.com/@dijin123/angular-unit-testing-code-coverage-report-in-azure-devops-build-pipeline-a062c881609c?source=rss-5dfa347e2ba6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a062c881609c</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[azure-pipelines]]></category>
            <category><![CDATA[code-coverage]]></category>
            <category><![CDATA[unit-test-report]]></category>
            <dc:creator><![CDATA[Dijin Augustine]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 06:24:51 GMT</pubDate>
            <atom:updated>2022-02-04T06:24:51.752Z</atom:updated>
            <content:encoded><![CDATA[<p>DevOps Basic Topics : .NET Code Coverage report in Azure Pipeline</p><p>Unit tests help to ensure functionality and provide a means of verification for refactoring efforts. Code coverage is a measurement of the amount of code that is run by unit tests — either lines, branches, or methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*vMKIhvMil3P0vQpi.png" /></figure><p>This article discusses the usage of code coverage for unit testing in Angular Project</p><h3>Unit Test in UI Angular project</h3><p>The new angular web UI project is having an inbuilt unit testing template file(.spec.ts) which is used to cover the methods/functions defined in Components/Services etc. Mainly the methods defined in these areas must be validated by unit tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*yhcqPoUJCTetbv26rppyHw.png" /></figure><p><strong>Create an Angular project with jasmine and karma</strong></p><p>As the angular team recommends we are going to use angular-cli to create our app. By doing this the configuration of jasmine and karma comes resolved for us.</p><p>Install angular-cli and create a new project:</p><ul><li>npm install -g @angular/cli</li><li>ng new angular-unit-testing</li></ul><p>When you create the project all the dependencies get installed among them everything you are going to need to create the tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*tKeBBBSJGkQZeUFPWnCGtA.png" /></figure><p>In the image above you can see all the dependencies installed for testing purposes. Let’s go through the more important ones;</p><ul><li><strong>jasmine-core. </strong><a href="https://jasmine.github.io/">Jasmine</a> is the framework we are going to use to create our tests. It has a bunch of functionalities to allow us the write different kinds of tests.</li><li><strong>karma. </strong><a href="https://karma-runner.github.io/1.0/index.html">Karma</a> is a task runner for our tests. It uses a configuration file in order to set the startup file, the reporters, the testing framework, the browser among other things.</li><li>The rest of the dependencies are mainly reporters for our tests, tools to use karma and jasmine and browser launchers.</li></ul><p>To run the test you only need to run the command “ng test”. This command is going to execute the tests, open the browser, show a console and a browser report and, not less important, leave the execution of the test in watch mode.</p><p><strong>Karma Config</strong></p><p>Let’s take a look at the karma configuration file (<strong>karma.conf.js</strong>) created by angular-cli.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*xXV5zm2kJk7HIqTIQ1N1pA.png" /></figure><p>You probably can guess what most of these configuration properties are for, but let’s go through some of them.</p><ul><li><strong>frameworks</strong>: this is where jasmine gets set as a testing framework. If you want to use another framework this is the place to do it.</li><li><strong>reporters</strong>: this is where you set the reporters. You can change them or add new ones.</li><li><strong>autoWatch</strong>: if this is set to true, the tests run in watch mode. If you change any test and save the file the tests are re-build and re-run.</li><li><strong>browsers: </strong>this is where you set the browser where the test should run. By default it is chrome but you can install and use other browser launchers.</li></ul><p><strong>Test entry file</strong></p><p>The angular-cli configuration of karma uses the file “src &gt; test.ts” as the entry point of the tests for the application. Let’s take a look to that file;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JFmspdlhreRE1b2ODkaRTA.png" /></figure><p>We have a lot of things going on here. You are probably never going to need to change this file but let’s go and discuss some of the things happening;</p><ul><li>An environment to run angular tests is being created using all the imports at the beginning of the file.</li><li>TestBed is a powerful unit testing tool provided by angular, and it is initialized in this file.</li><li>Finally, karma loads all the test files of the application matching their names against a regular expression. All files inside our app folder that has “spec.ts” on its name are considered a test.</li></ul><h3>DevOps Build Pipeline Setup (YAML):</h3><p>Once you have the necessary prerequisites in place, you can add the following tasks to your Azure Build Pipeline to generate a code coverage report inside of Azure DevOps’ build results:</p><p>There is no change in the <strong>Use Node 14.x, Angular CLI and npm install Tasks </strong>in Azure Build Pipeline<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*q-OZmuQ59eRjpGNtdDQ_iQ.png" /></figure><p>Modify the <strong>Test Task</strong> in Azure Pipeline,</p><pre>steps:<br>- task: Npm@1<br>  displayName: Test<br>  inputs:<br>    command: custom<br>    workingDir: &#39;Client/SampleApp&#39;<br>    verbose: false<br>    customCommand: &#39;run test-headless&#39;<br>  continueOnError: true</pre><p><strong>Note: </strong>‘test-headless’ is the build command parameter</p><p><strong>package.json</strong> file change is given below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5qztGzDg9HQJ0nJKJajmAg.png" /></figure><p>Modify the<strong> Publish Test Result Task </strong>in Azure Pipeline,</p><pre>steps:<br>- task: PublishTestResults@2<br>  displayName: &#39;Publish Test Results $(Build.SourcesDirectory)/Client/SampleApp/projects/web-app/test_report/TESTS-*.xml&#39;<br>  inputs:<br>    testResultsFiles: &#39;$(Build.SourcesDirectory)/Client/SampleApp/projects/web-app/test_report/TESTS-*.xml&#39;</pre><p>Modify the<strong> Publish Code Coverage Task </strong>in Azure Pipeline,</p><pre>steps:<br>- task: PublishCodeCoverageResults@1<br>  displayName: &#39;Publish code coverage from $(Build.SourcesDirectory)/Client/SampleApp/coverage/**/*cobertura-coverage.xml&#39;<br>  inputs:<br>    codeCoverageTool: Cobertura<br>    summaryFileLocation: &#39;$(Build.SourcesDirectory)/Client/SampleApp/coverage/**/*cobertura-coverage.xml&#39;</pre><p>There is no change in <strong>Build and Publish Artifact Task</strong>,</p><pre>steps:<br>- task: Npm@1<br>  displayName: Build<br>  inputs:<br>    command: custom<br>    workingDir: &#39;Client/SampleApp&#39;<br>    verbose: false<br>    customCommand: &#39;run build-dev&#39;</pre><p><strong>Note: </strong>‘build-dev’ is the build command parameter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bz0UFEqYfTFq4vj7r79noQ.png" /></figure><pre>steps:<br>- task: PublishBuildArtifacts@1<br>  displayName: &#39;Publish Artifact: dist&#39;<br>  inputs:<br>    PathtoPublish: &#39;Client\SampleApp\dist\web-app&#39;<br>    ArtifactName: dist</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a062c881609c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>