​

Wednesday, August 19, 2015

Work with MySQL database on Azure

Hi,

I have published two videos on channel 9 about Microsoft Azure capabilities on mySQL databases.
You can create MySQL databases for free on Azure, start your proof of concept and any development project by having MySQL instance that can scale based on the power of cloud computing.

I covered how to provision, create, manage MySQL databases on Azure and how to connect to these instances from MySQL workbench.


In the first video, Get Started with MySQL on Azure i covered how to provision, create and manage mySQL instance on Azure.

Video Url: https://channel9.msdn.com/Blogs/MostafaElzoghbi/Get-Started-with-MySql-on-Azure



In the second video, Get Started with MySQL workbench for MySQL databases on Azure i covered how to connect and manage MySQL azure instances from your favorite MySQL management studio "MySQL workbench".

Video Url: https://channel9.msdn.com/Blogs/MostafaElzoghbi/Get-Started-with-MySQL-Workbench-for-MySQL-databases-on-Azure



Hope you enjoy both of these videos.

If you need any in deep learning materials to be posted on ch9, please drop me a message.

Monday, August 17, 2015

mysql is not recognized as an internal or external command

Hi,

I am using Visual Studio 2015 for developing cordova apps. I have installed MySql tools yesterday and since then eveytime i build or deploy my app, i get this error:

mysql is not recognized as an internal or external command


Even though i don't use MySQL in my cordova app but still i am not able to build or deploy any cordova app in Visual Studio 2015.

The meaning of this error message is: The system couldn't locate the mysql.exe in your system.

I am running Windows 10, here is the steps to fix that:

1) From the Cortana search, open up the control panel.
2) Navigate to System & Security, and then System.
3) Click on Advanced System Settings from the left pane.
4) Click on Environment variables.
5) Try to find Path system variable and click on Edit.

Copy the variable value in any editor and do the following:

a) Enclose any mySQL component path between double quotation "".
b) Add the mySQL.exe path at the end of the variable. You need to look for the installation path for MySQL installation and grab the installation folder which contains MySQL.exe and add it to the Path system variable.
In My Case the path for MySQL.exe is:
C:\Program Files\MySQL\MySQL Server 5.6\bin


Below is the Path system variable after the update: [[ notice the highlighted yellow section is what i have updated ]].

C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;"C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\";"C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\";"C:\Program Files\MySQL\MySQL Server 5.6\bin"


6) Click on Ok to save your changes.
7) Close and re-open VS 2015 (THIS IS A MUST)
8) Try to build or deploy your cordova app! it starts working again...

Enjoy.


Friday, August 07, 2015

How to setup Ubuntu server VM on Azure


Hi,

I was trying to provision an Ubuntu server VM on Azure and i'd like to share how to get up and running Ubuntu sever 12/14/15 VM on Azure step by step.

1) From Azure Portal,  Select Virtual Machines under compute, then select Ubuntu Server 15.



2) Install PuTTy as SSH Client to install extra components for the provisioned VM, you can find the client installation here:



3) Open PuTTY client and enter the Ubuntu server server VM url, you can find it in Azure portal -- Under Dashboard page for the provisioned VM. For example:  UbuntuDevSample101.cloudapp.net

  1. Click on connect, a PuTTY console window will pop up.
  2. Log in with the creds you have set while provisioning your Ubuntu VM.
  3. After a successful login, A SSH command window open.

 4) We need to install Ubuntu Desktop, run the following command:

$ sudo apt-get install ubuntu-desktop


This command will take a while, once it is completed, this means we have an Ubuntu desktop installed on the server.

Below screen show shows the command in SSH client:



 5) Install remote connection (RDP) capability by typing the following command:

$ sudo apt-get install xrdp


6) From Azure Portal, select the provisioned VM and select End Points tab.
7) We need to add a RDP end point to connect to the VM,
8) To add RDP endpoint to the VM, check out below screen shot:



9) From Azure portal, Click on Connect after adding the end point.
10) Enter the username and password!
11) After a successful login, you will be able to RDP to ubuntu VM with a desktop component!


Enjoy! Hope this helps.

Tuesday, July 28, 2015

Get started with Azure Machine learning for free

If you would like to start building Azure machine learning experiments on Micosoft Azure, You will be able to start getting started with Microsoft free offer for Azure feature-sepcific offer where you can work on Azure ML without a need for Azure subscriptions.

All what you need is a Microsoft account to login, once you got that, visit below link to start experimenting Azure ML.

If you don't have a Microsoft account (Live, Hotmail, Outlook), here you can sign up for free:

Update: Due to a recent update in Azure ML site,You will be able to use Azure Studio as a guest and you don't need to login or create a Microsoft account.
We recommend you to create a Microsoft account to store all your experiments under you account to be available everywhere.


Enjoy Azure ML!

Thursday, July 16, 2015

Getting Started with Cross Platform Mobile Development using Cordova



Getting started with cross platform mobile apps using cordova from Mostafa Elzoghbi

Sample Demos:
https://github.com/Microsoft/cordova-samples

