Skip to content

Commit 3663ded

Browse files
author
Maddie Clayton
authored
Update azure-powershell-developer-guide.md
1 parent 10c6a7d commit 3663ded

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

documentation/development-docs/azure-powershell-developer-guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,22 @@ using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
415415
public string ResourceGroupName { get; set; }
416416
```
417417

418+
### Resource Name Completer
419+
420+
For any parameter that takes a resource name, the `ResourceNameCompleter` should be applied as an attribute. This will allow the user to tab through all resource names for the ResourceType in the current subscription. This completer will filter based upon the current parent resources provided (for instance, if ResourceGroupName is provided, only the resources in that particular resource group will be returned). For this completer, please provide the ResourceType as the first argument, followed by the parameter name for all parent resources starting at the top level.
421+
422+
```cs
423+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
424+
...
425+
[Parameter(Mandatory = false, HelpMessage = "The parent server name")]
426+
[ResourceNameCompleter("Microsoft.Sql/servers", "ResourceGroupName")]
427+
public string ServerName { get; set; }
428+
429+
[Parameter(Mandatory = false, HelpMessage = "The database name")]
430+
[ResourceNameCompleter("Microsoft.Sql/servers/databases", "ResourceGroupName", "ServerName")]
431+
public string Name { get; set; }
432+
```
433+
418434
### Location Completer
419435

420436
For any parameter that takes a location, the `LocationCompleter` should be applied as an attribute. In order to use the `LocationCompleter`, you must input as an argument all of the Providers/ResourceTypes used by the cmdlet. The user will then be able to tab through locations that are valid for all of the Providers/ResourceTypes specified.

0 commit comments

Comments
 (0)