InvalidArgumentValue: --subnet: Invalid format
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
I'm trying to create a private endpoint by using Azure CLI in bash terminal.
First, I read ASK subnet id by the command
```
akssubnet=$(az network vnet list --query "[?contains(id, 'aks-orgname-dev')].subnets[0].id" -o tsv)
echo $akssubnet
/subscriptions/xxxxxxxx-110f-42cf-8f82-xxxxxxxxxxb0/resourceGroups/MC_compute_aks-orgname-dev_westeurope/providers/Microsoft.Network/virtualNetworks/aks-vnet-33919582/subnets/aks-subnet
```
then I use this variable in the command
```
az network private-endpoint create \
-g MC_compute_aks-orgname-dev_westeurope \
-n postgresql-private-endpoint-orgname-dev \
--group-id postgresqlServer \
--subnet "$akssubnet" \
--nic-name postgresql-private-endpoint-orgname-dev-nic \
--private-connection-resource-id "$postgresqlid" \
--connection-name postgresql-private-endpoint-orgname-dev
```
this returns me the error
```
InvalidArgumentValue: --subnet: Invalid format: resource id should be in '/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}' format.
```
but as you can see above, the `$akssubnet` has exactly this format
### Related command
az network private-endpoint create
### Errors
InvalidArgumentValue: --subnet: Invalid format: resource id should be in '/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.Network/virtualNetworks/{vnet_name}/subnets/{}' format.
### Issue script & Debug output

### Expected behavior
no error because the format of the value is correct
### Environment Summary
azure-cli 2.57.0 *
core 2.57.0 *
telemetry 1.1.0
Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.