Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compute] Revert Generate-SSH file permission changes because of Cloudshell failure #23477

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public void TestCapacityReservation()
TestRunner.RunTestScript("Test-CapacityReservation");
}

[Fact(Skip = "Cannot run on Github Platform due to ACL API")]
[Fact]
haagha marked this conversation as resolved.
Show resolved Hide resolved
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVMwithSSHKey()
{
Expand Down

Large diffs are not rendered by default.

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

## Version 7.0.0
* Added update functionality in `Update-AzVmss` for parameters `SecurityType`, `EnableSecureBoot`, and `EnableVtpm` for the parameter set with the Put operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1566,23 +1566,6 @@ private string GenerateOrFindSshKey()
}
Console.WriteLine("Private key is saved to " + privateKeyFilePath);

FileSecurity fileSecurity = new FileSecurity(privateKeyFilePath, AccessControlSections.Access);
// Define the owner's identity
IdentityReference owner = new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null);

// Create an access rule for the owner with read and write permissions (0600)
FileSystemAccessRule rule = new FileSystemAccessRule(
owner,
FileSystemRights.Read | FileSystemRights.Write,
AccessControlType.Allow
);

// Add the access rule to the file security
fileSecurity.AddAccessRule(rule);

FileInfo fileinfo = new FileInfo(privateKeyFilePath);
fileinfo.SetAccessControl(fileSecurity);

using (StreamWriter writer = new StreamWriter(publicKeyFilePath))
{
writer.WriteLine(keypair.PublicKey);
Expand Down