Skip to content

[Az.Dataprotection] Added examples for blob hardening and cross subscription restore #21802

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

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/DataProtection/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
Expand Down
2 changes: 1 addition & 1 deletion src/DataProtection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This directory contains the PowerShell module for the DataProtection service.
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

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

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
Expand Down
6 changes: 3 additions & 3 deletions src/DataProtection/custom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For `Az.DataProtection` to use custom cmdlets, it does this two different ways.

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.

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.
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.

## Purpose
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.
Expand All @@ -32,10 +32,10 @@ These provide functionality to our HTTP pipeline and other useful features. In s
### Attributes
For processing the cmdlets, we've created some additional attributes:
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.DescriptionAttribute`
- 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.
- 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.
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.DataProtection`.
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.InternalExportAttribute`
- 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.
- 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.
- `Microsoft.Azure.PowerShell.Cmdlets.DataProtection.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ Accept wildcard characters: False
```

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -264,7 +265,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ COMPLEX PARAMETER PROPERTIES
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.


LIFECYCLES <ISourceLifeCycle[]>: Life cycles associated with the retention rule.
`LIFECYCLES <ISourceLifeCycle[]>`: Life cycles associated with the retention rule.
- `DeleteAfterDuration <String>`: Duration of deletion after given timespan
- `DeleteAfterObjectType <String>`: Type of the specific object - used for deserializing
- `SourceDataStoreObjectType <String>`: Type of Datasource object, used to initialize the right inherited type
Expand All @@ -181,7 +181,7 @@ LIFECYCLES <ISourceLifeCycle[]>: Life cycles associated with the retention rule.
- `DataStoreObjectType <String>`: Type of Datasource object, used to initialize the right inherited type
- `DataStoreType <DataStoreTypes>`: type of datastore; Operational/Vault/Archive

POLICY <IBackupPolicy>: Backup Policy Object
`POLICY <IBackupPolicy>`: Backup Policy Object
- `DatasourceType <String[]>`: Type of datasource for the backup management
- `ObjectType <String>`:
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ COMPLEX PARAMETER PROPERTIES
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.


CRITERIA <IScheduleBasedBackupCriteria[]>: Criterias to be associated with the schedule tag.
`CRITERIA <IScheduleBasedBackupCriteria[]>`: Criterias to be associated with the schedule tag.
- `ObjectType <String>`: Type of the specific object - used for deserializing
- `[AbsoluteCriterion <AbsoluteMarker[]>]`: it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum
- `[DaysOfMonth <IDay[]>]`: This is day of the month from 1 to 28 other wise last of month
Expand All @@ -149,7 +149,7 @@ CRITERIA <IScheduleBasedBackupCriteria[]>: Criterias to be associated with the s
- `[ScheduleTime <DateTime[]>]`: List of schedule times for backup
- `[WeeksOfTheMonth <WeekNumber[]>]`: It should be First/Second/Third/Fourth/Last

POLICY <IBackupPolicy>: Backup Policy Object.
`POLICY <IBackupPolicy>`: Backup Policy Object.
- `DatasourceType <String[]>`: Type of datasource for the backup management
- `ObjectType <String>`:
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ COMPLEX PARAMETER PROPERTIES
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.


POLICY <IBackupPolicy>: Backup Policy object.
`POLICY <IBackupPolicy>`: Backup Policy object.
- `DatasourceType <String[]>`: Type of datasource for the backup management
- `ObjectType <String>`:
- `PolicyRule <IBasePolicyRule[]>`: Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Accept wildcard characters: False
```

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionBackupInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ This command gets a specific backup instance protected in a backup vault.
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -177,7 +178,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionBackupPolicy.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ This command gets a backup policy by name.
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -177,7 +178,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionBackupVault.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ This command gets a specific vault by given vault name.
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -184,7 +185,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionJob.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ This command returns a single job entity with given Id.
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -183,7 +184,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
3 changes: 2 additions & 1 deletion src/DataProtection/docs/Get-AzDataProtectionOperation.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ The above command gets the list of available operations.
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Fourth command fetches the operation status in a loop until it succeeds, while w
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -150,7 +151,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionRecoveryPoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ Accept wildcard characters: False
```

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -231,7 +232,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
5 changes: 3 additions & 2 deletions src/DataProtection/docs/Get-AzDataProtectionResourceGuard.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ Gets all resource guards under a resource group
## PARAMETERS

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

```yaml
Type: System.Management.Automation.PSObject
Expand Down Expand Up @@ -164,7 +165,7 @@ COMPLEX PARAMETER PROPERTIES
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.


INPUTOBJECT <IDataProtectionIdentity>: Identity Parameter
`INPUTOBJECT <IDataProtectionIdentity>`: Identity Parameter
- `[BackupInstanceName <String>]`: The name of the backup instance.
- `[BackupPolicyName <String>]`:
- `[Id <String>]`: Resource identity path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ COMPLEX PARAMETER PROPERTIES
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.


BACKUPCONFIGURATION <IBackupDatasourceParameters>: Backup configuration for backup. Use this parameter to configure protection for AzureKubernetesService.
`BACKUPCONFIGURATION <IBackupDatasourceParameters>`: Backup configuration for backup. Use this parameter to configure protection for AzureKubernetesService.
- `ObjectType <String>`: Type of the specific object - used for deserializing

## RELATED LINKS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ COMPLEX PARAMETER PROPERTIES
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.


BACKUPINSTANCE <BackupInstanceResource>: Backup Instance object to trigger original localtion restore.
`BACKUPINSTANCE <BackupInstanceResource>`: Backup Instance object to trigger original localtion restore.
- `[Property <IBackupInstance>]`: BackupInstanceResource properties
- `DataSourceInfo <IDatasource>`: Gets or sets the data source information.
- `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.
Expand Down Expand Up @@ -504,7 +504,7 @@ BACKUPINSTANCE <BackupInstanceResource>: Backup Instance object to trigger origi
- `[Tag <IDppProxyResourceTags>]`: Proxy Resource tags.
- `[(Any) <String>]`: This indicates any property can be added to this object.

RESTORECONFIGURATION <KubernetesClusterRestoreCriteria>: Restore configuration for restore. Use this parameter to restore with AzureKubernetesService.
`RESTORECONFIGURATION <KubernetesClusterRestoreCriteria>`: Restore configuration for restore. Use this parameter to restore with AzureKubernetesService.
- `IncludeClusterScopeResource <Boolean>`: Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore.
- `ObjectType <String>`: Type of the specific object - used for deserializing
- `[ConflictPolicy <ExistingResourcePolicy?>]`: Gets or sets the Conflict Policy property. This property sets policy during conflict of resources during restore.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ KubernetesClusterBackupDatasourceParameters {excludeNS1, excludeNS2}

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

### Example 2: Create a BackupConfiguration to select specific containers for configuring vaulted backups for AzureBlob.
```powershell
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName
$containers=Get-AzStorageContainer -Context $storageAccount.Context
$backupConfig = New-AzDataProtectionBackupConfigurationClientObject -DatasourceType AzureBlob -VaultedBackupContainer $containers.Name[1,3,4]
```

```output
ObjectType ContainersList
---------- --------------
BlobBackupDatasourceParameters {conabb, conwxy, conzzz}
```

This command can be used to create a backup configuration client object used for configuring backup for vaulted Blob backup containers.

## PARAMETERS

### -DatasourceType
Expand Down
Loading