Shared Folder Between Azure VMs with Failover - azure

I have 2 Azure VMs I am using that will be responsible for hosting my website. I have traffic manager setup so that VM1 will run my website, and VM2 will be a failover.
I have the site setup working perfectly, except that my site allows users to upload images. These images simply are saved to the file system under the website (site.com/images/user2.jpg)
My question is how to keep these images in sync. For instance, if VM1 is up and a user uploads an image, that will be stored on VM1. If VM1 goes down, VM2 fires off, and the site is back up and running perfectly. Except, it does not have the image that the user uploaded when VM1 was up.
I've looked into Azure file storage, but that appears to need some code changes, which simply can't be done at this time. Is there any other way to keep the two failover systems in sync? It seems like failover isn't a good approach if not.

The easiest way to achieve it is using Azure File storage service.
File storage is a shared storage for applications using SMB 2.1 or 3.0 protocol.
Azure virtual machines can share file data across application components via mounted shares.
You'll need no issue some powershell commands to setup the File Share, and after that you should use net use batch command to map the file share to a mounted unit on each virtual machine Then applications can access that mounted storage any other storage device.
Here you can find detailed information and video about how to implement that solution
How to use Azure File storage with Windows

Related

How can I configure my azure app service to upload the files on my internal network using UNC path?

So, I have an app service hosted on azure and I want that app service to upload the files to my local server's shared folder. Local server has some software configured which processes those uploaded files.
In development environment everything works fine using UNC path for e.g. 10.197.1.65/Public/MyFolder/ and my application can copy the files over the network but I am not sure about how can I do that from app service.
I have encountered few solutions during my research like creating an ASE and VNET , Mapping of Azure Storage with my local drive etc., but I am not sure that which would be the feasible and proper approach.Thanks a lot.
You can't use UNC path from your app service due to that applications cannot connect to anywhere using ports 445, 137, 138, and 139 in the Restricted Outgoing Ports of Azure Web App sandbox.
As far as I know, the App service with VNet Integration is good to access or talk to the resource from a Virtual network or your on-premise network but you may need to deploy a site to site VPN gateway for your local environment. In this way, It does not support mounting a drive, but you can directly access the local data from your application.
For a Windows Container on App Service, It is a preview feature that you can mount an Azure Files share to a directory in your App Service app, then transfer data into Azure Files from your local machine. There are many methods you can interact with Azure file shares.

Not able to use command net use to mount Azure File as drive on my Windows 8 PC

I have created an Azure File service and I am using the following command to mount it as a drive on my Windows 8 system:
net use * \\smb3share.file.core.windows.net\myfileshare /u:smb3share KEY
I have disabled firewall and turned off antivirus still I keep getting the following message from the command prompt:
System Error 53 has occurred. The network path was not found.
From documentation here:
https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/
File storage offers shared storage for applications using the standard
SMB 2.1 or SMB 3.0 protocol. Microsoft Azure virtual machines and
cloud services can share file data across application components via
mounted shares, and on-premises applications can access file data in a
share via the File storage API.
Azure File service is not intented to be used for On-Premises mounts (net use). For accessing files withing Azure File Service from on-premise computers/applications, you need to use the Azure File Service REST API.
You can only mount Azure File Storage share from an Azure VM or Cloud Service.
EDIT
It seems that with the support for SMB 3.0, OS-es like Windows 8.0 / server 2012 and newer are also supported. Then, since you use Windows 8, then the only reason left is your ISP (Internet Service Provider) is blocking outgoing port 445, which is required by the SMB protocol. If you are doing this operation within corporate network (your workplace) the chance that everything outbound is blocked / filtered is much bigger.

Uploading a file to a specif server in azure

I have a site to site connection established in Azure to a machine, and I have created a shared folder in that machine and now I have created an application where I am trying to upload a file and when I am running from visual studio I am able to upload the file in to the specific server but when I am deploying to Azure cloud services, it is giving an error as \10.1.0.xxxx\abc path not found. what can be the issue.
Thanks in Advance.
Regards,
Suresh
I was confused a bit from your question. When you said 'site to site connection' did you mean you created a virtual network and point to site VPN between your virtual machine and your desktop?
Well if you are using windows azure virtual machine you should be able to create a shared folder and upload files from your local desktop. Just need to create a virtual network and build a VPN between that machine and your desktop. But it might be impossible if you wanted to upload file to your cloud service. You might be able to open the firewall port on your cloud service virtual machine through powershell and startup task but all files you uploaded will be cleared when your cloud service virtual machine was moved by azure fabric controller.

Access shared folder that exists in VM or local machine from azure cloud service(web-role)

I have an Asp.Net web role which is running in Azure Cloud service.
Now I have created a virtual machine in Azure data center.
And also I have created a shared folder for storing my files(.xls,.csv .. files).
how can I access the shared folder files that are exists in the VM from my web-role ?
thanks
Arun.
Shared folders are mainly for on-premise environment and in cloud you would have to think quite different. In cloud environment, a machine is placed behind a very tightly closed network system and any port you will open in your VM will be configured for external user through firewall. Accessing a shared folder would require you to enable file sharing in your machine first and the configuring proper ports. Similar configuration is needed on other Cloud Service VM as well which is more complex. The fact is when you are in cloud you should think beyond shared folder approach.
What you really need is to use cloud storage i.e. Windows Azure Blob Storage to share content between multiple machines. Price wise it is about ~10 cents/GB/Month and if you keep your VM and Azure Storage in same datacenter there is no bandwidth cost. Once configured your Azure VM and Azure Cloud service can access the Azure Blob storage very easily over HTTP/HTTPS. Learn more about Azure Storage here.

How does SSL work in Windows Azure Virtual Machine?

Previously i have asked question to choose service from windows azure which is best suitable for my application and based on answer # Can we run windowservice or EXE in Azure website or in Virtual Machine? I am going to use Virtual Machine
Regarding WAVM i have below queries
1)Can i implement SSL in same manner as we can do in dedicated server through IIS settings?
2)Also for stroing files/image i am not going to use storage account, so would be there any issue regarding this?
Thanks in advance!
You can use SSL the same way as on any Windows server. Dont forget to add the endpoints for internet (80) and SSL (443). The best way is to have the same port numbers externaly.
I have used this in a training for WIF where the Domain controler and ADFS were on a virtual machine in Azure.
For the second awnser. the C:\drive (OS disk) has a differnt backup senario than the disks you ad to the VM. So for storage of data add a Datadisk to your VM. The disk have a max size of 999GB. Depending on the VM size you can mout up to 16 disks. See image for instructions
The vhd file for the disk is in Azurestorage and therfore replictated 3 times localy and 3 times due to georeplication.
S.Y.
Michiel van Buuren

Resources