2

We have a few standard websites in our azure subscription. We are trying to automate some tasks, one being creating a site in Azure. We are using the 'Microsoft Azure Web Sites Management Library' from Nuget. We are using the below code, but in spite of telling it dedicated, it always gets created as a Free site and not Standard.

domain is a string containing the domain for the site. hostName is a string containing the domain + 'azurewebsites.net', domain has periods stripped for hostName. ws is a WebSpace object that we retrieved from calling previous Azure methods for our subscription.

var newSite = new WebSiteCreateParameters();
newSite.Name = domain;
newSite.HostNames.Add(hostName);
newSite.ComputeMode = WebSiteComputeMode.Dedicated;
newSite.ServerFarm = "DefaultServerFarm";
newSite.WebSpaceName = ws.Name;
newSite.WebSpace = new WebSiteCreateParameters.WebSpaceDetails()
{
      GeoRegion = ws.GeoRegion,
      Name = ws.Name,
      Plan = ws.Plan
};
var r = await AzureClient.WebSites.CreateAsync(
    ws.Name, 
    newSite, 
    new System.Threading.CancellationToken()
);
6
  • Thanks, will share with the team. Apr 8, 2014 at 7:39
  • From the sample code, I am making the call correctly, it should be creating a 'Standard' class website?
    – John C
    Apr 8, 2014 at 14:49
  • So it sounds like today creating a site will always happen initially in the free tier, so you'll just need to configure it after the fact to be Standard. Not sure about the design on it now but I'd suggest trying the 2-step approach for now. Apr 10, 2014 at 18:01
  • @JeffWilcox Unfortunately this is still happening even with the latest 2.4 Azure SDK. Aug 5, 2014 at 11:53
  • @OliverWeichhold This is a server side issue, not a client side SDK issue.
    – John C
    Aug 16, 2014 at 5:05

1 Answer 1

0

Can you take a look at this sample in github:

https://github.com/btardif/AzureWebsitesAPISamples

To create a site in standard mode you will first need to create the Web Hosting Plan (WHP) and then assign the website to this WHP.

Web Hosting Plans AKA ServerFarm have a SKU property Size and Instance count.

1
  • This question along with its code was asked prior to azure having Web Hosting Plans.
    – John C
    Aug 16, 2014 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.