Yesterday, I had the opportunity to present a session about cross platform mobile development using Cordova at Microsoft Reston.

This blog post is to share my presentation and my sample demos to everyone!

Hope this helps.




Tuesday, July 14, 2015

Free Microsoft eBooks

Hi All,

I'd like to share with all my blog readers and followers the largest collection of free ebooks from Microsoft.

Great resources in Microsoft Azure, Machine Learning, Azure Web Apps, Microsoft SharePoint, Dynamics CRM, Office 365, Cloud Apps, SQL Azure, SQL Server, and much more.

Refresh your skills set and download as much as you can:

http://blogs.msdn.com/b/mssmallbiz/archive/2015/07/07/i-m-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-windows-8-1-windows-8-windows-7-office-2013-office-365-sharepoint-2013-dynamics-crm-powershell-exchange-server-lync-2013-system-center-azure-clo.aspx

Enjoy!

Wednesday, July 08, 2015

How to configure Cordova App to use AngularJS

Hi,

In this blog post i am showing how to Add AngularJS library to an existing Cordova App in Visual Studio 2015. The post shows some tips on organizing your JS files into Crodova App project template.

Since i didn't find an example on how to incorporate AngularJS library in Cordova App with out the need to collect various JS files and place them in proper folder structure that works with Cordova App project template. This blog will guide in a step by step how to incorporate AngularJS in Crodova App using VS 2015.

What are we doing ?
Since the AngularJS framework helps developers to follow MVC pattern. We will be creating an out-of-the box Cordova application, then we will add a controller js file and then will set a value in the controller and bind in view page.

Follow below steps to have a running Corodva App with AngularJS installed and configured!

1) Create a Crodova project in VS2015.


2) From Solution explorer window, Click on Manage NuGet Packages.
3) Search for AngularJS and add AngularJS.Core to your project.


4) All AngularJS files will be added under Scripts folder.


5) Select All AngularJS files and move it under scripts folder under www folder.



This is a best practice to include all Cordova App JS files under scripts folder, Since VS 2015 adds JS libraries under Scripts folder as a standard location, we need to move it under scripts folder under www folder.

6) Create a controllers folder  and then add MainCtrl.js file as your controller.
7) Open index.html and add a reference to angular.js and MainCtrl.js.

  <!-- AngularJs -->
    <script src="scripts/angular.min.js"></script>

    <!-- Controllers -->
    <script src="controllers/MainCtrl.js"></script>

8) Add the following code snipped in MainCtrl.js controller , which sets a value for myname in the scope.


(function () {

    angular.module('myApp', [])
    .config([function () {
        // configuration
    }])
    .run([function () {
        // Running
    }])
    .controller('MainCtrl', ['$scope', function ($scope) {
        $scope.myname = "Mostafa Elzoghbi Demo!";

    }])

})();

9) Open up index.html and retrieve (bind) myname value from the controller; set the angularjs app name and the controller name.

<body ng-app="myApp" ng-controller="MainCtrl">
    <p>Hello, your application is ready!</p>
    <p>{{myname}}</p>

10) Run your project! and you will see that myname binding value from the controller.



The full demo can be downloaded from this link:

https://drive.google.com/file/d/0B3qz_TH6n68UTk5RT1A4QmU1S3c/view?usp=sharing

Wednesday, July 01, 2015

Learn AngularJS for free to build web and mobile apps at scale

AngluarJS is a modern JavaScript library to build enterprise web and mobile applications at scale. AngularJS is widely used JS library by all frond end and web developers worldwide in different programming languages to build scalable web and mobile applications.

AngularJS is a library backed by Google. Microsoft started to support AngularJS with great IntelliSense in VS developer tools including the following templates:

a) VS Web project templates including web forms & mvc templates.
b) VS Hybrid cross platform mobile app using Apache Cordova

Today you can start building AngularJS applications in Visual Studio 2013 and 2015.

To learn AngularJS basics before jumping into code. Microsoft offers a free course in Microsoft Virtual Academy (MVA):
http://www.microsoftvirtualacademy.com/training-courses/introduction-to-angularjs

This course is a great start to understand the basics of AngularJS.

Also, there is a free course on AngularJS website, here is some links to learn AngularJS:
https://docs.angularjs.org/tutorial
http://campus.codeschool.com/courses/shaping-up-with-angular-js/intro


** If you live in DC metro area,  I will be covering basics of AngularJS along with Building Cross platform mobile apps using Cordova, link to the event (7/15):
http://www.meetup.com/NoVaJS/events/223495406/


Hope this helps.

Friday, June 19, 2015

What is npm ? How to get started with npm with Visual Studio 2015

This blog post is for following audience:
a) Microsoft stack and .NET developers.
b) New developers using Apache Cordova.
c) An engineer who has not been using any open source tools in Visual Studio.

This blog post will answer the following questions:
1) What is npm ?
2) Why would i use it ?
3) How to use it ?

npm is a package manager for: JavaScript, Node, Cordova, JQuery, mobile, angular, react and other famous JavaScript libraries and frameworks.

