Create Azure Cache Programmatically - asp.net

I am creating an application that automate the deployment to Azure Web Sites. I was able to create Azure Web Site, database and storage programmatically but I didn't saw any library out there that can create Azure Cache programmtically. Anyone?
Thanks in advance. :)

Whatever operations you perform on Windows Azure Management Portal is backed by Windows Azure Service Management API. I'm pretty sure that there's an API for creating and configuring caching programmatically but it has not been made public yet. I would recommend keeping an eye out on the REST API documentation page. This is where you will find information about how you could create cache programmatically.

Azure Managed Cache is in preview and hence REST API are not available for it. Also it can not be created from Portal. However, you can use Powershell commands to create it. Once created you can then manage it from azure portal itself.
Following command can be used for creating Basic Cache of 128MB.
New-AzureManagedCache -Name YourCacheName -Location "YourLocation"
For the detailed steps refer to - Create Azure Managed Cache from Powershell
So you can create .ps1 file or powersehll commands string which then can be invoked from your code.
Hope this helps.

Related

Migrating ASp.net webform based websites to Microsoft Azure

I have to migrate asp.net webform & asp.net MVC websites to Microsoft Azure and most of the webform based website have been created as "website project" in visual studio. and all website use MS SQL Server 2008 R2 as database plus all website use either .net Framework 4.0/4.5.
I confused by reading article regarding migrating webform based website to Azure not working and need code changes and if we use Azure database then we cant use stored procedures etc... this has confused me alot.
So i have few question regarding this.
Can i move asp.net webform 4.0 based website directly to Azure without making any code changes assuming we are connecting to external SQL SERVER 2008.
For first step can which MS SQL Server database i need to choose on Azure so that i can easily restore database in Azure and connect to this database from my local machine using MS Management Studio..
I have heard lot about Azure store files as blob and we need to make change to code to point to new path. What is this Azure blob and why do we need to change code for pointing them blob.
What i have to do keep allowing users from uploading images & document without making any changes in the code..
Does Azure website have always 1 instance running or multiple instance running, i am asking this as our website use InProc session state will i lose session if it is ruuning on multiple instance. or should we prefer SQL Session state in Azure enviroment.
What i should take into consideration for migration current website to Azure.
Will copy pasting all the files in Azure work. Please advise
Depending on how old the ASP.NET webforms projects are, you are going to need to bring them up to date with current security, and anti forgery tokens, etc.
Also if the project was previously a "Website" and not a "Web Application", this is also something that you will need to take into consideration!
I am currently working on upgrading a website to a web application.
This might be a useful website to look through
http://www.gregthatcher.com/Azure/Ch7_ConvertWebsiteToWebApplication.aspx
Migrating to Azure is easy ,
create a Azure account and create the web app which you want to host or create.
you can deploy using FTP or use the build and deploy feature in TFS account.
Steps
You need to create web app in your account.
create a DB in azure manually or export your DB to azure from Management studio if you have an existing DB
get the Connection string from the Publish profile from Azure.
Setup the storage account if you want to store files ,images etc.

How to deploy Azure Web Apps using Azure Resource Manager-Based PowerShell?

