How to get a copy file from blob storage in azure startup task?
Is there any power shell command to download file and place at Application Root in Windows Azure start-up task? I have geo location binary file(30Mb)which is downloaded from http://www.maxmind.com/app/geolitecity. I don't want to include binary file in my project, decided to place in blob storage for faster deployment purpose. I tried to read binary from URL using http://en.googlemaps.subgurim.net/, unfortunately no function to read from URL开发者_如何学C. So i'm finding the way to download that binary file and place in application root directory.
Thanks in advance!
maybe this can help:
$object = New-Object Net.WebClient
$url = 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz'
$local = "$pwd\GeoLiteCity.dat.gz" #path to save download file
$object.DownloadFile($url, $local)
In this case file is zipped, you need to unzip the dat file.
Take a look at the Bootstrap project. It can download from blob storage (or anywhere), unzip, run, etc. in a startup task. It also works with the ServiceConfiguration and RoleEnvironment, so you can use variables from config, e.g:
bootstrapper.exe -get bootstrap/Installer.zip -lr $lr(temp) -unzip $lr(temp)\extract -sc $config(ConnectionString) -run $lr(temp)\extract\installer.msi -args /qn -block
You may also want to look at AzureRunMe:
https://github.com/RobBlackwell/AzureRunMe
AzureRunMe is a boostrap program that provides an off-the-shelf CSPKG file that you can upload to Windows Azure Compute and just run.
From there you can upload your code via ZIP files in Blob Storage and kick off your processes in a repeatable way, just by changing configuration.
精彩评论