You will use npm when you want to install any js library or framework in your Visual Studio project. For example: if you want to install node.js, Cordova js libraries or any other js library such as: ionic or react!

To get npm js package manager, you need first to install Node.Js which contains npm package manager tool.

https://nodejs.org/

Once you download and install the installer, you would have npm package manager tool in your system!

How to use it?
Open your command line after you installed node.js installer and type the following to install ionic framework:

npm install -g cordova ionic



Hope this helps you how to get started using npm package manager!

-- ME

Thursday, June 18, 2015

What is TypeScript? Why would i strongly recommend to use it in your next project



As all of us know, Building large applications in JavaScript is hard! It gets messy and hard to manage and test.

The Problem
Because of the nature of JavaScript, it is not "favorable & easy practice" for non JavaScript developers to write classes, modules, OOP code in an easy, clean and straight forward way.

This was the reason of the rising & popularity of JS libraries and frameworks such as: jQuery, Angular, Knockout and much more amazing js libraries.

Recently, I have been thinking to build a Hyprid mobile application using Cordova, and this open source platform helps developers to build cross platform native apps using standard web technologies in JS and HTML.

I was thinking what is the right and best approach to start structuring my project in an organized pattern such as MVC, so i have bunch of views and controllers and my code is clean to build robust solution!

The Solution
You have different ways to implement this, One is to use Angular JS library that helps you strcture your code in a MVC patterns and design your views that are linked to models and js files that have all your controllers implementations.

Another approach, is to use TypeScript which gives your the ability to write clean client scripting and it generates JS code for your and it works in all browsers!

If you are using any OOP programming language such as: C# or Java. It will so easy for you to add TypeScript (*.ts) file in your project and start writing classes, interfaces and all OOP code with IntelliSense and type casting capabilities within VS IDE.

So, you write C# Like code in TypeScript file, it generates JS code and it works in al browsers.

Here is a play ground site to test it some code and see generated code:
http://www.typescriptlang.org/Playground

The same site has tons of materials to learn, samples and get started:
http://www.typescriptlang.org/Tutorial


TypeScript is available and supported if you use VS 2013 (update 2) or VS 2015!

Hope this helps!

Friday, June 12, 2015

How to start ASP.NET 5 Development on OS X Mac



It is the day when Microsoft @ BUILD conference in 2015 announced the availability of Visual Studio Code to allow OS X and Linux Developers to tap into .NET development

I am writing this blog post to show in step by step from ,net development perspective how to install and configure your macbook pro to have VS and starting developing and debugging asp.net applications.

Here is what you need to get you up and running:

1) Install Visual Studio Code: https://code.visualstudio.com/
It is a straight forward installation as we used for all MS products installation. Once you install it you will be able to run the VS Code as shown above.

2) Install Homebrew for managing missing packages for OS X:
You need to open the Terminal window and type (copy & paste) below command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This command install homebrew which is the missing package manager for OS X. It is same as Nuget console manager we do have in VS in windows to install any needed packages to our projects.

homebrew homepage url: http://brew.sh

Below screen shot show brew installation in the terminal window.


Once you hit enter, it will ask to enter your password and hit enter.
below show the completion of brew installation.



3) Install asp.net 5 and DNX:
Run the following 3 commands to install asp.net and DNX:

brew tap aspnet/dnx
brew update
brew install dnvm
Below screen shot shows the successful installation of DNX and ASP.NET on my macbook pro.



Now we have Mono, asp.net 5 is installed on our MacBook Pro! Hooray...

There is not further steps to do, but if you want to test compiling, debugging and running asp.net apps. You can install samples from github: https://github.com/aspnet/home#os-x

This sample contains console app, asp.net mvc and aspnet web app.
Below link shows you how to run the samples as well:
https://github.com/aspnet/home#running-the-samples

Hope this helps!




Wednesday, June 10, 2015

How to start mobile apps development using Cordova in Visual Studio 2013/2015


I am writing this blog to show how to start developing cross platform mobile native applications using Cordova.

Cordova is a platform for building native mobile applications using HTML, CSS and JavaScript. It is an open source platform which means it is free to download and start building cross platform native applications using standard web technologies skills set.

If you would like to read more about Cordova project and its capabilities, here is the Cordova project homepage: https://cordova.apache.org/

Microsoft has started to integrate Cordova into VS 2013 and VS 2015. In this blog post i am showing how to start working with Cordova in VS 2013 by getting all the tools in step by step fashion.

Once you open VS2013, Click on Start a new project.

Under JavaScript Template, Select Multi-Device Hybrid App, then double click on Install Tools for Apache Cordova.



This will open up a new browser windows to start installing all the tools. download the executable file.




Next, Make sure to close VS before start installing Apache Cordova for VS 2013 tools (vs2013mda_0.3.1.exe)



Open up VS again, You will find a blank App (Apache Cordova) project template in VS 2013!


Hope this helps!

UPDATE 06/12/2015: Microsoft recommends to use VS 2015 for all Cordova applications because VS 2015 is using a new project structure to support third party CLIs, while VS 2013 is still using the old/deprecated project structure.


