Azure / Azure/azure-cli-extensions
az network bastion create --vnet-name does not accept resource Id
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
### Describe the bug
I wanted to deploy Bastion into its dedicated resource group where there is no Virtual Network present. For this reasons I tried to pass the virtual network's resource Id as `--vnet-name` but it didn't work as the CLI tried to append the whole resource ID to the resource Id of the subnet.
### Related command
az network bastion create
### Errors
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
ERROR: (InvalidRequestFormat) Cannot parse the request.
Code: InvalidRequestFormat
Message: Cannot parse the request.
Exception Details: (InvalidJsonReferenceFormat) Reference Id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-bastion/providers/Microsoft.Network/virtualNetworks//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-network/providers/Microsoft.Network/virtualNetworks/vnet-prod/subnets/AzureBastionSubnet is not formatted correctly. The Id is expected to reference resources of type virtualNetworks/subnets. Path properties.ipConfigurations[0].properties.subnet.
### Issue script & Debug output
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
ERROR: (InvalidRequestFormat) Cannot parse the request.
Code: InvalidRequestFormat
Message: Cannot parse the request.
Exception Details: (InvalidJsonReferenceFormat) Reference Id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-bastion/providers/Microsoft.Network/virtualNetworks//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-network/providers/Microsoft.Network/virtualNetworks/vnet-prod/subnets/AzureBastionSubnet is not formatted correctly. The Id is expected to reference resources of type virtualNetworks/subnets. Path properties.ipConfigurations[0].properties.subnet.
### Expected behavior
`--vnet-name` should accept resource id as well.
### Environment Summary
```
azure-cli 2.62.0
core 2.62.0
telemetry 1.1.0
Extensions:
bastion 1.0.2
Dependencies:
msal 1.28.1
azure-mgmt-resource 23.1.1
```
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.