2
我根本不需要PowerShell。我可以很好地創建雲服務,並將我的診斷配置文件作爲工作角色根的一部分。你怎麼打開擴展?如何使用Microsoft.WindowsAzure.Management庫將診斷添加到天藍色的雲服務?
我根本不需要PowerShell。我可以很好地創建雲服務,並將我的診斷配置文件作爲工作角色根的一部分。你怎麼打開擴展?如何使用Microsoft.WindowsAzure.Management庫將診斷添加到天藍色的雲服務?
發現了自己。
var etcs = cloudClient.HostedServices.ListAvailableExtensions();
var et = etcs.FirstOrDefault(p => p.Type == "PaaSDiagnostics");
cloudClient.HostedServices.AddExtension("agent1", new Microsoft.WindowsAzure.Management.Compute.Models.HostedServiceAddExtensionParameters()
{
Type = et.Type,
ProviderNamespace = et.ProviderNameSpace,
Id = "testext",
Version = et.Version,
PublicConfiguration = File.ReadAllText(@"PubConfig.xml"),
PrivateConfiguration = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PrivateConfig xmlns=\"http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration\"><StorageAccount name=\"store\" key=\"" + ks.SecondaryKey + "\"></StorageAccount></PrivateConfig>"
});
var id = cloudClient.Deployments.Create("agent1", Microsoft.WindowsAzure.Management.Compute.Models.DeploymentSlot.Production, new Microsoft.WindowsAzure.Management.Compute.Models.DeploymentCreateParameters()
{
Name = "test",
Configuration = File.ReadAllText(@"ServiceConfiguration.Cloud.cscfg"),
PackageUri = blob.Uri,
Label = "Test",
StartDeployment = true,
ExtensionConfiguration = new Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration()
{
AllRoles = new[] { new Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration.Extension()
{
Id = "testext",
State = "Enable"
}}
}
});