Friday, May 29, 2015

Build Apps for Office (Word & Outlook) and Office 365 API

Hi All,

During my sessions in the office 365 DevCamp in Atlanta, I have demoed how to build applications for Office (Word & Outlook) and How to integrate with Office 365 API from ASP.NET MVC application.

 I have uploaded the source of 3 applications, The zip file contains the following:

1) Word Application: Read items from SharePoint lists and interact with a word document.

2) Outlook Mail App: An app that read email messages content and extract links within the message and has the ability to add these links to SharePoint lists.

3) MVC Research Tracker App: an MVC application that is connected to office 365 tenant and read user's contacts, files (from OneDrive) and add content to SharePoint lists.

These applications you can download, register these apps against your Office 365 tenant AD and run them (F5) and have fun!

Source files download link: http://1drv.ms/1Feqy1I

I have uploaded the manifest files as well, that contains the registration information i have for each of these applications in my office 365 tenant Active Directory. These files are json files, you can open it in Notepad and configure the settings and permissions as needed. DON'T copy any Auto Generated Ids such as client id or AppKey.

All these demos require an office 365 tenant to develop against, so you will be able to have: mail, OneDrive, SharePoint sites and more, if you don't have, create a new account (30-day trial) here:

Sign up for Office 365 Development Account



Word App is running (Task Pane) inside Office word 2013:


Enjoy!

Monday, May 25, 2015

My Study notes for 70-533 Exam: Implementing Microsoft Azure Infrastructure Solutions

Hi All,

Happy memorial day! I am posting this blog post to share my study notes for Implementing Microsoft Azure Infrastructure Solutions exam.

I passed this test last week and i used to keep all my written notes to share it with others to help them get prepared for the test and eventually pass it from the first round -:)

Here are my tips and topics you need to be knowing before taking the test:

1) Add a VM to existing Virtual Network (VNet) in Azure using: New-AzureQuickVM
2) How to configure a cloud service to join a VNet in Azure by updating the csdef file.
3) How to configure Corp VNet for new employees using:
    a) Create a VPN Subnet.
    b) Enable Point-to-site connecting to Corp VNet.
2) Using DirSync with Azure Active Directory (AAD) to synchronize on-premise AD to AAD.
3) Working with Access Control Services in Azure.
4) How to configure an application as a multi-tenant application.
     Ref.: https://code.msdn.microsoft.com/Multi-Tenant-Cloud-8015b84b
              https://msdn.microsoft.com/en-us/library/ff966499.aspx
5) Active Geo-Replication is available in the Premium Services Tier.
6) Managing access to anonymous and external users using access policy in Azure Storage.
7) All logs are stored in $logs container when storage analytics is enabled.
8) Deploy protection between two on-premises VMM sites.
    Ref.: https://msdn.microsoft.com/en-us/library/azure/dn168841.aspx
9) Configure custom script extensions in VMs.
10) How to configure Data Protection Manager (DPM) with Azure backup service.
11) How to enable anonymous users to access blob storage container in Azure.
12) To integrate AD domain services (ADDS) with Azure AD (AAD):
       a) Setup a DirSync Server.
       b) Setup an active Directory Federation Services Server.
13) Work with Graph API  RESTful endpoints in Azure AD in SaaS apps.
14) Service Bus permissions:
      a) Send: for all send operation.
      b) Listen: opens up listeners and receive messages.
      c) Manage: to observe or manage the state of the service bus tenant.
15) Use Monitor page in Azure portal to setup metrics for your webroles.
16) Use Configure page in Azure portal for endpoints and rules for yor webroles.
17) To control access to VM, use Set-AzureAclConfig PS Cmdlet.
18) To add disk to a VM, use Add-AzureDataDisk PS Cmdlet.
19) Connect branch users to your corp network using: Site-to-Site configuration in Azure.
20) Connect remote users to your corp network using point-to-site configuration in Azure.
21) Free and Shared provides 1GB of Data in Azure as storage.
22) Basic provides 10GB of Data in Azure as storage
23) Standard provides 50GB of Data in Azure as storage.
24) Copy Databases using BACPAC from one server to another using blob storage.
25) Update cloud services with primary and secondary access keys in cscfg files:
       Ref.: http://blogs.msdn.com/b/jennifer/archive/2010/03/02/why-do-you-need-a-primary-and-a-secondary-access-key-for-windows-azure-storage.aspx
26) To create a reserved IP and associate it with a cloud service: New-AzureReserveIP
27) How to setup 2 solutions to communicate in two different subscriptions:
      a) Add local networks to the VNets.
      b) Create a dynamic Routing Gateways.
      c) Connect the VPN Gateways.
28) You must be Enterprise and Global Admin to run Directory Sync Tool.
29) Use Set-AzureResource PS Cmdlet to change properties of  Microsoft.com/Sites
30) You need to enable VM extensions checkbox while provisioning a new VM.
31) Select-zureSubscription -SubscriptionName "NAME" -Current  ->to set current subscription.
32) Web Jobs Path in Azure:
      site\wwwroot\App_Data\jobs\{JobType}\{JobName}
