Describe the bug
A couple questions or clarification requests on the documentation to az network public-ip create on the page https://learn.microsoft.com/en-us/cli/azure/network/public-ip?view=azure-cli-latest#az-network-public-ip-create:
Args to --name and --resource-group
The code snippet in the synopsis starts off like this:
az network public-ip create --name
--resource-group
[--allocation-method {Dynamic, Static}]
[...]
From what I understand, the --name and --resource-group options each take arguments, so maybe this should look like:
az network public-ip create --name <name>
--resource-group <rg-name>
[--allocation-method {Dynamic, Static}]
[...]
Semantics of --resource-group
The --resource-group option is documented like this:
--resource-group -g
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
I did guess that the --resource-group option specifies the resource group. But I think it would be useful to say more about how the resource group is used in the behavior of this subcommand, at least in the public-ip create case and in conjunction with the --public-ip-prefix option. Does it specify the resource group under which the new IP address is created? Does it specify the resource group under which to find the specified IP Prefix from which to create the IP Address? Are those required to be the same resource group?
For example, I just tried this (redacted):
PS C:\Users\Andrew.Janke> az network public-ip create --allocation-method Static --location eastus --public-ip-prefix /subscriptions/2o3894723897-REDACTED/resourceGroups/MyResourceGroup/providers/Microsoft.Network/publicIPPrefixes/genpurp-1-ippre --resource-group Blah --name hello-01-ip
(ResourceNotFound) The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
I was not expecting that. I had assumed that the --resource-group option only affected where the new IP Address would be created, and since the "MyResourceGroup" RG was (I think) specified in the resource ID passed to --public-ip-prefix, that it would not need or use the --resource-group argument for locating the IP Prefix to be used here. Some details about what exactly the --resource-group option controls could be helpful here.
I read through the page referenced in the error message and didn't see an obvious fix here. But I'm an az newbie, maybe I'm just missing something.
Related command
az network public-ip create
Errors
(ResourceNotFound) The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Issue script & Debug output
Sorry, I don't have time to properly redact the --debug output of this, and this bug ticket is intended as a documentation suggestion about the https://learn.microsoft.com/en-us/cli/azure/network/public-ip?view=azure-cli-latest#az-network-public-ip-create web page and not az functionality per se. At least for now.
Expected behavior
I had expected the az network public-ip create subcommand, when passing a resource ID instead of name to the --public-ip-prefix option, to use the --resource-group option to control which RG the new IP address is created in, but not use it for finding the IP Prefix to create it from and instead use the RG embedded in the IP Prefix's ID to locate the prefix. (I'm assuming that you can use an IP Prefix to create IP addresses in a different RG from the RG that the IP Prefix is in.)
Environment Summary
PS C:\Users\Andrew.Janke> az --version
azure-cli 2.40.0 *
core 2.40.0 *
telemetry 1.0.8 *
Extensions:
ssh 1.1.3
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\Andrew.Janke\.azure\cliextensions'
Python (Windows) 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 15:58:59) [MSC v.1929 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
You have 3 update(s) available. Consider updating your CLI installation with 'az upgrade'
PS C:\Users\Andrew.Janke>
Additional context
No response
Describe the bug
A couple questions or clarification requests on the documentation to
az network public-ip createon the page https://learn.microsoft.com/en-us/cli/azure/network/public-ip?view=azure-cli-latest#az-network-public-ip-create:Args to --name and --resource-group
The code snippet in the synopsis starts off like this:
From what I understand, the
--nameand--resource-groupoptions each take arguments, so maybe this should look like:Semantics of --resource-group
The
--resource-groupoption is documented like this:I did guess that the
--resource-groupoption specifies the resource group. But I think it would be useful to say more about how the resource group is used in the behavior of this subcommand, at least in thepublic-ip createcase and in conjunction with the--public-ip-prefixoption. Does it specify the resource group under which the new IP address is created? Does it specify the resource group under which to find the specified IP Prefix from which to create the IP Address? Are those required to be the same resource group?For example, I just tried this (redacted):
I was not expecting that. I had assumed that the
--resource-groupoption only affected where the new IP Address would be created, and since the "MyResourceGroup" RG was (I think) specified in the resource ID passed to--public-ip-prefix, that it would not need or use the--resource-groupargument for locating the IP Prefix to be used here. Some details about what exactly the--resource-groupoption controls could be helpful here.I read through the page referenced in the error message and didn't see an obvious fix here. But I'm an
aznewbie, maybe I'm just missing something.Related command
az network public-ip createErrors
(ResourceNotFound) The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/publicIPPrefixes/genpurp-1-ippre' under resource group 'Blah' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Issue script & Debug output
Sorry, I don't have time to properly redact the
--debugoutput of this, and this bug ticket is intended as a documentation suggestion about the https://learn.microsoft.com/en-us/cli/azure/network/public-ip?view=azure-cli-latest#az-network-public-ip-create web page and notazfunctionality per se. At least for now.Expected behavior
I had expected the
az network public-ip createsubcommand, when passing a resource ID instead of name to the--public-ip-prefixoption, to use the--resource-groupoption to control which RG the new IP address is created in, but not use it for finding the IP Prefix to create it from and instead use the RG embedded in the IP Prefix's ID to locate the prefix. (I'm assuming that you can use an IP Prefix to create IP addresses in a different RG from the RG that the IP Prefix is in.)Environment Summary
Additional context
No response