private Site CreateNewSite(string suffix) { var webspaceList = WebsitesClient.ListWebSpaces(); if (Git && webspaceList.Count == 0) { string error = string.Format(Resources.PortalInstructions, Name); throw new Exception(string.Format("{0}\n{1}", error, Resources.PortalInstructionsGit)); } WebSpace webspace = FindWebSpace(webspaceList); var website = new SiteWithWebSpace { Name = Name, WebSpace = webspace.Name, WebSpaceToCreate = webspace }; Site result; try { result = CreateSite(webspace, website); } catch (EndpointNotFoundException) { // Create webspace with VirtualPlan failed, try with subscription id // This supports Windows Azure Pack webspace.Plan = CurrentContext.Subscription.Id.ToString(); result = CreateSite(webspace, website); } return(result); }
private void GetNoName() { Do(() => { var websites = WebsitesClient.ListWebSpaces() .SelectMany(space => WebsitesClient.ListSitesInWebSpace(space.Name)) .ToList(); Cache.SaveSites(CurrentSubscription.SubscriptionId, new Sites(websites)); WriteWebsites(websites); }); }