Where JobType could be continuous or triggered.

Hope these notes will help you pass the test! drop me a line if you have any suggestions!


All my best wishes!




Thursday, May 21, 2015

How to fix first slow request load time in Azure Cloud Service Web Roles


Hi All,

If you are experiencing that cloud service web roles are slow for the first call or request, this is due to the default IIS Application Pool setting is set to recycle after 20 minutes.

This means, that every 20 minutes of inactivity, the application pool will recycle which means any request after this period will experience slow load time that you need to avoid for your customers.

If you have Azure Web Application (websites), you can easily configure this by turning on Always On switch in Azure Management Portal under Configure tab and you will be able to get your site faster to load!

Unfortunately, this option is not available for cloud service web roles, To achieve the same you need to follow these steps:

1) In your web application, add a new folder and name it: Startup
2) In the Startup folder, right click and add a new Text File in VS 2013.
3) Name the new file: Startup.cmd
4) Paste the following command in the Startup.cmd file (as one line) :

if exist %windir%\system32\inetsrv\appcmd.exe %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00


This command sets the IIS recycle app pool setting to zero which is never recycle!

Make sure to test out the cmd file by running it form the command prompt as admin, the output of the command should look like this below figure.



5) Select the Startup.cmd file in VS 2013 and press F4 to change the file properties.
6) Set Copy To Output Directory to Always Copy.
7) Save you changes and build your website, make sure that you have startup folder in the bin folder.
8) Publish your cloud service and check the difference for the first time you call the site after the deployment!


Hope this helps!


Monday, May 18, 2015

The best of BUILD and Windows 10 Training from MVA & ch9

Hi All,

If you have missed or couldn't attend BUILD event where Microsoft announced tons of cool things in Windows 10 features, Open Source, Universal Apps, Edge (New IE), IoT and Unity news for Game Developers.

Build will cover all Microsoft Platforms - expect rich new content and information on Windows, Azure, Office 365 and more. Developers will receive deep training, allowing them to take advantage of the incredible advances in our platforms, including Windows 10, and providing access to over 1.5 billion devices.

Microsoft is providing a free training course through Microsoft Virtual Academy (MVA) that cover all what you missed in BUILD 2015 that was held on April 29 - May 1, 2015.

http://www.microsoftvirtualacademy.com/training-courses/best-of-build-and-windows-10

If you want to watch certain sessions in BUILD event, check out this ch9 link below, where you can select technology, speakers and other criteria to filter out the list of videos:

http://channel9.msdn.com/events/build/2015?wt.mc_id=build_hp


Enjoy //build 2015 content!

Sunday, May 17, 2015

How to setup custom SSL certificate in Azure Cloud Services

Hi All,

In this blog post, I am providing a walk-through on how to setup custom SSL certificate into Azure cloud service. In any cloud service project, you may have multiple web roles that you need to configure some or all of them using SSL certificate.

Since Certificate authorities (CAs) don't provide a pfx file to configure and upload into windows azure, there are some work you need to do once you get the CA response which in some cases it is different formats for the ssl certificate.

For example: GoDaddy provides a zip file which contains .crt (which is your custom domain certificate response) and .p7b file which is set of intermediate certificates used to authenticate your certificate to the root GoDaddy certificate.

Windows Azure SSL certificate requirements:

1) Windows azure accepts only SSL certificate with personal exchange information extension (.pfx).
2) SSL certificate has to be 2048 bit encryption certificate.

Any Certificate Authority (CA) requires you to generate a CSR request to issue a SSL certificate, once you get the CA response, you will be getting file formats such as: (*.crt)

How to convert (*.crt) file into (.pfx) file:

1) Open your IIS manager, click on your server in the left pane.
2) Click on "Complete Certificate Request".
3) Select the certificate .crt file, provide a friendly name and click on OK.


4) Double click on the generated .pfx file to import it in your computer (CurrentUser) store.
5) Open the certificate manager by typing certmgr in the Run window.
6) Open your personal store, you will see the imported certificate with the same friendly name you gave in IIS is imported into your machine.
7) Right click on the certificate, click on export.


8) Make sure to select export the private key, save the generate SSL certificate with pfx file.
Note: remember the password you set for the file since we will need this password when we upload the ssl certificate into Azure portal.

9) We will be using this generate certificate file (.pfx) to be configured in the cloud service and to upload in windows azure.

10) Login to Azure portal, click on your cloud service, select certificates tab.
11) Upload the ssl certificate we generated, and type in the password you previously set when you export the ssl in step #8.

12) This step is to associate the installed SSL certificate in the cloud service for certain web role.
13) From VS 2013 Solution explorer window, double click on the web role you would like to associate the SSL certificate to.
14) Click on Add Certificate.
15) Add a name for your certificate, select store location: CurrentUser
16) Click on the thumbprint small button and select the SSL certificate.
You don't need to copy the thumbprint value for the ssl, once you select the certificate, VS 2013 pulls this value and set it in the field.
17) Click on endpoints tab and add a new endpoint using https protocol and select the certificate associated with the web role we previously added in the certificates tab.



