Posts

4 Ways to define Methods in JavaScript Object

Image
In this blog we will see how we can define a function in an object using 4 different syntax style. Four ways to define a method (function) in a JavaScript object are given below: Method without using function  keyword Method with another function whose name is hidden Method with anonymous function  Method with arrow function

Securing Powershell Scripts with Code-Signing Certificate

Image
Ideally, all Powershell scripts should be signed by a code signing certificate by a certificate authority that is trusted by the host machine. You can also sign you Powershell script with a a self-signed code-signing certificate. You don't need any other tools like make cert to sign your Powershell script to generate self-signed code-signing certificate because Powershell has a built-in cmdlet ( New-SelfSignedCertificate ) to generate it. Create a Self-Signed Code-Signing Certificate with Powershell CmdLet $subject = "Imran Aftab Rana”  $cert = New-SelfSignedCertificate -Subject $subject -Type CodeSigningCert -CertStoreLocation cert:\LocalMachine\My The above cmdlet creates a self-signed code-signing certificate and places it in Local Machine Personal certificate store. Export a Code-Signing Certificate with Powershell CmdLet You can also export the certificate into a .p7b  file and import it into another system or within same machine. Export-Certificate -C

.NET Core 3 officially comes to Windows IoT Core

Image
Finally, the wait is over! Microsoft announced to support .NET Core on Windows ARM32 devices which means .NET Core will be fully supported on Windows 10 IoT Core. Although there have been few hacks to run .Net Core on Windows 10 IoT Core by the support of community  here  which makes .Net Core runtime component available on Windows IoT Core but the SDK was not available so any DLR features were not available nor you could build .NET Core application from within Windows 10 IoT Core. Here is the step-by-step guide on how to create and run .NET Core 3 apps on Windows 10 IoT Core. Step 1: Download .NET Core 3 preview 2 SDK from  here . Step 2: Extract the SDK zip file in C:\Program Files\dotnet\  directory on Windows 10 IoT Core through ftp service ( on windows go to  RUN then type  \\{ip-address}\c$ where{ip-address} is the ip address of windows iot core). Step 3: Open Powershell  in administrator  mode, initialize a Powershell session with your Windows IoT core device an

Setting up CI and CD pipeline in Azure DevOps for ASP.NET Core and Azure Web Apps

Image
In the last post I talked about Azure DevOps , now we will look into a practical use case of Azure DevOps where we will setup a complete continuous integration (CI) and continuous deployment/delivery(CD) pipeline for a ASP.NET Core project hosted on Azure Web Apps . We will host our project solution on Azure Repo . The basic idea is that we will create an Azure Web app, setup our project on Azure Repo, create CD & CD pipeline on Azure DevOps, and see things in action when we push our code to master branch. Let's get started: Open Azure portal  and go to App Services and click on Create app service .  From the Marketplace templates, choose Web App . Click Create . Choose an app service name that is available, select OS be Windows, Publish by code, then choose an app service plan that fits your budget and click Create . Once the service is deployed, you will get a ntoification, open it and click Go to resource . Here you can see live l

Microsoft Azure DevOps : A Complete CI & CD solution in the cloud

Image
Microsoft announced Azure DevOps in last Quater of 2018. When it comes to project planning, project management, continuous integration (CI) and continuous delivery/deployment (CD) for agile practices, DevOps has always been a hot topic  so Microsoft decided to take the lead with a powerful cloud platform that makes everything available in a single place. No matter what platform or language or repository system your solution is, Azure DevOps got you covered with tools that work cross-platform. The services provided by Azure DevOps help developers build high quality software faster. The core services provided are:  Azure Pipelines Azure Boards Azure Artifacts Azure Repos Azure Test Plans Azure Pipelines Azure DevOps provides Azure pipelines to manage CI/CD tasks that supports any language, platform, and cloud. You can connect to a any Git repository and setup CI/CD workflow. Azure DevOps makes it incredibly easy to setup building, testing, and deployment workflow to

Understanding Powershell ExecutionPolicy and securing Powershell CmdLets/Scripts with Code-Signing Certificate

Image
One of the great things about Powershell is that its powerful and at the same time very safe. Powershell script cannot be executed as is unless user provides permission to execute PS script/cmdlet/module. This is generally set through Powershell Execution Policy. There are four types of Execution Policy : Allsigned RemoteSigned Restricted Unrestricted AllSigned  - Scripts will run only if they have been signed by a trusted publisher. RemoteSigned  - Scripts created locally will run, but those downloaded from the Internet will not (unless they are digitally signed by a trusted publisher). Restricted  - Scripts won’t run. Unrestricted  - Scripts will run regardless of where they have come from and whether they are signed. Ideally, all PS scripts should be digitally signed by a code-signing certificate. But in case, you don't want to buy an expensive code-signing certificate from a Certification Authority (CA), you can create a Self-Signed certificate and then add it

Implementing Basic and JWT Token authentication with C# .NET

Image
Authentication is probably the first thing you will encounter when building a secure Enterprise application and understanding how you can authenticate your application with different authentication protocols including third party authentication flows is really important. Whether you are building an app with ASP.NET, ASP.NET Core, WPF, UWP, Xamarin.Forms Xamarin Android, Xamarin iOS or .NET Core , all these frameworks provides client side networking libraries managed under System.NET namespace. Among all the classes  HttpClient has significant important. It can handle both HTTP and HTTPS connections. The beauty of this class is that it provides both hight level api and low level modification options to work with HTTP connections and you can make any modification  within the pipeline like handling HTTP message request/response, filtering, certificates, authorization and much more. In a nutshell, over HTTP most of the times you will work with two kinds of authentication: 1) Basi