Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentValue: --subnet: Invalid format #28757

Open
Marusyk opened this issue Apr 16, 2024 · 9 comments
Open

InvalidArgumentValue: --subnet: Invalid format #28757

Marusyk opened this issue Apr 16, 2024 · 9 comments
Assignees
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue
Milestone

Comments

@Marusyk
Copy link

Marusyk commented Apr 16, 2024

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

@Marusyk Marusyk added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Apr 16, 2024
Copy link

Hi @Marusyk,

2.57.0 is not the latest Azure CLI(2.59.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Apr 16, 2024
Copy link

Hi @Marusyk
Find similar issue #11254.

Issue title Example format of --subnet-id for az redis create
Create time 2019-11-15
Comment number 0

Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... labels Apr 16, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 16, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 16, 2024
@yonzhan yonzhan added this to the Backlog milestone Apr 16, 2024
@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Apr 16, 2024
@Marusyk
Copy link
Author

Marusyk commented Apr 16, 2024

Upgraded to the latest version but the problem still exists
image

@necusjz
Copy link
Member

necusjz commented Apr 17, 2024

could you input --vnet-name {vnet} --subnet {subnet} at the same time (both using name)?

@Marusyk
Copy link
Author

Marusyk commented Apr 17, 2024

the problem is that the same script works in PowerShell but doesn't work in Bash. I don't want to change it or add other params.
Could you please explain what is the problem in Bash?

@necusjz
Copy link
Member

necusjz commented Apr 18, 2024

ah, could you please share the entire debugging log in bash (appending --debug)?

@Marusyk
Copy link
Author

Marusyk commented May 24, 2024

it works from other terminal

@Marusyk Marusyk closed this as completed May 24, 2024
@smereczynski
Copy link

It should not be closed. I have the same problem creating NIC in ZSH.

@Marusyk Marusyk reopened this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Similar-Issue
Projects
None yet
Development

No branches or pull requests

4 participants