Skip to content

Commit 2942f4b

Browse files
FQDN in VMSS.
1 parent baba2cc commit 2942f4b

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/ResourceManager/Compute/Commands.Compute/Generated/Models/PSVirtualMachineScaleSet.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ public string ResourceGroupName
3737
return m.Success ? m.Groups["rgname"].Value : null;
3838
}
3939
}
40+
41+
// Gets or sets the FQDN.
42+
public string FullyQualifiedDomainName { get; set; }
4043
}
4144
}

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,12 @@ async Task SimpleParameterSetExecuteCmdlet(IAsyncCmdlet asyncCmdlet)
266266

267267
// generate a domain name label if it's not specified.
268268
await PublicIPAddressStrategy.FindDomainNameLabelAsync(
269-
domainNameLabel: domainNameLabel, name: VMScaleSetName, location: Location, client: client);
269+
domainNameLabel: domainNameLabel,
270+
name: VMScaleSetName,
271+
location: Location,
272+
client: client);
273+
274+
var fqdn = PublicIPAddressStrategy.Fqdn(domainNameLabel, Location);
270275

271276
var target = virtualMachineScaleSet.GetTargetState(current, client.SubscriptionId, Location);
272277

@@ -288,6 +293,7 @@ await PublicIPAddressStrategy.FindDomainNameLabelAsync(
288293
{
289294
var psObject = new PSVirtualMachineScaleSet();
290295
ComputeAutomationAutoMapperProfile.Mapper.Map(result, psObject);
296+
psObject.FullyQualifiedDomainName = fqdn;
291297
asyncCmdlet.WriteObject(psObject);
292298
}
293299
}

src/ResourceManager/Compute/Commands.Compute/Strategies/Network/PublicIPAddressStrategy.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ public static async Task FindDomainNameLabelAsync(
6363
do
6464
{
6565
domainNameLabel.Value = (name + '-' + Guid.NewGuid().ToString().Substring(0, 6)).ToLower();
66-
} while ((await networkClient.CheckDnsNameAvailabilityAsync(location, domainNameLabel.Value)).Available != true);
66+
} while ((await networkClient.CheckDnsNameAvailabilityAsync(location, domainNameLabel.Value)).Available
67+
!= true);
6768
}
6869
}
70+
71+
public static string Fqdn(Mutable<string> domainNameLabel, string location)
72+
=> domainNameLabel.Value + "." + location + ".cloudapp.azure.com";
6973
}
7074
}

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ await PublicIPAddressStrategy.FindDomainNameLabelAsync(
382382
location: Location,
383383
client: client);
384384

385-
var fqdn = domainNameLabel.Value + "." + Location + ".cloudapp.azure.com";
385+
var fqdn = PublicIPAddressStrategy.Fqdn(domainNameLabel, Location);
386386

387387
// create target state
388388
var target = virtualMachine.GetTargetState(current, client.SubscriptionId, Location);

0 commit comments

Comments
 (0)