Azure / Azure/azure-cli

How create VMSS with load balancer using exsiting Vnet and subnet

Open
#27,765 2 comments 0 reactions 3 assignees Claimed by @necusjz View on GitHub
act-observability-squad act-quality-productivity-squad Auto-Assign Azure CLI Team Compute customer-reported Network question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

I tried to create a VM scale set (for a web site) by doing the following, created
1-Vnet,
2. Subnet,
3. public IP addr,
4. loadbalancer with the public IP,
5. http rule
6. then the VMSS using custom-data also
7. The full az command I used are down hereunder
When I try to access the IP , I get

```
The connection has timed out
The server at 20.199.112.60 is taking too long to respond.
```

When I create the scaleset manually in the portal with the same custom-data I can access the web site through loadbalancer IP as well as each vm instance IP. So what might be missing using azure cli? Thanks

### Related command

1 - az network vnet create \
--name vnet-scaleXXXXX \
--resource-group scaleXXXXX \
--address-prefix 10.0.0.0/16 \
--subnet-name subnet-scaleXXXXX \
--subnet-prefixes 10.0.0.0/24

2 - az network vnet subnet create \
--name Subnet-vnet-scaleXXXXX \
--resource-group scaleXXXXX \
--vnet-name vnet-scaleXXXXX \
--address-prefix 10.0.1.0/24

3 - az network public-ip create \
--resource-group scaleXXXXX \
--name scaleXXXXXPubIPAddr \
--sku Standard

4 - az network lb create \
--resource-group scaleXXXXX \
--name scaleXXXXXLB \
--sku Standard \
--public-ip-address scaleXXXXXPubIPAddr \
--frontend-ip-name myFrontEnd \
--backend-pool-name myBackEndPool

5 - az network lb probe create \
--resource-group scaleXXXXX \
--lb-name scaleXXXXXLB \
--name myHealthProbe \
--protocol tcp \
--port 80

6 - az network lb rule create \
--resource-group scaleXXXXX \
--lb-name scaleXXXXXLB \
--name myHTTPRule \
--protocol tcp \
--frontend-port 80 \
--backend-port 80 \
--frontend-ip-name myFrontEnd \
--backend-pool-name myBackEndPool \
--probe-name myHealthProbe \
--disable-outbound-snat true \
--idle-timeout 15 \
--enable-tcp-reset true

az vmss create \
--name scaleXXXXXSS \
--resource-group scaleXXXXX \
--image Ubuntu2204 \
--admin-username azureuser \
--admin-password Azure123456! \
--instance-count 2 \
--vnet-name vnet-scaleXXXXX \
--subnet Subnet-vnet-scaleXXXXX \
--vm-sku Standard_DS1_v2 \
--upgrade-policy-mode Automatic \
--lb scaleXXXXXLB \
--public-ip-per-vm \
--backend-pool-name myBackEndPool \
--custom-data cloud-init.txt

### Errors

The connection has timed out
The server at 20.199.112.60 is taking too long to respond.

### Issue script & Debug output

No debug script

### Expected behavior

Access the web site through loadbalancer

### Environment Summary

azure-cli 2.53.1

core 2.53.1
telemetry 1.1.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/usr/bin/python3'
Extensions directory '/home/salam/.azure/cliextensions'

Python (Linux) 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.