Vova Bilyachat

Melbourne, Australia

How to setup azure network with WebApp and Database VM and configure VPN to workstation

15 September 2015


This artcle is just example how to use GATEWAY but in real app avoid using gateway. Read more


Few weeks ago i started playing with Azure. My task was simple how to configure Asp.Net Mvc Application and connect to database which is on other server in same network. The main reason why i spend lots of time is that i was using preview portal and as i understood its not yet ready and there is still some bugs and not finished features, but generally i like what Azure team did, new design is cool and allow to customize dashboard so you can easily configure what you want to see.
I would suggest to start from configuring network


Lets start our configuration from network. Click on New -> Networking -> Virtual Network -> Deployment model -> Classic
NOTE: Dont choose Resource Manager deployment type because then you will not be able to connect with WebApp

Configure Address space

Address space CIDR block: 
Subnet name: Db
Click create and wait. Azure will add icon to your dashboard after you hit create.

After its done network details will be opened.

Next step would be to create gateway where we will be able to connect via vpn and connect our web app. Click on gateway icon and select point to site connection type, I default address spaces since 256 addresses in range is enough for me since i will have one web app scalable from 1 to 10 and 1 vpn connection at time.

after you hit ok it will start deployment and generally it takes up to 30 mins. so we have time to start with webapp

As soon as gateway is created root certificate should be uploaded so it will be possible to connect to this network with vpn.
Start command line as Administrator
Go to 
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\
and run command
makecert -sky exchange -r -n "CN=BetaRootCertificate" -pe -a sha1 -len 2048 -ss My "BetaRootCertificate.cer"
Upload certificate to azure by clicking on your network then -> Point to site -> Manage certificates -> Upload

After we deployed our root certificate we need to generate client certificate from same path 
makecert.exe -n "CN=ClientBeta" -pe -sky exchange -m 96 -ss My -in "BetaRootCertificate" -is my -a sha1
We are ready now to connect via vpn, on the vpn connection where manage certificate buttons there is VPN Client buttons choose which you need 32 or 64 bit. Download it and install and here we go we are ready to connect.


To host asp.net mvc i choose web app since its easy to manage and scale. MOre info how to use you can find in the web.New-> Web + Mobile -> Web App 

To use vnet minimum requirement is Standart types. 
After Webapp is created we would need to finish configuration of network. Click on webapp and scroll to networking
Click on vnet integration, then setup in VNet integration section, then choose our existing network from list.


After that wait few mins since it takes some time to create availability set. When you choose right availability set network will be configured automatically and you will not be able to change network settings for this VM

Now our web app will be able to see database server. In next post i will show problems with deploying Asp.net MVC with mysql database.





Read More

MSBuild / Visual Studio wpp.targets was not found

01 September 2015

I saw many projects which always have built.bat which allow to build project without opening visual studio and it was mistery for me until now. In my team we have designer who can but dont need to open Visual Studio but needs to build project locally. So i have created simple bat file.
But it was not working even when we open VS on that machine it shows exceptions.


Microsoft Visual Studio


The imported project "PATH\*.wpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets




After some googling i found post about how to solve this


But then it breaks publish functionality. So i solve this issue buy adding parameter to ms build and tuning Web csproj by adding condition. If parameter  SkipWebPublish. is passed to msbuild then VSToolsPath will skip initialization


    <VSToolsPath Condition="$(SkipWebPublish) == '' Or $(SkipWebPublish) == '*Undefined*'">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>


Then build.bat command will have to pass this parameter

@echo off
reg.exe query "HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0" /v MSBuildToolsPath > nul 2>&1
if ERRORLEVEL 1 goto MissingMSBuildRegistry

for /f "skip=2 tokens=2,*" %%A in ('reg.exe query "HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0" /v MSBuildToolsPath') do SET MSBUILDDIR=%%B

IF NOT EXIST "%MSBUILDDIR%msbuild.exe" goto MissingMSBuildExe

"%MSBUILDDIR%msbuild.exe" /version

