private static Deployment AddPersistentVMRole(VirtualMachineProperties properties, IEnumerable<PersistentVMRole> roles)
{
var namer = new RandomAccountName();
var deployment = new Deployment
{
// use the first deployment property if it's not the same then fluent doesn't supporting deployment splitting at this level!
Name = properties.DeploymentName,
// Label = Convert.ToBase64String(Encoding.UTF8.GetBytes(cloudServiceName))
Label = properties.DeploymentName
};
if (properties.VirtualNetwork != null)
deployment.VirtualNetworkName = properties.VirtualNetwork.VirtualNetworkName;
var roleList = new RoleList();
foreach (var role in roles)
{
role.RoleName = role.RoleName ?? namer.GetPureRandomValue();
roleList.Roles.Add(role);
}
deployment.RoleList = roleList;
return deployment;
}