I want to deploy my Azure web apps using PowerShell. Here is my expected workflow:
Create Package using MSBuild
Deploy the package to Azure
I tried with the approach described in the below link:
https://github.com/gregpakes/DoIHaveGPS/blob/master/PublishScripts/Publish-WebApplication.ps1
I modified the script to use an existing web app instead of creating. So I call something like Get-AzureWebsite -Name $Config.name..
But it never finds the existing app service (web app) due to the subscription issue. I tried so many times to switch the subscription but it's not working. Get-AzureWebsite always keep searching on the old subscription which I don't use anymore.
If I call Get-AzureRmSubscription from powershell I get two subscriptions but if I call Get-AzureSubscription I get only one.
How can I deploy my application packages using powershell using resource manager based powershell?
The cmdlets used by the script you linked to are using the "old" service management interface. If Get-AzureSubscription doesn't return a subscription that means it's only available to use via AzureRM. The AzureRM web app cmdlets don't have a simple "publish" command as the old ones did... So if you wanted to replicate that in PowerShell you could do something like this:
$deploycmd = "$env:ProgramFiles\IIS\Microsoft Web Deploy V3\msdeploy.exe"
$packageLocation = Resolve-Path -Path "C:\users\bjm\downloads\package.zip"
$webAppName = 'myazuresite'
$user = '$myazuresite'
$pass = 'jSjku1lWBdZNgGjyZWYfDhFn4DFfZlAqTq1RjPu5Fnv3yYe9l2Fl5xz5RK0x'
$setParam = "-setParam:name=""IIS Web Application Name"",value=$webAppName"
$dest = "-dest:auto,ComputerName='https://$webAppName.scm.azurewebsites.net:443/msdeploy.axd?site=$webAppName',UserName='$user',Password='$pass',AuthType=Basic"
& $deploycmd "-verb:sync", "-source:package=$packageLocation", $setParam, $dest
I actually prefer juvchan's approach but if you've already got the rest in place via PS this might be easier.
After you've created the web deploy package for your application, you need to create a Azure Resource Manager (ARM) template which allows you to deploy to a Azure web app using the web deploy package.
Then you can use the Azure PowerShell cmdlet below to deploy your ARM template above to achieve what you require.
New-AzureRmResourceGroupDeployment -Name <deployment-name> -ResourceGroupName <resource-group-name> -TemplateUri <ArmTemplateJsonUri>
Useful references:
Deploy a web app with MSDeploy, custom hostname and SSL certificate
Deploy your app to Azure App Service
https://github.com/Microsoft/azure-docs/blob/master/articles/azure-resource-manager/resource-group-template-deploy-cli.md
https://github.com/Microsoft/azure-docs/blob/master/articles/azure-resource-manager/resource-group-template-deploy-cli.md
This topic shows how to use the Azure portal with Azure Resource Manager to deploy your Azure resources. To learn about managing your resources, see Manage Azure resources through portal. Currently, not every service supports the portal or Resource Manager. For those services, you need to use the classic portal. For the status of each service, see Azure portal availability chart.
1. To create an empty resource group, select New > Management > Resource Group.
2. Give it a name and location, and, if necessary, select a subscription. You need to provide a location for the

Is it possible to execute Azure PowerShell scripts from an ASP MVC project?

I'm new using ASP.Net MVC, so i'm doing an auto-training in order to develop a web portal for an intranet that can receive request from users to deploy Virtual Machines from Azure, the request is received by an administrator who can run a script from the portal to create the Virtual Machine.
For example, The idea is to store the scripts in a database, so when the administrator do the action to create the "virtual Machine 01" (he have limited option of Virtual Machines configurations to create), the software run the script "01" store on the database.
That is possible? I hope I have explained the idea well.
Also, if that is possible, can I also show the possibles error messages is something wrong happened?.
Instead of using Powershell, why not manage it directly from your .NET code?
Azure provides API's that can be called from .NET.
http://azure.microsoft.com/en-us/documentation/api/
You'd probably want to look at their Compute Management API for handling virtual machines.
http://azure.microsoft.com/en-us/documentation/api/management-compute-sdk-net/

How to add users and passwords to a local cloudify deployment

I am following the Cloudify user guide - its pretty easy to follow, and have installed a local deployment successfully.
Now I want to add users and passwords to the web management interface, how to do this? By default, the web interface supports anonymous login.
Assuming your aim is to obtain full control over deployments, use the Cloudify shell (or "Cloudify CLI").
As the Cloudify shell currently exposes read-only operations, it does not require login details. Configuring secured access for the REST API, however, can be done using spring security (which will be documented soon).

Windows Services in the Cloud

Im looking at writing a application for a web 2.0 start up site which will essential monitor specific RSS feeds.
Due to the expected up take of such a service I am expecting that taking advantage of cloud computing would be the way to do it, however with my lack of experience I do not know if it is possible to run a Windows service in the cloud.
There will be a web front end to this but it isn't imagined that that will have a heavy load as it will be just for sign up, then users will recevie notifications by SMS/Email
You can run a "service" in the cloud, when using Azure. It's called a "Worker Role" see the Architecture here.
If you're looking at running Windows Azure (which splits into a web role and worker role).
You'll have to sign up for an Azure key (The Bizspark pack includes one I believe) to get started, download the SDK and Azure tools.
It looks like you would only really need the web role for this, in which case it's just a normal ASP.NET / MVC site that you'd write as normal.
Essentially the benefit you'd get here would be being able to ramp up the number of server instances running your application by tweaking the config file.
The other option is the Amazon EC2 Cloud which allows you to instantiate as many instances of Windows2k3 Data Centre edition as you need. I run Windows Services, IIS, Postgresql etc. on such an instance with no issues.
Managed to find this link to publishing WCF services in the cloud. Im new to WCF so not sure if it will offer the solution I require, it probably will but I need to do some more research
Link

Resources