Skip to content

Commit 9454f78

Browse files
authored
Added examples for all commands (Azure#21802)
1 parent 9417467 commit 9454f78

File tree

43 files changed

+469
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+469
-74
lines changed

src/DataProtection/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ internal
66
exports
77
tools
88
custom/*.psm1
9+
custom/autogen-model-cmdlets
910
test/*-TestResults.xml
1011
/*.ps1
1112
/*.ps1xml

src/DataProtection/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This directory contains the PowerShell module for the DataProtection service.
1717
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1818

1919
## Module Requirements
20-
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
2121

2222
## Authentication
2323
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

src/DataProtection/custom/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For `Az.DataProtection` to use custom cmdlets, it does this two different ways.
1212

1313
For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.DataProtection.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.
1414

15-
For script cmdlets, these are loaded via the `Az.DataProtection.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
15+
For script cmdlets, these are loaded via the `Az.DataProtection.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
1616

1717
## Purpose
1818
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
@@ -32,10 +32,10 @@ These provide functionality to our HTTP pipeline and other useful features. In s
3232
### Attributes
3333
For processing the cmdlets, we've created some additional attributes:
3434
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.DescriptionAttribute`
35-
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
35+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
3636
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.DataProtection`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DataProtection`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder.
39+
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.DataProtection`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

src/DataProtection/docs/Backup-AzDataProtectionBackupInstanceAdhoc.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ Accept wildcard characters: False
106106
```
107107
108108
### -DefaultProfile
109-
The credentials, account, tenant, and subscription used for communication with Azure.
109+
The DefaultProfile parameter is not functional.
110+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
110111
111112
```yaml
112113
Type: System.Management.Automation.PSObject
@@ -264,7 +265,7 @@ COMPLEX PARAMETER PROPERTIES
264265
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
265266
266267
267-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
268+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
268269
- `[BackupInstanceName <String>]`: The name of the backup instance.
269270
- `[BackupPolicyName <String>]`:
270271
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Edit-AzDataProtectionPolicyRetentionRuleClientObject.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ COMPLEX PARAMETER PROPERTIES
171171
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
172172
173173
174-
LIFECYCLES <ISourceLifeCycle[]>: Life cycles associated with the retention rule.
174+
`LIFECYCLES <ISourceLifeCycle[]>`: Life cycles associated with the retention rule.
175175
- `DeleteAfterDuration <String>`: Duration of deletion after given timespan
176176
- `DeleteAfterObjectType <String>`: Type of the specific object - used for deserializing
177177
- `SourceDataStoreObjectType <String>`: Type of Datasource object, used to initialize the right inherited type
@@ -181,7 +181,7 @@ LIFECYCLES <ISourceLifeCycle[]>: Life cycles associated with the retention rule.
181181
- `DataStoreObjectType <String>`: Type of Datasource object, used to initialize the right inherited type
182182
- `DataStoreType <DataStoreTypes>`: type of datastore; Operational/Vault/Archive
183183

184-
POLICY <IBackupPolicy>: Backup Policy Object
184+
`POLICY <IBackupPolicy>`: Backup Policy Object
185185
- `DatasourceType <String[]>`: Type of datasource for the backup management
186186
- `ObjectType <String>`:
187187
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc

src/DataProtection/docs/Edit-AzDataProtectionPolicyTagClientObject.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ COMPLEX PARAMETER PROPERTIES
138138
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
139139
140140
141-
CRITERIA <IScheduleBasedBackupCriteria[]>: Criterias to be associated with the schedule tag.
141+
`CRITERIA <IScheduleBasedBackupCriteria[]>`: Criterias to be associated with the schedule tag.
142142
- `ObjectType <String>`: Type of the specific object - used for deserializing
143143
- `[AbsoluteCriterion <AbsoluteMarker[]>]`: it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum
144144
- `[DaysOfMonth <IDay[]>]`: This is day of the month from 1 to 28 other wise last of month
@@ -149,7 +149,7 @@ CRITERIA <IScheduleBasedBackupCriteria[]>: Criterias to be associated with the s
149149
- `[ScheduleTime <DateTime[]>]`: List of schedule times for backup
150150
- `[WeeksOfTheMonth <WeekNumber[]>]`: It should be First/Second/Third/Fourth/Last
151151

152-
POLICY <IBackupPolicy>: Backup Policy Object.
152+
`POLICY <IBackupPolicy>`: Backup Policy Object.
153153
- `DatasourceType <String[]>`: Type of datasource for the backup management
154154
- `ObjectType <String>`:
155155
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc

src/DataProtection/docs/Edit-AzDataProtectionPolicyTriggerClientObject.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ COMPLEX PARAMETER PROPERTIES
108108
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
109109
110110
111-
POLICY <IBackupPolicy>: Backup Policy object.
111+
`POLICY <IBackupPolicy>`: Backup Policy object.
112112
- `DatasourceType <String[]>`: Type of datasource for the backup management
113113
- `ObjectType <String>`:
114114
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc

src/DataProtection/docs/Find-AzDataProtectionRestorableTimeRange.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ Accept wildcard characters: False
6262
```
6363
6464
### -DefaultProfile
65-
The credentials, account, tenant, and subscription used for communication with Azure.
65+
The DefaultProfile parameter is not functional.
66+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
6667
6768
```yaml
6869
Type: System.Management.Automation.PSObject

src/DataProtection/docs/Get-AzDataProtectionBackupInstance.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ This command gets a specific backup instance protected in a backup vault.
6565
## PARAMETERS
6666

6767
### -DefaultProfile
68-
The credentials, account, tenant, and subscription used for communication with Azure.
68+
The DefaultProfile parameter is not functional.
69+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
6970

7071
```yaml
7172
Type: System.Management.Automation.PSObject
@@ -177,7 +178,7 @@ COMPLEX PARAMETER PROPERTIES
177178
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
178179
179180
180-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
181+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
181182
- `[BackupInstanceName <String>]`: The name of the backup instance.
182183
- `[BackupPolicyName <String>]`:
183184
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionBackupPolicy.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ This command gets a backup policy by name.
6565
## PARAMETERS
6666

6767
### -DefaultProfile
68-
The credentials, account, tenant, and subscription used for communication with Azure.
68+
The DefaultProfile parameter is not functional.
69+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
6970

7071
```yaml
7172
Type: System.Management.Automation.PSObject
@@ -177,7 +178,7 @@ COMPLEX PARAMETER PROPERTIES
177178
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
178179
179180
180-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
181+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
181182
- `[BackupInstanceName <String>]`: The name of the backup instance.
182183
- `[BackupPolicyName <String>]`:
183184
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionBackupVault.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ This command gets a specific vault by given vault name.
8787
## PARAMETERS
8888

8989
### -DefaultProfile
90-
The credentials, account, tenant, and subscription used for communication with Azure.
90+
The DefaultProfile parameter is not functional.
91+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
9192

9293
```yaml
9394
Type: System.Management.Automation.PSObject
@@ -184,7 +185,7 @@ COMPLEX PARAMETER PROPERTIES
184185
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
185186
186187
187-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
188+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
188189
- `[BackupInstanceName <String>]`: The name of the backup instance.
189190
- `[BackupPolicyName <String>]`:
190191
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionJob.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ This command returns a single job entity with given Id.
6969
## PARAMETERS
7070

7171
### -DefaultProfile
72-
The credentials, account, tenant, and subscription used for communication with Azure.
72+
The DefaultProfile parameter is not functional.
73+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
7374

7475
```yaml
7576
Type: System.Management.Automation.PSObject
@@ -183,7 +184,7 @@ COMPLEX PARAMETER PROPERTIES
183184
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
184185
185186
186-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
187+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
187188
- `[BackupInstanceName <String>]`: The name of the backup instance.
188189
- `[BackupPolicyName <String>]`:
189190
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionOperation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ The above command gets the list of available operations.
8888
## PARAMETERS
8989

9090
### -DefaultProfile
91-
The credentials, account, tenant, and subscription used for communication with Azure.
91+
The DefaultProfile parameter is not functional.
92+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
9293

9394
```yaml
9495
Type: System.Management.Automation.PSObject

src/DataProtection/docs/Get-AzDataProtectionOperationStatus.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Fourth command fetches the operation status in a loop until it succeeds, while w
5454
## PARAMETERS
5555

5656
### -DefaultProfile
57-
The credentials, account, tenant, and subscription used for communication with Azure.
57+
The DefaultProfile parameter is not functional.
58+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
5859

5960
```yaml
6061
Type: System.Management.Automation.PSObject
@@ -150,7 +151,7 @@ COMPLEX PARAMETER PROPERTIES
150151
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
151152
152153
153-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
154+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
154155
- `[BackupInstanceName <String>]`: The name of the backup instance.
155156
- `[BackupPolicyName <String>]`:
156157
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionRecoveryPoint.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ Accept wildcard characters: False
8787
```
8888
8989
### -DefaultProfile
90-
The credentials, account, tenant, and subscription used for communication with Azure.
90+
The DefaultProfile parameter is not functional.
91+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
9192
9293
```yaml
9394
Type: System.Management.Automation.PSObject
@@ -231,7 +232,7 @@ COMPLEX PARAMETER PROPERTIES
231232
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
232233
233234
234-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
235+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
235236
- `[BackupInstanceName <String>]`: The name of the backup instance.
236237
- `[BackupPolicyName <String>]`:
237238
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Get-AzDataProtectionResourceGuard.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ Gets all resource guards under a resource group
6767
## PARAMETERS
6868

6969
### -DefaultProfile
70-
The credentials, account, tenant, and subscription used for communication with Azure.
70+
The DefaultProfile parameter is not functional.
71+
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
7172

7273
```yaml
7374
Type: System.Management.Automation.PSObject
@@ -164,7 +165,7 @@ COMPLEX PARAMETER PROPERTIES
164165
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
165166
166167
167-
INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
168+
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
168169
- `[BackupInstanceName <String>]`: The name of the backup instance.
169170
- `[BackupPolicyName <String>]`:
170171
- `[Id <String>]`: Resource identity path

src/DataProtection/docs/Initialize-AzDataProtectionBackupInstance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ COMPLEX PARAMETER PROPERTIES
227227
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
228228
229229
230-
BACKUPCONFIGURATION <IBackupDatasourceParameters>: Backup configuration for backup. Use this parameter to configure protection for AzureKubernetesService.
230+
`BACKUPCONFIGURATION <IBackupDatasourceParameters>`: Backup configuration for backup. Use this parameter to configure protection for AzureKubernetesService.
231231
- `ObjectType <String>`: Type of the specific object - used for deserializing
232232

233233
## RELATED LINKS

src/DataProtection/docs/Initialize-AzDataProtectionRestoreRequest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ COMPLEX PARAMETER PROPERTIES
470470
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
471471
472472
473-
BACKUPINSTANCE <BackupInstanceResource>: Backup Instance object to trigger original localtion restore.
473+
`BACKUPINSTANCE <BackupInstanceResource>`: Backup Instance object to trigger original localtion restore.
474474
- `[Property <IBackupInstance>]`: BackupInstanceResource properties
475475
- `DataSourceInfo <IDatasource>`: Gets or sets the data source information.
476476
- `ResourceId <String>`: Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault.
@@ -504,7 +504,7 @@ BACKUPINSTANCE <BackupInstanceResource>: Backup Instance object to trigger origi
504504
- `[Tag <IDppProxyResourceTags>]`: Proxy Resource tags.
505505
- `[(Any) <String>]`: This indicates any property can be added to this object.
506506

507-
RESTORECONFIGURATION <KubernetesClusterRestoreCriteria>: Restore configuration for restore. Use this parameter to restore with AzureKubernetesService.
507+
`RESTORECONFIGURATION <KubernetesClusterRestoreCriteria>`: Restore configuration for restore. Use this parameter to restore with AzureKubernetesService.
508508
- `IncludeClusterScopeResource <Boolean>`: Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore.
509509
- `ObjectType <String>`: Type of the specific object - used for deserializing
510510
- `[ConflictPolicy <ExistingResourcePolicy?>]`: Gets or sets the Conflict Policy property. This property sets policy during conflict of resources during restore.

src/DataProtection/docs/New-AzDataProtectionBackupConfigurationClientObject.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ KubernetesClusterBackupDatasourceParameters {excludeNS1, excludeNS2}
3838

3939
This command can be used to create a backup configuration client object used for configuring backup for a Kubernetes cluster
4040

41+
### Example 2: Create a BackupConfiguration to select specific containers for configuring vaulted backups for AzureBlob.
42+
```powershell
43+
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName
44+
$containers=Get-AzStorageContainer -Context $storageAccount.Context
45+
$backupConfig = New-AzDataProtectionBackupConfigurationClientObject -DatasourceType AzureBlob -VaultedBackupContainer $containers.Name[1,3,4]
46+
```
47+
48+
```output
49+
ObjectType ContainersList
50+
---------- --------------
51+
BlobBackupDatasourceParameters {conabb, conwxy, conzzz}
52+
```
53+
54+
This command can be used to create a backup configuration client object used for configuring backup for vaulted Blob backup containers.
55+
4156
## PARAMETERS
4257

4358
### -DatasourceType

0 commit comments

Comments
 (0)