Skip to content

Commit 2a0bdbf

Browse files
vthiebaut10PaulHiginBethanyZhou
authored
[Az.Ssh] [Preview] Version 0.1.1 (#21039)
* Add support for Private Clouds * Make Scenario Tests work * Check if Account is Service Principal before attempting AAD Login * Add -Rdp parameter to Enter-AzVM * Make sure getting the native application command return an expected type. Co-authored-by: Paul Higinbotham <[email protected]> * Address code review comments. * Final fixes * Fix scenario tests * Update help files and add Compute to solution to see if tests work * Remove ResourceType ArgumentCompleter and rely on ValidateSet Co-authored-by: Beisi Zhou <[email protected]> * Adress Code Review Comments * Update src/Ssh/Ssh/Az.Ssh.psd1 --------- Co-authored-by: Paul Higinbotham <[email protected]> Co-authored-by: Beisi Zhou <[email protected]>
1 parent c8409d7 commit 2a0bdbf

File tree

21 files changed

+1343
-1275
lines changed

21 files changed

+1343
-1275
lines changed

src/Ssh/Ssh.Test/ScenarioTests/Common.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ function RandomString([bool]$allChars, [int32]$len) {
66
}
77
}
88

9-
function Get-RandomArcName
9+
function Get-ArcServerName
1010
{
11-
return 'arc-' + (RandomString -allChars $false -len 6)
11+
return 'arc-' + (getAssetName)
1212
}
1313

14-
function Get-RandomVmName
14+
function Get-AzureVmName
1515
{
16-
return 'vm-' + (RandomString -allChars $false -len 6)
16+
return 'vm-' + (getAssetName)
1717
}
1818

19-
function Get-RandomResourceGroupName
19+
function Get-ResourceGroupName
2020
{
21-
return 'rg-' + (RandomString -allChars $false -len 6)
21+
return 'rg-' + (getAssetName)
2222
}
2323

2424
function Get-PasswordForVM

src/Ssh/Ssh.Test/ScenarioTests/GetAzSshConfigTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ public GetAzSshConfigTests(ITestOutputHelper output) : base(output)
1111
}
1212

1313
[Fact]
14-
[Trait(Category.AcceptanceType, Category.LiveOnly)]
14+
[Trait(Category.AcceptanceType, Category.CheckIn)]
1515
public void TestGetArcConfig()
1616
{
1717
TestRunner.RunTestScript("Test-GetArcConfig");
1818
}
1919

2020
[Fact]
21-
[Trait(Category.AcceptanceType, Category.LiveOnly)]
21+
[Trait(Category.AcceptanceType, Category.CheckIn)]
2222
public void TestGetVmConfig()
2323
{
2424
TestRunner.RunTestScript("Test-GetVmConfig");

src/Ssh/Ssh.Test/ScenarioTests/GetAzSshConfigTests.ps1

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ function Test-GetArcConfig
1010
if ($IsMacOS) {
1111
return
1212
}
13-
$MachineName = Get-RandomArcName
14-
$ResourceGroupName = Get-RandomResourceGroupName
13+
$MachineName = Get-ArcServerName
14+
$ResourceGroupName = Get-ResourceGroupName
1515
$SubscriptionId = (Get-AzContext).Subscription.Id
1616
$TenantId = (Get-AzContext).Tenant.Id
1717

@@ -48,7 +48,11 @@ function Test-GetArcConfig
4848
$os = 'linux'
4949
}
5050

51-
$proxyName = "sshProxy_" + $os + "_" + $arch +"_1_3_017634.exe"
51+
52+
$proxyName = "sshProxy_" + $os + "_" + $arch +"_1_3_017634"
53+
if ($IsWindows) {
54+
$proxyName = $proxyName + ".exe"
55+
}
5256
$proxyPath = Join-Path $HOME ".clientsshproxy" $proxyName
5357

5458
$relayPath = Join-Path (Split-Path ((Resolve-Path ./config).Path)) "az_ssh_config" "$ResourceGroupName-$MachineName" "$ResourceGroupName-$MachineName-relay_info"
@@ -71,8 +75,8 @@ Test Exporting SSH Config File for an Azure VM using Local User Login. Test over
7175
#>
7276
function Test-GetVmConfig
7377
{
74-
$VmName = Get-RandomVmName
75-
$ResourceGroupName = Get-RandomResourceGroupName
78+
$VmName = Get-AzureVmName
79+
$ResourceGroupName = Get-ResourceGroupName
7680
$SubscriptionId = (Get-AzContext).Subscription.Id
7781
$TenantId = (Get-AzContext).Tenant.Id
7882

@@ -82,9 +86,10 @@ function Test-GetVmConfig
8286

8387
New-AzResourceGroup -Name $ResourceGroupName -Location "eastus" | Out-Null
8488

89+
$domainlabel = "d1" + $ResourceGroupName
8590
try
8691
{
87-
$vm = New-AzVM -ResourceGroupName $ResourceGroupName -Name $VmName -Location "eastus" -Image UbuntuLTS -Credential $cred
92+
$vm = New-AzVM -ResourceGroupName $ResourceGroupName -Name $VmName -Location "eastus" -Credential $cred -DomainNameLabel $domainlabel
8893
Remove-Item ./config -ErrorAction Ignore
8994

9095
Assert-NotNull $vm

src/Ssh/Ssh.Test/ScenarioTests/SshTestRunner.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,11 @@ protected SshTestRunner(ITestOutputHelper output)
2222
{
2323
helper.RMProfileModule,
2424
helper.GetRMModulePath("Az.Ssh.psd1"),
25-
helper.GetRMModulePath("AzureRM.Compute.psd1")
25+
helper.GetRMModulePath("Az.Compute.psd1"),
2626
})
2727
.WithNewRecordMatcherArguments(
28-
userAgentsToIgnore: new Dictionary<string, string>
29-
{
30-
{"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"},
31-
{"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2017-05-10"},
32-
{"Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient", "2016-09-01"},
33-
},
34-
resourceProviders: new Dictionary<string, string>
35-
{
36-
{"Microsoft.Resources", null},
37-
{"Microsoft.Compute", null},
38-
}
28+
userAgentsToIgnore: new Dictionary<string, string>(),
29+
resourceProviders: new Dictionary<string, string>()
3930
)
4031
.Build();
4132
}

