2016-12-02 1 views

Antwort

2

fand ich selbst heraus.

 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" 
        }} 
      } 

     }); 
Verwandte Themen