I have used the azure API to connect to the Azure WebSiteManagementClient, and have used it to create a new empty website. I now want to publish the web pages I have for that site through MsBuild. I can do this provided the publish settings file contains the password for the website. I know that this password is provided as part of the PublishProfile file that is provided by clicking on the "Get Publish Profile" option on the web site definition in the azure portal. As I want to automate the whole process, is there a way to automatically retrieve the PublishProfile file? I can get the password from there and add it into the publish setting file. Thanks
1 Answers
2
votes
The following code will download the same publish profile that you are getting from the Azure Portal.
using (var stream = await _websiteClient.Sites.ListSitePublishingProfileXmlAsync(rgName, siteName, new CsmPublishingProfileOptions()))
{
string profileXml = await (new StreamReader(stream)).ReadToEndAsync();
Console.WriteLine(profileXml);
}
See it as part of a full sample here.