There is a sample in the Windows Azure platform training kit that does this programmatically. Here is an snippit example ...
Uri address = ServiceBusEnvironment.CreateServiceUri("sb",
serviceNamespaceDomain, "EchoService");
TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();
sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret;
ServiceHost host = new ServiceHost(typeof(EchoService), address);
IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);
foreach (ServiceEndpoint endpoint in host.Description.Endpoints)
{
endpoint.Behaviors.Add(sharedSecretServiceBusCredential);
}
host.Open();
joelf source
share