17) Save and deploy your cloud service, Test out accessing the cloud service web role using https!


Enjoy!


How to configure custom domain in azure cloud service deployment

Hi All,

In this post i am going to show how to configure custom domains in azure cloud services.
As you my have multiple web roles in your cloud service, you need to configure your website to use your custom domain.

For example: if your domain is: www.MostafaElzoghbi.com --> You want this domain to point to the azure cloud service url: mycloudservice.cloudapp.net

The way to configure custom domains in azure cloud services is different than the web apps. In the web app scenario you have custom domain option to set your configuration per web app.
In case of the cloud service here are the steps you need to follow:

1) Login to Azure Portal, Click on Cloud Services.
2) Select your cloud service.
3) Copy your cloud service Site Url.
For example: mycloudservice.cloudapp.net

4) Copy your Cloud Service Public Virtual IP Address (VIP).
For Example: 191.236.48.195



5) Login to your hosting/domain provider, access your control panel and edit the DNS entries for the domain you want to point to azure cloud service.

6) Add CNAME record with the following values:
Type: CNAME
Name: www
Data: mycloudservice.cloudapp.net

7) Add A record with the following vaues:
Type: A Record
Data: VIP of the cloud service.

8) Save your entries and give it few minutes or hours to propagate.

7) Check out your cloud service web role using the custom domain: www.mycustomdomaain.com

Enjoy!

Monday, May 11, 2015

How to get started with Office 365 API Development

Hi All,

I have been asked by clients: How to get started with Office 365 API Development ?
They want to integrate office365 capabilities in their existing systems and applications.

In this blog i am providing links on how to get started with authentication, accessing mail, calendar, contacts and providing an amazing *FREE* training course from MS MVA (Microsoft Virtual Academy) site:


1) Office 365 API platform overview:

2) Samples to integrate with Office 365, specially what you mentioned mail, calendar...etc.:
Check out under Web, It has MVC Web samples to integrate calendar, contacts..etc

3) Office 365 app authentication concepts, this will provide different scenarios to authenticate users against o365 (Important):

4) Great FREE training course for office 365 development training:

5) Calendar, Mail and Contact REST API reference:

Hope this helps, and feel free to send any questions over to help.


Friday, May 01, 2015

My Study notes and guidance to pass 70-532 Exam : Developing Microsoft Azure Solutions

Hi All,

Today i have passed Microsoft exam 70-532 "Developing Microsoft Azure Solutions". I have been studying for awhile. I have been implementing Azure solutions since 2008. The preparation was just a mater of getting the exam materials, focus on the exam topic areas, and do lots of readings!

I will provide all what you need to read, watch or most importantly is my study tips to pass the first exam in the Azure certifications for Developers and Architects.

A) What you need to read:

1) Topics covered in the exam:
https://www.microsoft.com/learning/en-us/exam-70-532.aspx

2) Developing Azure Solutions book (or the ebook):
http://www.amazon.com/70-532-Developing-Microsoft-Azure-Solutions/dp/0735697043


B) What you need to Watch:
Microsoft  Virtual Academy (MVA) has a course for this exam. Amazing course that cover all the basics of this exam, great conversations and discussions for these topics. It covers exam's  topics and lots of demos in the MVA course and  you need to do some exercise for all the topics they asked to read more about.

http://www.microsoftvirtualacademy.com/training-courses/developing-microsoft-azure-solutions


C) My Study notes & tips:




  • How to configure custom domain in your Azure app service:    
          http://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/

  • How to configure GIT in Azure for Continuous Integration:
          http://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/

  • How to enable remote debugging for deployed Azure app service:
          http://blogs.msdn.com/b/webdev/archive/2013/11/05/remote-debugging-a-window-azure-web-site-with-visual-studio-2013.aspx

  • How to configure Azure Mobile Push Notifications service:
          https://msdn.microsoft.com/en-us/library/azure/dn167707.aspx

  • Understand the factors that affect the cost (billing) when you store content in Azure CDN Services and how to control it.
  • How to integrate with Azure AD Services through REST API.
  • Understand Azure Storage replication strategies, check out this link:
          https://msdn.microsoft.com/en-us/library/azure/hh873027.aspx
  • How to manipulate data in Azure storage in C#, check out this simple reference:
           http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/
  • How to configure Virtual Networks (VNet) in Azure using Site-to-Site and Site-to-Point, check out this reference:
          https://msdn.microsoft.com/en-us/library/azure/jj156206.aspx


Hope this helps and best of luck for all of you!




Thursday, April 23, 2015

Office 365 Dev Camp is near your city ?

Hi All,

If you are looking to get up to speed in office 365 application development. I have good news for you!

Microsoft is planning to have Office 365 in every major city in US, check out the schedule and save your seat today.

The dev camp is a one day deep dive in building office 365 applications including Office Word, Outlook, SharePoint Apps, Office 365 API and more.

Check out all office Dev Camps events in the below link:

