Skip to content

Commit

Permalink
FQDN
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Nov 30, 2017
1 parent c7c883f commit 7c247af
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ async Task StrategyExecuteCmdletAsync(IAsyncCmdlet asyncCmdlet)
.Select(nameAndImage => new { OsType = osAndMap.Key, Image = nameAndImage.Value }))
.FirstOrDefault();

OpenPorts = OpenPorts
?? (image.OsType == "Windows" ? new[] { 3389, 5985 } : new[] { 22 });
var isWindows = image.OsType == "Windows";
OpenPorts = OpenPorts ?? (isWindows ? new[] { 3389, 5985 } : new[] { 22 });

var resourceGroup = ResourceGroupStrategy.CreateResourceGroupConfig(ResourceGroupName);
var virtualNetwork = resourceGroup.CreateVirtualNetworkConfig(
Expand Down Expand Up @@ -224,6 +224,8 @@ async Task StrategyExecuteCmdletAsync(IAsyncCmdlet asyncCmdlet)
}
}

var fqdn = DomainNameLabel + "." + Location + ".cloudapp.azure.com";

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

Expand All @@ -238,6 +240,10 @@ async Task StrategyExecuteCmdletAsync(IAsyncCmdlet asyncCmdlet)

var result = newState.Get(virtualMachine);
var psResult = ComputeAutoMapperProfile.Mapper.Map<PSVirtualMachine>(result);
psResult.Fqdn = fqdn;
asyncCmdlet.WriteVerbose(isWindows
? "Use 'mstsc /v:" + fqdn + "' to connect to the VM."
: "Use 'ssh " + Credential.UserName + "@" + fqdn + "' to connect to the VM.");
asyncCmdlet.WriteObject(psResult);
}

Expand Down

0 comments on commit 7c247af

Please sign in to comment.