Skip to content

Commit 92e8a12

Browse files
haaghaNoriZC
andcommitted
[Compute] Revert Generate-SSH file permission changes because of Cloudshell failure (#23477)
* reverting changes for file permissions of private key using New-Azvm * Update ChangeLog.md --------- Co-authored-by: NoriZC <[email protected]>
1 parent 9a6e1f6 commit 92e8a12

File tree

4 files changed

+800
-974
lines changed

4 files changed

+800
-974
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public void TestCapacityReservation()
445445
TestRunner.RunTestScript("Test-CapacityReservation");
446446
}
447447

448-
[Fact(Skip = "Cannot run on Github Platform due to ACL API")]
448+
[Fact]
449449
[Trait(Category.AcceptanceType, Category.CheckIn)]
450450
public void TestVMwithSSHKey()
451451
{

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests/TestVMwithSSHKey.json

Lines changed: 798 additions & 956 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Added new examples in `New-AzVM` and `New-AzVmss` for TrustedLaunch default usage.
2626
* Fixed the `New-AzVM` bug to avoid accessing the `EncryptionAtHost` property for subscriptions who cannot access it since it is behind a feature flag.
2727
* Updated `Get-AzVmExtension` to return instanceView when used with `-Status`.
28+
* Reverted SSH Private Key File permission changes in `New-AzVm`.
2829

2930
## Version 7.0.0
3031
* Added update functionality in `Update-AzVmss` for parameters `SecurityType`, `EnableSecureBoot`, and `EnableVtpm` for the parameter set with the Put operation.

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,23 +1565,6 @@ private string GenerateOrFindSshKey()
15651565
}
15661566
Console.WriteLine("Private key is saved to " + privateKeyFilePath);
15671567

1568-
FileSecurity fileSecurity = new FileSecurity(privateKeyFilePath, AccessControlSections.Access);
1569-
// Define the owner's identity
1570-
IdentityReference owner = new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null);
1571-
1572-
// Create an access rule for the owner with read and write permissions (0600)
1573-
FileSystemAccessRule rule = new FileSystemAccessRule(
1574-
owner,
1575-
FileSystemRights.Read | FileSystemRights.Write,
1576-
AccessControlType.Allow
1577-
);
1578-
1579-
// Add the access rule to the file security
1580-
fileSecurity.AddAccessRule(rule);
1581-
1582-
FileInfo fileinfo = new FileInfo(privateKeyFilePath);
1583-
fileinfo.SetAccessControl(fileSecurity);
1584-
15851568
using (StreamWriter writer = new StreamWriter(publicKeyFilePath))
15861569
{
15871570
writer.WriteLine(keypair.PublicKey);

0 commit comments

Comments
 (0)