Skip to content

InvalidArgumentValue: --subnet: Invalid format #28757

@Marusyk

Description

@Marusyk

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

image

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

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamNetworkaz network vnet/lb/nic/dns/etc...Similar-Issueact-quality-productivity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions