Awarded – Microsoft MVP 2nd time in a row

Gladly sharing that I’m awarded Microsoft MVP 2nd time in a row.

MVP-Image

Thank you Microsoft for the recognition again. I want to extend my thanks to all my friends and whosoever has supported me along the way! Thank you.

Microsoft Most Valuable Professional (MVP) award is given to “exceptional, independent community leaders who share their passion, technical expertise, and real-world knowledge of Microsoft products with others”. Please explore more on – What it takes to be an MVP

Time to cheer! 🙂 and get back to community work!! 😉

/Sunny.

(47)

[Powershell] Azure Automation – Delete all Azure Logic Apps in a Resource Group

In one of my recent projects I had a requirement to delete all the Logic Apps from a resource group on Azure. In this quick blog I’m sharing how to delete all the logic apps in one go inside a resource group using the following Powershell script:

Prerequisites:

  • Service Principal Account Credentials (ClientId / Secret)
  • SubscriptionId
  • TenantId
  • ResourceGroupName

Please refer to this blog if you don’t know where to get Service Principal Account Credentials – Managing Azure Logic Apps using .NET SDK.

Create the Service Principal Account and add a Contributor Role to it – for given subscription & resource group. You can find the commands in the blog mentioned above.

Script
———————————————————-
Write-Host 'Deleting Logic Apps...'
$resourceGroupName = <resource group>
$tenantId =<tenantId>
$clientId =<clientId>
$subscriptionId =<subscriptionId>
$secPassword = <secretPassword>
$secretPassword = ConvertTo-SecureString $secPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($clientId,$secretPassword)
Login-AzureRmAccount -ServicePrincipal -Tenant $tenantId -Credential $cred
Select-AzureRMSubscription -SubscriptionId $subscriptionId -tenantId $tenantId

$logicApps = @()
Find-AzureRmResource -ResourceGroupName LogicApps -ResourceType Microsoft.Logic/workflows | ForEach-Object{$logicApps += $_}

write-host $logicApps.Count 'Logic App(s) found'
foreach ($logicApp in $logicApps){
    write-host 'Deleting Logic App :' $logicApp.Name
    Remove-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $logicApp.Name -Force
}
———————————————————
Happy Learning 🙂

(14)

[Powershell] Export Self-Signed Certificate

 

$cert = New-SelfSignedCertificate -DnsName yourdomain.cloudapp.net -CertStoreLocation “cert:\LocalMachine\My”

$password = ConvertTo-SecureString -String “Password@1234” -Force -AsPlainText

#Generate .pfx
Export-PfxCertificate -Cert $cert -FilePath “.\my-cert-file.pfx” -Password $password

#Export to .cer format
Export-Certificate -Type CERT -Cert $cert -FilePath .\my-cert-file.cer

(11)

[Software Review] – Stellar Phoenix Windows Data Recovery

Data plays a very crucial role for each individual whether it is Home user or Enterprises where as  damage to your computer can  make your data unreadable and that’s where you need a good data recovery software to get you out of trouble, by recovering your valuable data. It has happened to me and I have experienced losing valuable data. Trust me, it is troublesome when you cannot go back in time and re-create it. But if you have a good Data Recovery Software the chances of losing data are least.

Few days back I came to know about this user friendly software “Stellar Phoenix Windows Data Recovery“ and  also got a chance to test it.

Stellar Data Recovery offers a wide range of applications for Data Recovery with two flagship products Windows Data Recovery – Home and Windows Data Recovery – Professional . Professional version helps recovering data from the storage devices with extreme crash scenarios – like recovering lost or inaccessible hard drive partitions.

 

versions

 

I used a 4 GB Pen drive for testing – on a machine with following configuration:

OS Windows 8.1 Enterprise
RAM 12 GB
CPU Intel(R) Core(TM) i5-5200U /2.20 GHz
Data Recovery Software Stellar Phoenix Windows Data Recovery – Home

 

The Application has a clean UI – allowing you to select what you want to recover. Since I was using it first time so I want to go with   “All Data” option.

 

2

 

 

I start with formatting the drive and then copied some files to it (around 90 MB in total). I combined multiple file formats to make sure it works well with different file formats.

 

1

For testing the data recovery feature – I first deleted all the contents permanently (using SHIFT + DEL) from the Flash Drive and run the  Stellar Phoenix Data Recovery software.

 

4

 

For testing the data recovery feature – I first deleted all the contents permanently (using SHIFT + DEL) from the Flash Drive and run the  Stellar Phoenix Data Recovery software.

 

5
I was quite happy to see all the files appearing on the screen which I had permanently deleted from the Flash Drive and then I click on Recover button and select the folder where I wanted to save the files . You can turn the preview off if you want to get quick results.

Always make sure that you have enough storage to save the recovered files. For example – if you’re trying to recover data of 10 GB, there should be enough space to save files of 10 GB on your functional storage (Hard Disk in most cases).

I didn’t run “Deep Scan” because it showed me all the files. Though I did something different. I formatted the Flash Drive again and ran Deep Scan on it. Normal scan didn’t show me any results.
7 deep scanning

The Deep Scan on the 4GB Pen drive took nearly 30 minutes of run but unfortunately it couldn’t find any file.

 

8 deep scan result after full format

Hence the data can’t be recovered if you reformat the drive and it is actually not possible if you run any Recovery Software.

You can recover 1 GB of data with free version  and require  upgrade if you want to recover extensive data.

The User Interface of the application is very intuitive . It has all the relevant features and one of the most Effective and User friendly Data Recovery software.

I recommend Stellar Phoenix Windows Data Recovery as you can recover your data in blink of an eye with it.

(59)

How to: Generate Free SSL Certificate for a domain and upload on Azure Website?

Today  I spent nearly 2 hours browsing through the Web for ways to create an SSL Certificate for Free from Let’s Encrypt. I explored letsencrypt.org  and various other websites, and landed up on one with the easiest steps. While trying others I got stuck many times in the middle as many of them have a procedure involving some Linux bash commands unclear to me or requiring some complex process. I wanted to Generate a PFX file which I can simply select and upload  to Microsoft Azure Website and it was very hectic browsing through for hours finding the right procedure.

Documentation on letsencrypt.org is very difficult to follow. In the process I came across this lovely site which facilitates simplistic steps (as on today, for me) to Generate an SSL Certificate:

SSL For Free (www.sslforfree.com)

The procedure involves OpenSSL command line tool to generate the PFX file as a final step.

First step is to enter the site domain name(s) :

SSL_For_Free__1Next is the Domain Ownership Verification:

SSL-Domain-VerificationThat’s it. On successful verification it will present you the Certificates and private key in plain text and will allow you to download them as files in a Bundle.

SSL-Generated

SSL-Generated 2

I downloaded the bundle and I got three files inside:

  • ca_bundle.crt
  • certificate.crt
  • private.key

As a final step, to generate the PFX (Personal Information Exchange) file I had to use OpenSSL command line tool which I downloaded from here:

http://slproweb.com/products/Win32OpenSSL.html

I downloaded version: “Win64 OpenSSL v1.0.2k” from the available list as my machine is 64-bit. If you have a 32-bit machine, go for a 32-bit binary.

You need to run the following command in command prompt after the installation of OpenSSL is completed. Make sure you update the “PATH” System Environment variable with OpenSSL’s installation folder path, so that you don’t have to be inside OpenSSL bin folder every time to access the OpenSSL tool.

openssl pkcs12 -export -out “certificate_combined.pfx” -inkey “private.key” -in “certificate.crt” -certfile ca_bundle.crt

 

“certificate_combined.pfx” is the final certificate file that you will be uploading to the portal. OpenSSL-Command

Here’s the PFX file I got generated ready to upload.

PFX file

 

I hope these steps will help you minimize the time to find the right solution for SSL Generation on Windows OS. This certificate however is not Limited to Azure Websites only and you can use if wherever PFX can be used. Also, SSL Certificates generated from this portal will be expired in 90 days, so make sure you regenerate another within this time frame.

In the process i also found this website very helpful to identify SSL installation: https://www.ssllabs.com

This website produces good SSL analysis for any specified website and I will leave that to you to explore more.

ssllabs

 

Uploading this to your Azure Website and enjoy SSL benefits without spending a single penny! Hope this helps someone like 🙂

Happy Learning, Cheers!!

(137)

[Quick Tip]: Use Windows Explorer address bar for “commands”

Even though you’re a Windows OS user for a very long time I’m sure you would love to know this! Here’s a quick tip that you might unaware of so far.

 

You can use Windows Explorer’s Address Bar just like you use Run Command:

Run_Command_Pallette

Under any window while browsing files on your computer just point your cursor and click the Address Bar, or press “ALT + D” (feels better than moving the mouse), and type the command as you would have typed in Run Command form:

Windows-Explorer-Run-Command_

hit enter and that’s it. You get a command prompt opened on screen (because of I’ve typed “cmd” ).

I didn’t know this so far even I’m using windows since my childhood 🙂

Cheers!

 

(11)

TypeScript Fundamentals – Session Recap

Today I participated in one of the events hosted by C# Corner, held at “C# Corner – Delhi Chapter”.  I spoke on Fundamentals of TypeScript. Below are few glimpses from the session. I also got few licenses of OzCode – A magical debugging tool for Visual Studio to distribute. We did a raffle to select the winners.

This slideshow requires JavaScript.

Below are the names of OzCode License Winners from the raffle:

Nitish Kumar – nk899245@gmail.com, and

Sahil Tyagi – sahilt3@gmail.com

For those who did not get the license – you can get a 50% discount by vising this link: http://www.oz-code.com/promotion?discountcode=CSharpCorner_50

The link or promo-code is valid for next 3 days only. Thank you OzCode Team for the kind gesture.

I’m attaching the PPT from the session for reference:

Thank you everyone who attended the session. I hope it was useful and have added value to your professional skills.

Happy learning 🙂

 

(11)

How to manage IIS Server online

Hey folks, now it’s possible to manage your IIS (Internet Information Services) Server right from the browser. I’m here going to share the steps I was required to perform before it started running. It was simple though. Right now the service is in “Preview” mode, hope to see this launched very soon!

“To start, head over to https://manage.iis.net and download IIS Administration Setup.

3-download-iis-administration-setup

As soon the download starts, it shows you another screen waiting for the service to be installed and run, and let you proceed further.

4-wait-for-the-installation

 

The installation failed twice. It asked me to install “Microsoft Visual C++ 2015 Redistributable (x64)” first and then asked to install “Microsoft .Net Core 1.0.1 Windows Server Hosting”. I had no other trouble during the installation. My machine config at the time is Windows 10 Enterprise (x64) / i5 / 12 GB.

I did an IIS reset and the waiting window started receiving signals 🙂 The first screen prompted me with a default port (PORT# 55539) on localhost address and asked me to supply an “Access Token”.

6-connection-manager

The link below the input box lets you generate or refresh the access token. In the background it installed “Microsoft IIS Administation Service” exposing a web service on port 55539. I’m yet to figure out if the port it configurable.

Generate an access token and supply to the IIS Management form and you’re done. It also allows you to set how soon the access token should be expired.

7-create-access-key

8-create-access-key_2

9-access-key-generated

10-connect-to-iis-administration

 

IIS Administration Setup needs to be installed on the machine running IIS Server. To manage any IIS server online you just need this Access Token.

So, the steps are as follow:

1. Install IIS Administration Setup and its dependencies on IIS Server machine. (It will install and start “Microsoft IIS Admistration” Service)

2. Generate Access Token on that machine

3. Use that token any where in the world to access IIS Server which belongs to the token. Make sure the port 55539 is allowed from the network you’re trying to access the IIS Server over the web.

Note: you can refresh the key anytime you want to (or an access token has been compromised).

Server and Website Administration is very smooth with the web console. All options from IIS Manager is available online and is very user friendly. You can do pretty much everything from the web console that comes available with IIS Manager on Windows.

Exploring websites:

11-iis-connected

Creating a website:

12-create-web-site

13-select-from-available-pools

Managing IIS Server:

15-server-specific-settings 14-administer-any-website

I’ll leave rest of the exploration for you. Hope you enjoyed it. Thanks for reading!

Happy Learning 🙂

(22)

C# How To Run C# Code Inside Sublime Text

Hey folks, I want to share a tip. Sublime Text is my favorite for quick scripts, text editing and doing other scripting things or anything which doesn’t require a whole IDE. I love the speed too much and it is super-fast. In the process, I found that you can run C# scripts too, right from inside the Sublime Text, like you can run JavaScript. This is what I will brief you about:
Sometime back, I wrote on configuring Sublime Text for JavaScript too. Here’s the link, if you want to learn:
Ok, let’s start. The process is simple. You need to have an executable file, which Sublime Text will use to execute the scripts.
For C#, we will use scriptcs. Like NodeJS can run JavaScript, scriptcs runs C#. You can write and execute an Application with only one line of code.

Steps to configure Sublime Text for executing C# codes
Step 1: Install scriptcs

In order to install scriptcs, you need to have chocolatey. Chocolatey is a package manager for Windows.

You can install it in two ways:
  1. Using the command prompt (cmd.exe): Run the command, given below in the console:
    1. @powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((new-object net.webclient).DownloadString(‘https://chocolatey.org/install.ps1’))” && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
  2. Using Powershell : Run either of the following commands
    1. iex ((newobject net.webclient).DownloadString(‘https://chocolatey.org/install.ps1’))
    2. iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex  

    There’s a chance you will get an error while running the script due to a Powershell Execution policy. By default, it is set to “Restricted” to prevent the harmful scripts from running. You can check the current execution policy by running “Get-ExecutionPolicy” command in Powershell.

If you encounter this error, set the execution policy to “RemoteSigned” and run the installation command again. Use the command given below:
  1. Set-ExecutionPolicy RemoteSigned
 Make sure you start the Powershell console in Administrator mode, otherwise the change will not take place.

 

 

Read full article here on C# Corner:

http://www.c-sharpcorner.com/article/how-to-run-c-sharp-code-inside-sublime-text/

Happy learning 🙂

(31)

Presented on Javascript Best Practices

Today we organized a user group meet at C# Corner – Delhi Chapter with sessions based on  MVC, Azure, JavaScript and AngularJS. I spoke on JavaScript Best Practices. Much appreciate the learning spirit of the attendees as they made it out even in the rain. Hats off to you guys! We discussion the DOs and DONTs of common programming constructs in JavaScript.

Sunny

It was great learning and fun again 🙂

Hope to have another one on Node.js very soon.

Happy learning 🙂

 

 

(7)