"%MSBUILDDIR%msbuild.exe" Source/SolutionName.sln /t:rebuild /p:configuration=Debug /p:Platform="Any CPU" /p:VisualStudioVersion=12.0 /p:SkipWebPublish=true

Read More

Javascript / AngularJs orderBy Wrong order for Ukrainian і

20 August 2015

Today i face to problem when angular orderBy sort incorrectly Ukrainian names. So when i order by

ng-repeat="dancer in dancers | filter: filterDancers(criteria) | orderBy: 'FullName'"

And result is incorrect
Then i found that issue is in javascript sort which could be easily fixed by adding custom filter

app.filter('orderByCustom', function () {

    return function (items) {

        return items.sort(function (a, b) { return a.FullName.localeCompare(b.FullName) });;



then html

ng-repeat="dancer in dancers | filter: filterDancers(criteria) | orderByCustom"

And now it works

Read More

Nuget EXEC : warning : Unable to read package from path

19 August 2015

Today i got strange exception on my machine when restoring Nuget packages. It show me exception  EXEC : warning : Unable to read package from path PackageName.Version.

Firstly i thought issue was with nuget server but when i open nuget website  it works as expected, also it works on my build machine so I understood issue is probably just on my machine (I suppose some network issues).
After some googling i found suggestion to clean nuget cache which is located in foder %LocalAppData%\NuGet\Cache.  But again it does not help me. When i rebuild next time I saw that many packages are 8kb in size and that which wont install.

Go to nuget download and find exact version of package you need and download it to nuget cache folder (%LocalAppData%\NuGet\Cache) then try to rebuild it will work :)

Read More

How to configure Google Music global shortcuts in Chrome

21 July 2015


For few month's i am using Google music, and I really love it but it has one disadvantage until now, I didn't know how to configure global shortcuts. Finally i found how to do that 
Firstly install Google mini player by clicking button in player 

It will install chrome extention.
Then go to Options -> More tools -> Extensions Scroll down on page and on the right bottom of the page there is link Keyboard shortcuts click on that link to open popup for configuration. Mine look like following example

Now if you work you can use them to control your music :)

Read More

How to cleanup Gmail inbox automatically

21 July 2015

Gmail offer almost unlimited space to store email, but in my case this space is important since i am sending so many attachment that right now my inbox is near 10gb. So with new year i decided to cleanup my inbox to have more space to store backup photos from my phone. I started to do that manually but it would take me few hours, and as developer i started googling how i can do it faster and i found good way to do that throw scripting. I found script and modified it my needs and now it works in following way, after 2 days message from inbox will be added to label "Delete me", if message is starred or added to any label then it will be ignored since this message is important for me, then messages marked with "Delete me" and older then one month will be moved to trash.
To run this script go to scripts page.  Create blank project and insert my script
var deleteLabelName = "Delete me";
var acrhiveDates = "2d";
var removeDates = "90d"
function archiveInbox() {
// Every thread in your Inbox that is read, older than two days, and not labeled "delete me".
var label = GetDeleteLabel();
var threads = GmailApp.search('label:inbox older_than:'+acrhiveDates+' -label:* -is:starred');
for (var i = 0; i < threads.length; i++) {

function GetDeleteLabel(){
var label = GmailApp.getUserLabelByName(deleteLabelName);
label = GmailApp.createLabel(deleteLabelName)
return label;

function cleanupItems() {
var batchSize = 100 // Process up to 100 threads at once
var threads = GmailApp.search('label:"'+deleteLabelName+'" older_than:'+removeDates);
for (j = 0; j < threads.length; j+=batchSize) {
GmailApp.moveThreadsToTrash(threads.slice(j, j+batchSize));
archiveInbox and cleanupItems can be runned manually or using triggers to be runned everyday. To do so click on projects triggers button in pannel

I have trigger for each hour for archiveInbox(Because it has some time limitation so to cleanup some date script should be runned multiple times) and cleanupItems daily.

Read More