http://aka.ms/msdevcamps


For local friends, The Washington DC office 364 dev camp event will be in 6/1 for Office 365 Dev Camp!


DC office 365 Dev Camp direct link to sign up!



The link above has other dev camps for cloud data and IoT dev camps.


Enjoy!





Tuesday, April 14, 2015

How to fix 'thumbprint' attribute is invalid error in Azure Cloud Service

Hi,

While i was configuring a web role in a cloud service project to use SSL certificate, I was adding my certificate to the Service Configuration file (cscfg) as follows:

  <Certificate name ="MyCertTest" thumbprint="cd947ee0b988e3b144d9fc39af47128dec68b731" thumbprintAlgorithm="sha1"/>
 

After i copied the thumbprint value from my certificate and paste it in the configuration file (cscfg) i found that there is an underlying error under thumbprint attribute and when i build i get the following error:

the xml specification is not valid: the 'thumbprint' attribute is invalid the pattern constraint failed


Here is the steps on how to fix it:

1) Remove any spaces from the thumbprint value.
2) There was a hidden character at the beginning and end of this string and once i removed it the underlying error in the cscfg file went away.
3) Save your changes and build!
4) Deploy your cloud service to Azure.


Hope this helps.


Sunday, April 12, 2015

How to return JSON objects from Web API 2

Hi All,

I was trying to return an object from web api 2.0 and i was getting the following error:

The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'.

The inner exception message was stating the following:

Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.


Sample method:

[HttpGet]
[ResponseType(typeof(ChargifyTransaction))]      
public async Task<MyObject> GetTransactionDetails(string transactionId)

{

   MyObject obj = new MyObject();
   obj.Id=123222;
   obj.Name = "Mostafa dev";
   
   return obj;
}

The solution:

Add the following 2 lines in Global.asax file under App_Start method, This will force the web api to return Json formats and to ignore references to itself for Newtonsoft.Json dll.



 protected void Application_Start()
        {
            // Force to use Json formatter and ignore reference looping.
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);


           }


Hope this helps.

Wednesday, July 02, 2014

Understanding, Designing, and Implementing Big Data Solutions in Azure

Hi,

I am writing this blog post to point to an important published article from Microsoft Patterns and Practices Team on understanding, designing and implementing Big Data Solution on Windows Azure using HDInsight.

Want to know what is big data ? what is being used for ? Do you have a need for it ? what is the best scenarios to think about adopting to big data tools?
The answer for these questions are covered under the first section of Understanding Big Data on below link:

http://msdn.microsoft.com/en-us/library/dn749804.aspx


Second section of this article is covering how to design a scalable big data solutions in Azure platform using HDInsight. Would you use big data to explore your data and extract patterns, Apply BI techniques, Build ETL integration tools, Automation data processes all are covered on below link:

http://msdn.microsoft.com/en-us/library/dn749816.aspx

Third section of this article is covering how to using Azure as PaaS to implement your Big Data Solution using HDInsight including how to provision your first Hadoop cluster node and all required configurations for storing your big data files, build end-to-end solutions and visualizing your data:

http://msdn.microsoft.com/en-us/library/dn749874.aspx


Hope this helps!

--ME



Friday, June 13, 2014

How to: Create ASP.NET MVC Authentication tables in an existing database

Hi All,

I am writing this blog post to show how to migrate or move the standard MVC authentication tables into your existing database in your asp.net web application.

Background
When you create a MVC web application in VS 2013, VS embed a sql server database in your project, and this project is being used as a source of asp.net membership. Since you will not use this database as an embedded file and you want to have it as part of your existing database in SQL Server instance. The file is created under App_Data folder. To see the .mdf file click on Show all files in the solution explorer.
You can see the contents of this database and all tables in the server explorer window.

How to create those tables in SQL server ?

First, you can delete the .mdf file in App_Data folder. Since we don't need any of these tables.Then, we need to update the default connection string in the web.config to point to our database.

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=SERVER\INSTANCENAME;Initial Catalog=DBNAME;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>


Third, Open Nuget Package Manager and write the following commands:

Enable-Migrations
Add-Migration Init
Update-Database

Check out your database, all ASP.NET membership tables with Prefix Asp have been create and then you can test it out by running your application and execute membership actions such as Signing up or Signing in to your application.

Created tables after running above commands:
AspNetRoles
AspNetUserClaims
AspNetUserLogins
AspNetUserRoles
AspNetUsers
__MigrationHistory


Hope this helps.

Thanks

-- ME

Tuesday, June 10, 2014

Getting started with Solr for .NET architects & developers - part 1

Hi folks,

I am writing this blog post to provide some tips and insights on using open source search technologies such as Solr in your solutions and applications.

Here are my notes:
1) Solr is an open source search server product. It is free and one of the most trusted, mature search products in the market.

2) Solr uses lucene, lucene is the heart of Solr search server product. Lucene is the full text service or component that is used in Solr which provides all search, index and queries capabilities.

3) Lucene is a java based library to create, manage, and retrieve inverted index files.

