Skip to content

Commit e4e2930

Browse files
haaghaNoriZC
andauthored
[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 33cff08 commit e4e2930

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
@@ -1566,23 +1566,6 @@ private string GenerateOrFindSshKey()
15661566
}
15671567
Console.WriteLine("Private key is saved to " + privateKeyFilePath);
15681568

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

0 commit comments

Comments
 (0)