src/Ssh/Ssh.Test/SessionRecords/Microsoft.Azure.Commands.Ssh.Test.ScenarioTests.GetAzSshConfigTests/TestGetArcConfig.json

Lines changed: 133 additions & 191 deletions
Large diffs are not rendered by default.

src/Ssh/Ssh.Test/SessionRecords/Microsoft.Azure.Commands.Ssh.Test.ScenarioTests.GetAzSshConfigTests/TestGetVmConfig.json

Lines changed: 556 additions & 682 deletions
Large diffs are not rendered by default.

src/Ssh/Ssh.Test/Ssh.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="57.0.0" />
22+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="60.0.0" />
2323
</ItemGroup>
2424

2525
</Project>

src/Ssh/Ssh.sln

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.31702.278
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.4.33213.308
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ssh", "Ssh\Ssh.csproj", "{42656543-77AD-4968-BA4B-BE0778705625}"
66
EndProject
@@ -20,6 +20,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ssh.Helpers", "Ssh.Helpers\
2020
EndProject
2121
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ssh.Test", "Ssh.Test\Ssh.Test.csproj", "{D7433FFA-1008-4C8E-8E64-3419D20BDCCC}"
2222
EndProject
23+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute", "..\Compute\Compute\Compute.csproj", "{AEFE94D4-CBA1-4B3A-AC7C-4946B6BE7A62}"
24+
EndProject
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute.AlcWrapper", "..\Compute\Compute.AlcWrapper\Compute.AlcWrapper.csproj", "{38A6AE2E-4F40-415A-9998-2049E145B27E}"
26+
EndProject
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute.Helpers", "..\Compute\Compute.Helpers\Compute.Helpers.csproj", "{E5FD2EC8-264B-4A04-9650-A0E5A65AC4DE}"
28+
EndProject
2329
Global
2430
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2531
Debug|Any CPU = Debug|Any CPU
@@ -62,6 +68,18 @@ Global
6268
{D7433FFA-1008-4C8E-8E64-3419D20BDCCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
6369
{D7433FFA-1008-4C8E-8E64-3419D20BDCCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
6470
{D7433FFA-1008-4C8E-8E64-3419D20BDCCC}.Release|Any CPU.Build.0 = Release|Any CPU
71+
{AEFE94D4-CBA1-4B3A-AC7C-4946B6BE7A62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{AEFE94D4-CBA1-4B3A-AC7C-4946B6BE7A62}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{AEFE94D4-CBA1-4B3A-AC7C-4946B6BE7A62}.Release|Any CPU.ActiveCfg = Release|Any CPU
74+
{AEFE94D4-CBA1-4B3A-AC7C-4946B6BE7A62}.Release|Any CPU.Build.0 = Release|Any CPU
75+
{38A6AE2E-4F40-415A-9998-2049E145B27E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
76+
{38A6AE2E-4F40-415A-9998-2049E145B27E}.Debug|Any CPU.Build.0 = Debug|Any CPU
77+
{38A6AE2E-4F40-415A-9998-2049E145B27E}.Release|Any CPU.ActiveCfg = Release|Any CPU
78+
{38A6AE2E-4F40-415A-9998-2049E145B27E}.Release|Any CPU.Build.0 = Release|Any CPU
79+
{E5FD2EC8-264B-4A04-9650-A0E5A65AC4DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
80+
{E5FD2EC8-264B-4A04-9650-A0E5A65AC4DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
81+
{E5FD2EC8-264B-4A04-9650-A0E5A65AC4DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
82+
{E5FD2EC8-264B-4A04-9650-A0E5A65AC4DE}.Release|Any CPU.Build.0 = Release|Any CPU
6583
EndGlobalSection
6684
GlobalSection(SolutionProperties) = preSolution
6785
HideSolutionNode = FALSE

src/Ssh/Ssh/AzureClients/HybridConnectivityClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public HybridConnectivityClient(IAzureContext context)
2828
{
2929
}
3030

31-
public HybridConnectivityClient(IHybridConnectivityManagementAPIClient hybridComputeManagementClient)
31+
public HybridConnectivityClient(IHybridConnectivityManagementAPIClient hybridConnectivityManagementClient)
3232
{
33-
this.HybridConectivityManagementClient = hybridComputeManagementClient;
33+
this.HybridConectivityManagementClient = hybridConnectivityManagementClient;
3434
}
3535
}
3636
}

src/Ssh/Ssh/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Added support for the following Resource Types:
23+
- Microsoft.ConnectedVMwarevSphere/virtualMachines
24+
- Microsoft.ScVmm/virtualMachines
25+
- Microsoft.AzureStackHCI/virtualMachines
26+
* Added parameter -Rdp to Enter-AzVM
27+
* Added Scenario tests for Export-AzSshConfig
2228

2329
## Version 0.1.0
2430
* First preview release for module Az.Ssh

0 commit comments

Comments
 (0)