@@ -47,19 +47,28 @@ function plugin_after_vm_creat () {
FE_IP=feip_$prefix
BE_PL=bepl_$prefix
var_default_val outbound_ports_per_vm 1000
var_default_val enable_outbound_rule_fix 1
debugexec az network lb create --resource-group$resgrp--name$LB_NAME--sku Standard --frontend-ip-name$FE_IP--backend-pool-name$BE_PL--vnet-name$vnetname||exit
debugexec az network lb address-pool update -g$resgrp--lb-name$LB_NAME-n$BE_PL--vnet$vnetname--backend-addresses"[{name:addr1,ip-address:10.0.0.4}]"||exit
if[[$enable_outbound_rule_fix= 1 ]];then
# This is an unreliable trick to use NIC directly. It's from good-case ARM template dump.
debugexec az network lb address-pool update -g$resgrp--lb-name$LB_NAME-n$BE_PL--vnet$vnetname--backend-addresses"[{name:${resgrp}_${vmname}VMNicipconfig${vmname}}]"||exit
else
echo-e"$COLOR_RED_BLD Warning: enable_outbound_rule_fix not enabled. outbound_ports_per_vm limit won't make effect $COLOR_CLR" 1>&2
# When a backend pool is configured by IP address, the backend instances are not secure by default and still use default outbound access.
# This means: outbound_ports_per_vm won't make effect
debugexec az network lb address-pool update -g$resgrp--lb-name$LB_NAME-n$BE_PL--vnet$vnetname--backend-addresses"[{name:addr1,ip-address:10.0.0.4}]"||exit
fi
# TODO: The correct way to redirect PUBLIC:4022 to VM1:22. But azure-cli cannot associate nat-rule to machine. Even if u manually created one on az portal, it will de-associate after some time.