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

Enable ssh-key access for mlzJumpboxLinuxVm #358

Closed
lisamurphy-msft opened this issue Aug 16, 2021 · 3 comments
Closed

Enable ssh-key access for mlzJumpboxLinuxVm #358

lisamurphy-msft opened this issue Aug 16, 2021 · 3 comments

Comments

@lisamurphy-msft
Copy link
Contributor

Is your feature request related to a problem? Please describe.

If running MissionLZ under a subscription that has security options enforced, it is possible that this will not deploy successfully.
For instance, MissionLZ deployment will fail on the mlzJumpboxLinuxVM if there is enforcement of ssh key access to Linux VMs.

Additionally, upon failure there is retry logic that has the failed deployment attempt several iterations and expectedly continue to fail. There is little benefit to this.

Describe the solution you'd like

Prefer that if the MissionLZ deployment fails, that it fails cleanly with more meaningful output to allow for a better user experience.

Describe alternatives you've considered

In this particular instance, disabling the security features that enforce ssh key access to Linux VM's was considered.

@brooke-hamilton
Copy link
Contributor

The common approach with Bicep/ARM and the Azure Portal is to ask users to enter passwords for virtual machines. In command line deployments users are prompted to type passwords (stored as a secure string parameter) and on the Azure Portal users are asked to enter a password (also as a secure string parameter). There is an alternate approach in which a password is generated using shell script and stored in KeyVault, however there is some engineering work that has to go into incorporating the shell script into our Bicep/ARM deployments. We plan to take a look at doing this work in a future release (the project this backlog item is attached to.)

@glennmusa
Copy link
Contributor

glennmusa commented Oct 8, 2021

should be OBE #406 and documented here:

### Using an SSH Key with Remote Access via Bastion Host
If you have a key pair you'd like to use for SSH connections to the Linux virtual machine that is deployed with `deployRemoteAccess=true`, specify the `linuxVmAuthenticationType` parameter to `sshPublicKey` like so:
```plaintext
my_sshkey=$(cat ~/.ssh/id_rsa.pub) # or, however you source your public key
my_password=$(openssl rand -base64 14)
az deployment sub create \
--name "myRemoteAccessDeployment" \
--location "eastus" \
--template-file "src/bicep/mlz.bicep" \
--parameters deployRemoteAccess="true" \
--parameters linuxVmAuthenticationType="sshPublicKey" \
--parameters linuxVmAdminPasswordOrKey="$my_sshkey" \
--parameters windowsVmAdminPassword="$my_password"
```
For more information on generating a public/private key pair see <https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-ssh-keys-detailed#generate-keys-with-ssh-keygen>.
Then, once you've deployed the virtual machines and Bastion Host, use these docs to connect with an SSH Key: <https://docs.microsoft.com/en-us/azure/bastion/bastion-connect-vm-ssh#privatekey>

@brooke-hamilton
Copy link
Contributor

Closing as OBE as suggested by @glennmusa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants