Skip to content

Commit

Permalink
Automatic collection of parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
vanzod committed Aug 26, 2022
1 parent 3ef5912 commit 02561c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
11 changes: 0 additions & 11 deletions examples/bastion/bastion_ssh_bjumpbox.sh

This file was deleted.

19 changes: 19 additions & 0 deletions examples/bastion/bastion_ssh_jumpbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

CONFIG_FILE=${1:-config.json}

ResourceGroup=$(grep resource_group ${CONFIG_FILE} | grep -v variables | awk -F'"' '{print $4}')
User=$(grep admin_user ${CONFIG_FILE} | grep -v variables | awk -F'"' '{print $4}')
JumpboxName=bastion-jumpbox

BastionName=$(az network bastion list -g ${ResourceGroup} --query '[].name' --output tsv)
TargetResourceId=$(az vm show -g ${ResourceGroup} --name ${JumpboxName} --query 'id' --output tsv)
SshPrivateKey=${User}_id_rsa

az network bastion ssh --name $BastionName \
--resource-group $ResourceGroup \
--target-resource-id $TargetResourceId \
--auth-type "ssh-key" \
--username $User \
--ssh-key $SshPrivateKey

0 comments on commit 02561c8

Please sign in to comment.