Wriju's BLOG

.NET, Cloud and everything

Add User to Azure Active Directory using Graph API

This post should have appeared before the other related posts. However let us see from the ground up how we can build an application to use Azure AD Graph API to add the user to AAD. We first need to add an application in AAD Open the Azure AD in portal and open the application… Read more

Azure AD Graph API Create List of Users

Getting the list of users from AD is bit tricky. Firstly the call is Asynchronous and it is delayed. So no such straight forward foreach loop can help, Define the data model After that we can write something like, private async Task GetUsers() { List<UserGridData> userData = new List<UserGridData>(); var adClient = GetAADClient();   var… Read more

How to delete Azure AD User using Graph API

Adding user to Azure AD (AAD) is straight forward. However when we want to delete the user we may face some issues. I have discussed that in my previous post “Error Authorization_RequestDenied while Editing Azure AD Object” https://blogs.msdn.microsoft.com/wriju/2016/07/20/error-authorization_requestdenied-while-editing-azure-ad-object/ Once you have the Application added to AAD and using that to manipulate the objects you may… Read more

Error Authorization_RequestDenied while Editing Azure AD Object

Azure Active Directory allows applications to add user via Graph API through an Application Key. Generally there is no such issue when adding a new record. However, when someone wants to modify or delete a particular record may face the below issue   System.Data.Services.Client.DataServiceRequestException: An error occurred while processing this request. —> System.Data.Services.Client.DataServiceClientException: {“odata.error”:{“code”:”Authorization_RequestDenied“,”message”:{“lang”:”en”,”value”:”Insufficient privileges… Read more

Azure Active Directory Limits and Restrictions

There are certain limits to Azure AD when we work. As from my experience we often run into roadblocks when we run automated tests and the created objects are not destroyed afterwards. Here are some limits as of today, Application Max 10 users can be the owner of a single application Objects Max of 500,000… Read more

Git Extension Videos

Recently I am using Git Extension tool to use Git check-in. Here are some videos available Clone – Git Extensions – http://www.youtube.com/watch?v=TlZXSkJGKF8 Commit changes – http://www.youtube.com/watch?v=B8uvje6X7lo Push changes – http://www.youtube.com/watch?v=JByfXdbVAiE Pull changes – http://www.youtube.com/watch?v=9g8gXPsi5Ko Handle merge conflicts – http://www.youtube.com/watch?v=Kmc39RvuGM8 Namoskar!!!… Read more

How to Calculate SLA for a Product

When we work against multiple Azure Services for a Single Product we need to handle the SLA (Service Level Agreement) carefully. It is not min or max or the average of SLA per services. Let’s take an example, Table 1 Service SLA App Service 99.95% Azure Active Directory 99.9%       What these %… Read more

Generating ASP.NET Web API Documentation

Swagger is one of the most popular documentation and code generation engine for Web API. Unlike ASMX WebServices where we could use WSDL to generate C# class file to refer and write code which could compile we need some client wrapper in Web API. Hence Swagger comes handy to perform those documentation and client code… Read more

Free Sequence Diagram Tool

I happen to find one free online Sequence Diagram Tool at https://www.websequencediagrams.com/  The name is pretty easy to remember and it has little command like interface which translates your text to diagram. You may also be able to choose the format, I find it very helpful and quick. Namoskar!!!… Read more

How to create TFS 2015 and Deploy as Scheduled Job

Many times we may need to deploy some code which will run in the back ground as a continuous process or scheduled job. For this we often create Server Plugins. But the problem with Server Plugin is, it runs every time something or other happens. Let’s say you have created one Server Plugin which monitors… Read more

Open XML Create Excel from scratch

Open XML SDK allows you to work with Office products without installing any COM component. It also solves the age old issue of Office automation in server. Mainly in web scenario, it is recommended that one should not automate any office components or activities. Reason behind it is, if anything is crashed while automating then… Read more

Building Simple Math Problems for Jounior School

My daughter studies in junior school and we often face issues getting her enough problem for simple addition and subtractions. So I decided to make an algorithm to generate them. Conditions I needed to follow, 1. It needs to be two digit 2. For addition it needs to be no carry forward, means addition needs… Read more

Getting Azure VM Remote Desktop File in PowerShell

I often just need the Remote Desktop file of a VM  to work. For that it takes a longer time to go to the portal and download. Rather I prefer the PowerShell way of doing it. $vm = "WGTFS2015" $service = "WGTFS2015" $file = "C:\Azure\WGTFS2015.rdp" Get-AzureRemoteDesktopFile -Name $vm -ServiceName $service -LocalPath $file Invoke-Item $file Namoskar!!!… Read more

How to create Shared Access Signature (SAS) for Blob and Container

There are few ways by which you could created Shared Access Signature (SAS) for Azure Storage Blob or Container. This one is probably the easiest. 1. Download and install Azure Storage Explorer from http://azurestorageexplorer.codeplex.com/ 2. Then add the storage account name and key 3. Then select a container or Blob and select “Security” 4. Then… Read more

Moving TFS 2015 VM to Azure as an Image and Creating Machine from It

As I had to use TFS 2015 and the quickest option was to get the ready VM by Visual Studio ALM team and push it to Azure. This is what I did 1. Created a VM in Azure 2. Downloaded the TFS VM as described in Blog http://vsalmvm.azurewebsites.net/alm-vm-2015-available-now/ 3. You must use Free Download Manager… Read more

Azure Certification Free Trainings

Below are the related courses for Azure Certification For 70-532 use Developing Microsoft Azure Solutions http://www.microsoftvirtualacademy.com/training-courses/developing-microsoft-azure-solutions For 70-533 use Establish Microsoft Azure IaaS Technical Fundamentals http://www.microsoftvirtualacademy.com/training-courses/establish-microsoft-azure-iaas-technical-fundamentals For 70-534 use Architecting Microsoft Azure Solutions http://www.microsoftvirtualacademy.com/training-courses/architecting-microsoft-azure-solutions Namoskar!!!… Read more

PowerShell why should you learn and how must start

If you really care about performing Automation in your System dominated by Microsoft products its high time that you start thinking seriously about PowerShell. Now since you are forced to use PowerShell a many of you might already have started but getting difficulties of interpreting the way it is written. Or you are writing in… Read more

Azure PowerShell Know the differences

There are a bunch of confusing PowerShell commands which looks the same by their name. Add-AzureDataDisk : Adds a data disk to a virtual machine. The Add-AzureDataDisk cmdlet adds a new or existing data disk to an Azure virtual machine object. Use the CreateNew  parameter to create a new data disk that has a specified… Read more

Azure PowerShell Getting the Remote Desktop File

When you are on Go and Portal is not responding well, you might be in need to get the remote desktop file of a Virtual machine Step 1: Login to Azure > Add-AzureAccount Point to the right subscription > Select-AzureSubscription -SubscriptionName "Your Subscription Name" Step 2: Then get the list of Virtual machines > Get-AzureVM… Read more

New Improved Blog Editor

Since the support for Live Writer was missing in Windows 10 I was heavily impacted. I am a blogger who is bit lazy and the Live Writer was just a perfect fit for me. Like many other things it was just like typing in word. You don’t need to worry about the place to keep… Read more

Manage your own Azure Subscription using PowerShell

You might be using a Dev/Test Azure account and to save the money you would like to Shutdown all the VMs. Since VMs are creating ad-hoc you don’t know the exact name. But you need to shut them down all. Let’s see 1.       Open Azure PowerShell 2.       Run Get-AzurePublishSettingsFile. This will ask login, log in… Read more

Delete an Azure Active Directory

Problem When you try to delete an Active Directory you will go crazy because  You will get an error   You will clean all the users but will still get the below error.   You try to clean up all the applications in the list of applications. You select “Applications my Company owns” and the… Read more

Azure Free E-Books

Azure eBooks Data Science in the Cloud with Microsoft Azure Machine Learning and R Azure Essentials – Azure Automation Azure Essentials – Fundamentals of Azure Azure Essentials – Azure Machine Learning Azure Essentials – Azure Web Apps for Developers Introducing Microsoft Azure HDInsight Developing Big Data Solutions on Microsoft Azure HDInsight   Namoskar!!!… Read more

Tips for Microsoft Certification : Developing Microsoft Azure Solutions (70-532)

Life is a continuous learning process and equally unlearning. Especially in the cloud space where everything is changing rapidly. I have been working with Azure since its inception. Much before Azure came into the market and got announced in PDC 2009 (if I recall), I was accessing it with early access. Back then it was… Read more

ADO.NET EF and Repository Pattern

This is a fantastic blog series by Julie and who don’t know Julie??? Repository Pattern this is ideal for testing and mocking. Julie is one of the wizards of EF has written a series, Agile Entity Framework 4 Repository: Part 1- Model and POCO Classes http://thedatafarm.com/data-access/agile-entity-framework-4-repository-part-1-model-and-poco-classes/ Agile Entity Framework 4 Repository: Part 2- The Repository… Read more

Connecting on-premises SQL Server using Azure Service Bus Relay

This issue seems very common rather we can call it a requirement. Business Need. We have a Web Site (assume hosted in Azure). Now we have a SQL Server located locally behind the firewall. We cannot move this database outside of our data center. One of the easiest ways to use it through Service Bus… Read more

Top 10 things while migrating existing Web Applications to Azure

Microsoft Azure is another sophisticated hosting platform. For Web Sites where we have code written and wanted to move it to Azure we would obviously be facing some challenges if it as never designed for distributed environment, 1. Should not use In-Proc Sessions. In Web development it is very common to use sessions. Sessions are… Read more

Azure PowerShell : Forbidden Error: The server failed to authenticate the request

You have used Add-AzureAccount command to connect to Azure Account or might have used .publishsettings file. But even after you have successfully connected you get this error every time you want to run any Azure command Forbidden Error: The server failed to authenticate the request Your frustration mounts. Many try, many searches in various forums…. Read more

Windows 10 – Latest Developer Resources

Microsoft Virtual Academy Training A Developer’s Guide to Windows 10 BUILD 2015 Sessions Introducing the Windows 10 App Model – https://channel9.msdn.com/Events/Build/2015/2-617 What’s New in XAML for Universal Apps – https://channel9.msdn.com/Events/Build/2015/2-629 UX Patterns and Responsive Techniques for Universal Windows Apps – https://channel9.msdn.com/Events/Build/2015/2-658 All That is New in the Windows Store – https://channel9.msdn.com/Events/Build/2015/2-664 From the Small Screen… Read more

DocumentDB Add and Read – Simple Approach

I wanted to create a simple sample which would Add and Read records in DocumentDB. Created one Windows Forms Application, added NuGet Package Then in the Windows Forms I have added simple Text box to enter data and grid to display it. The data model would look like, this has dependency using Newtonsoft.Json;   //Employee… Read more

Effectively use Azure MSDN Account to avoid exceeding the quota

Many of you use Free MSDN Azure account for Dev/Test. This post is all about using Free Azure account which has a limited quota for use. A lot of times where these kind accounts are temporarily suspected due to the excess use. I am writing this based on my personal experience maintaining similar account for… Read more

Azure Runbook Schedule Time Zone

When we select the time to create the Runbook Automation Scheduler we get confused which timezone it would take. Here are they, 1. When you use portal to create the Schedule Job for Runbook it takes the browser time and converts it to UTC 2. When you use PowerShell or SDK then you must use… Read more

Azure PowerShell : Shutdown All Azure VMs

To Shutdown all Azure VM you don’t need to go to individual and then press the button. But run an elegant PowerShell $AzureSubscriptions = Get-AzureSubscription foreach ($subscription in $AzureSubscriptions) { Write-Host $subscription.SubscriptionName Select-AzureSubscription -SubscriptionName $subscription.SubscriptionName #Write-Host $subscription.SubscriptionName foreach ($vm in Get-AzureVM) { $name = $vm.Name $servicename = $vm.ServiceName If($vm.Status -ne ‘StoppedDeallocated’) { # Add the… Read more

Azure PowerShell : Get the List of VM Images

Addition: Thanks Roy Lofthus, I love the comment and hence adding You can run below comment to get the grid. Get-AzureVMImage | Select * | Out-Gridview –Passthru The –Passthru will get the context back to PowerShell window. You can do the further filter etc in that Grid. To get all the VM Images you can… Read more

Azure and PowerShell

Azure and PowerShell are the couples. If you talk about only one of them then you are not talking complete story. We have got couple of PowerShell modules available in Azure and many things can only be done through PowerShell. Here are few easy steps to connect to Azure through PowerShell 1. Run “PowerShell_ISE” 2…. Read more

Selling Azure Open Licensing for Partners

In Worldwide Partner Conference 2014 we have announced the Azure Open Licensing for Partners. This is going live from August 1, 2014. Here are some resources to help understand Watch this video at http://www.digitalwpc.com/Community/Perspectives/Pages/Announcing-Microsoft-Azure-in-Open-Licensing-for-partners.aspx#fbid=PsEQVDjbmOh Another very informative blog post Coming Next to Open Licensing: Microsoft Azure Ready To Go resources for partners   https://readytogo.microsoft.com/global/_layouts/RTG/DownloadCampaign.aspx?campurl=https://readytogo.microsoft.com/global/campaign/pages/(global)%20microsoft%20azure%20in%20open%20licensing.aspx Additional… Read more

SQL Server in Azure VM High Availability and Disaster Recovery

This is the most commonly asked question on SQL Server in Azure Virtual Machine. How to maintain SQL Server up and running all the time. Options are High Availability (Azure) 1. AlwaysOn Availability Groups (http://msdn.microsoft.com/en-us/library/azure/dn249504.aspx) 2. Database Mirroring (http://msdn.microsoft.com/en-us/library/azure/jj870961.aspx) Disaster Recovery (Azure) 1. AlwaysOn Availability Groups (http://msdn.microsoft.com/en-us/library/azure/dn690122.aspx) 2. Database Mirroring (http://msdn.microsoft.com/en-us/library/azure/jj870960.aspx) 3. Backup and Restore… Read more

Exchange Web Service get Calendar information

Now we have our mailboxes and Exchange server serving and storing them in the sever. Using Exchange WebService you can get the information. First build one Windows Application (this case). Add EWS reference from Nuget https://www.nuget.org/packages/Microsoft.Exchange.WebServices/ or you may run this command in Tools > Package Manager Console After that a very simple code as… Read more

Build 2014 some of my favorite sessions on Azure

What’s New for Azure Developers in Visual Studio and Azure SDK https://channel9.msdn.com/Events/Build/2014/2-585   Developing Office 365 Cloud Business Apps https://channel9.msdn.com/Events/Build/2014/3-573   What’s New for ASP.NET and Web in Visual Studio 2013 Update 2 and Beyond https://channel9.msdn.com/Events/Build/2014/3-602   Microsoft Azure Storage – What’s New, Best Practices and Patterns https://channel9.msdn.com/Events/Build/2014/3-628   What’s New in IaaS for Developers… Read more

Migrating Visual Studio Online to TFS on Premises

After trying out the free Visual Studio Online you started liking it. It might so happen that the Visual Studio Online has sent you an email that the early adopter program is ending soon. So you want to move your work to TFS on-premises where you have more control and the domain integration. Here is… Read more

Microsoft Assessment and Planning(MAP) Toolkit

MAP or Microsoft Assessment and Planning Toolkit is an agentless inventory, assessment, and reporting tool that can securely assess IT environments for various platform migrations—including Windows 8, Windows 7, Office 2013, Office 2010, Office 365, Windows Server 2012 and Windows 2008 R2, SQL Server 2012, Hyper-V, Microsoft Private Cloud Fast Track, and Windows Azure. The… Read more

Why you should consider cloud as your Datacenter

If you are building an application and selling it to your customer as product, you need a place to host it. Now you can consider hosting it in your datacenter or customer’s datacenter. The question comes to us in terms of management. Apart from that there are quite a few challenges. If this application is… Read more

WinJS using alert() in your JavaScript

If you come from JavaScript world you will badly miss the alert() function. However, this habit can be entertained if you declare a function at default.js file. Then it will be accessible in all other pages which are navigated from default.html page. function alert(message) { var msgBox = new Windows.UI.Popups.MessageDialog(message); msgBox.showAsync(); } Then this code… Read more

WinJS Global Error Handling in JavaScript

In Windows Store Apps if any unhandled error comes it closes the application. This sliently happens to terminate the app. This is a default behavior. We can change this behavior by handling the “unhandled” errors. app.onerror = function (e) { var message = e.detail.message; var description = e.detail.description; var code = e.detail.number; var stackTrace =… Read more

Working with jQuery in WinJS

Use Blank HTML Template Create project using Blank Template Install the jQuery and add it to Application Once you have your Windows Store Apps, use nugget.org and add jQuery to your application Go to your package manager console and run the below comment PM> Install-Package jQuery Then add the reference of the jQuery to the… Read more

Entity Framework CodeFirst : Simple Migrations

When I change my model from let’s say //Employee Entity public class Employee { public int Id { get; set; } public string FullName { get; set; } } to //Employee Entity public class Employee { public int Id { get; set; } public string FullName { get; set; } public string Email { get;… Read more

Entity Framework CodeFirst : Where is my database

Sometime back I was trying out on CodeFirst and I suddenly realized that the generated database by CodeFirst is missing. I had to see in SSMS what exactly got generated. So I did a trick to retrieve the database information //Employee Entity public class Employee { public int Id { get; set; } public string… Read more

Resources on ADO.NET Entity Framework 6

New Features in EF6 These are some of the more notable new features in EF6. For a complete list of changes see Version History. Async Query & Save (EF Designer & Code First)Asynchronous query and save using the async and await keywords. Connection Resiliency / Retry Logic (EF Designer & Code First)Automatically retry any commands… Read more

Visual Studio Online How to get more user licenses

In production there will be more users than your testing or POC projects. The cost associated per user is mentioned here http://www.visualstudio.com/products/visual-studio-online-overview-vs  This is how we can increase them refer http://www.visualstudio.com/get-more-user-licenses-vs Namoskar!!!… Read more

Book Review : Developing Windows Store Apps with HTML5 and JavaScript

While I was reading Developing Windows Store Apps with HTML5 and JavaScript, written by Rami Sarieddine, was enjoying it fully. I am a HTML5/JS guy when it comes to Windows Store Apps. When I got this opportunity to review this book I was very excited. Because I would get a chance to learn during this… Read more

Free EBook from Microsoft

Lync Microsoft Lync Server 2013 Step by Step for Anyone Office Deployment guide for Office 2013 First Look: Microsoft Office 2010 Microsoft Office 365: Connect and Collaborate Virtually Anywhere, Anytime Microsoft Office 365 for professionals and small businesses: Help and How To Security and Privacy for Microsoft Office 2010 Users SharePoint Explore SharePoint 2013 Deployment… Read more

Windows Azure Storage Connection String

If you are not using Visual Studio Cloud Projects (where one cloud project and n-number of Web/Worker Role project(s)) and building simple WebSite, you may need this. This is the connection string you need in your Web.Config file under ConnectionStrings DefaultEndpointsProtocol=http;AccountName=[account_name];AccountKey=[account_key] After which you need to initiate by doing CloudStorageAccount csa = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["DataConnection"].ConnectionString); Namoskar!!!… Read more

Windows Azure Table Storage

Windows Azure Table has changed quite a bit since SDK 1.x. So there are buch of new approaches and ways to handle them First we need to install WindowsAzure.Storage from http://nuget.org Now have the entity public class Employee : TableEntity{ public Employee() { this.PartitionKey = "emp"; this.RowKey = Guid.NewGuid().ToString(); } public string FullName { get;… Read more

Team Foundation Server 2013 : Books Free and Paid

Professional Team Foundation Server 2012 (free e-book plus link to purchase hardcover book) Testing for Continuous Delivery with Visual Studio 2012 (links to free e-book and purchase paperback) Install Team Foundation Server 2012: the ultimate guide for installing TFS (free e-book in many formats) Upgrade Team Foundation Server 2012: the ultimate upgrade guide (free e-book… Read more

Team Foundation Server 2013 : Learning Videos

Modern Application Lifecycle Management (1 hour, 11 minutes) What’s New for ALM in Visual Studio 2013 and Team Foundation Server 2013 (1 hour, 18 minutes) Climbing the Agile Testing Ladder featuring Visual Studio 2013, TFS 2013, Microsoft Test Manager 2013, and Lab Management 2013 (1 Hour, 10 minutes) Namoskar!!!… Read more

Visual Studio 2013 : New enhanced scroll bar #7

You will not imagine unless you play with this feature. Scrollbar was never a charm like this After you do this your scrollbar would look like Also you may see the code preview in a popup Alternatively you can get them when you right click to a scroll bar Namoskar!!!… Read more

Visual Studio 2013 : Enhanced “Go to Definition” #3

F12 or Go to Definition is one of the most used features for developers. It was there in Visual Studio 2013 since very long. Now you can either select Alt+F12 or select “Peek Definition” After you select it You go on and on. After sometime you will find a blue breadcrumb Namoskar!!!… Read more

Build Windows Phone Apps using Windows Azure Mobile Services from Ground Up

Windows Phone 8 works really well with Window Azure Mobile Services. Windows Azure portal gives us the startup apps, however you can also build from ground up. Here it is, Let’s say you have created a Windows Azure Mobile Service Once it is ready Grab the URL and Key. After that create a blank Windows… Read more

Repository Pattern with ADO.NET Entity Framework Hack

Let’s build ADO.NET Entity Framework library using Repository Pattern. There are a many ways but this is probably the easiest hack.  First build a blank solution Then add a class library called “DAL” and add a class called “Employee” namespace DAL { public class Employee { public int Id { get; set; } public string… Read more

The beautiful MVVM

Getting Started with MVVM in 10 minutes   Building a Reusable ICommand implementation for Windows Phone MVVM apps   Laurent Bugnion, leads the MVVM Light Toolkit project, has a 4-article MSDN series on MVVM IOC Containers and MVVM Messenger and View Services in MVVM Maximizing the Visual Designer’s Usage with Design-Time Data Commands, RelayCommands and… Read more

ADO.NET Entity Framework : Executing TSQL and DbContext under same Transaction

There might be a requirement that we need to run a RAW SQL statement and DbContext update under same connection and would like to have the Transaction in place. Let’s see how we can achieve this easily SQL Table CREATE TABLE [dbo].[Emp]( [Id] [int] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](50) NOT NULL, [LastName] [varchar](50) NULL, CONSTRAINT… Read more

Windows Azure Mobile Services : Adding and Filtering Authenticated User in Table

When you authenticate you Mobile apps using Windows Azure Mobile Services you may want to add the user id in your table row. This way you can later filter them while reading. This sandbox filing would give a portal experience to the end user. Now this can be done at the client level but the… Read more

Office 365 is free for NGO

It’s a channel and to know more about it visit http://www.microsoft.com/en-us/news/Press/2013/Sep13/09-10Office365NonprofitsPR.aspx Microsoft Corp. on Wednesday announced the global availability of Office 365 for Nonprofits for qualifying nonprofits and nongovernmental organizations (NGOs) through its software donation program. The donation is available immediately in 41 countries around the world and for up to 90 countries by July… Read more

Using Repository Pattern in Entity Framework

One of the most common pattern is followed in the world of Entity Framework is “Repository Pattern”. Since this is something which is heavily used and being practiced, I am not going to talk about the core pattern. Rather, try to show how one can implement it. Objectives As mentioned in http://msdn.microsoft.com/en-us/library/ff649690.aspx You want to… Read more