4) Inverted index is a specialized data structure by Lucene to handle queries to text based documents.

5) Using full text feature that is available in some DBMS is not a replacement for Solr, Solr provides advanced search, query and ranking capabilities.

6) Solr provides on top of lucene full text capability the following features: pagination, sorting, faceting, auto-suggest, spell checker, hit highlighting, data modeling, grouping, and standard http API to integrate with your solutions.

7) Each Solt server has only one home, the path of the home is $SolrInstallation/example/solr, where $SolrInstallation is the path where you installed solr binaries.

8) Each Solr server can contain more than 1 core, each core contains its index data and configuration.

9) Solr web application is stored under solr.web folder which contains all servelts, html and js files.

10) Solr is running on Jetty as an application server. Google is using Jetty in its App Engine platform.


Hope this helps.

References: Solr in Action



Friday, April 25, 2014

Unable to retrieve metadata for unrecognized element 'providers' when adding a controller in VS 2013

Hi,

I was trying to add a new controller in my project using Visual Studio 2013. I was using Code First Entity Framework for my data access. I tried to build and clean the project few times before adding the new controller; but still was getting this error message when  adding a new controller to my web api project.

Here is the error message:


The solution is the following:
1) Open the web.config file in your project.
2) Scroll down until you see entity framework section.
3) This is how it will be looking:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

4) Remove the providers section.
5) Save and you will be able to add new controllers!

Hope this helps!


Thursday, April 17, 2014

Error when running web applications that reference SharePoint dlls in IIS Express

Hi All,

I was developing a web application that reference SharePoint 2013 dlls, and since SharePoint server dlls in general runs on a 64 bit environment, i want to use IIS express in Visual Studio 2013 without the need to use full local IIS that runs on 64 bit.

I was getting this error message when i am running my web application:

Could not load file or assembly or one of its dependencies. 

and i was seeing in the yellow error page that the VS 2013 is using IIS express under c:\ program files (86)\ IIS Express folder which is the 32 bit.


I want to switch IIS express to 64 bit so i will be able to run my web application that references 64 bit SharePoint dlls. here is the solution for this:

From Visual Studio 2013 IDE:

Click on :  Tools --> Options --> Projects and Solutions --> Web Projects  --> Use the 64 bit version of IIS Express --> check this checkbox and save.


Once you save, make sure you exit any instance of the IIS express and try to re-run your project! It will run with no issues!

Enjoy!


Tuesday, April 01, 2014

How to add a required field validator in SharePoint 2013 Application Pages using HTML5

Hi All,

I was developing a custom application page in SharePoint 2013, while adding all my controls in the custom application page i wanted to add a required field validator to a textbox control.

As a .NET developer, you will find the normal action is to add a required field validator to your page, which basically works, but in this post i want to show you that you can easily incorporate HTML5 validation attributes in SharePoint 2013 pages!!

In HTML5, you can add an attribute called required to any control, which tells the browser that this control is a required control.


<%@ Register TagPrefix="spuc" Namespace="Microsoft.SharePoint.WebControls"
             Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


<spuc:InputFormTextBox ID="txtName" runat="server" class="ms-input"
      Title="Full Name" TextMode="SingleLine" Columns="40" required />


Adding a required attribute to your markup control will flag this control as a required control in your SharePoint page.

You can apply any other HTML5 validation attribute and it will render correctly in any SharePoint Page with no additional setup.

Here is a cool blog about how to apply HTML5 validation types into input control:
http://www.the-art-of-web.com/html/html5-form-validation/
 

Enjoy!



--ME

Working Tips with SPWebConfigModification Class in SharePoint 2013

Hi Folks,

I was working on updating a SharePoint web.config programmatically in SharePoint 2013 Farm Solution. Applying web.config modifications in SharePoint is straight forward task by adding the modifications into a collection of the web application and then submit your changes.

Since this class is poorly documented, I was trying to update a specific web application web.config and not all web.config in this farm. all the code samples in MSDN and other blogs don't provide a necessary understanding how it works so before taking the MSDN code and apply it into your feature or wsp you should know the following essential tips:

1) You can apply your web config modifications either on the web application level or the content service level which affects all web config files in your farm.

2) When your code has the following line of code, this means that the changes will be taken effect into all web applications in the farm:

SPWebApplication webApp = new SPSite('siteUrl').WebApplication;
WebApp.Farm.Services.GetValue<SPWebService>.ApplyWebConfigModifications();

Even though you are using a web application object, but this code will update all web.config files, which you should avoid when you apply solutions unless you are applying Farm updates.


3) If you want to update a specific web application web.config:

SPWebApplication webApp = new SPSite('siteUrl').WebApplication;
WebApp.Update();  // update specific web.config for this web application
webApp.WebService.ApplyWebConfigModifications();


line #3 will only update the web.config for a specific web application and not all unlike
SPWebService.ContentService.ApplyWebConfigModifications();

Hope this helps!

**References:
1) Add or remove entries in web.config programmatically:
http://msdn.microsoft.com/en-us/library/bb861909(v=office.14).aspx