Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
2 changes: 2 additions & 0 deletions azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,12 @@
<Compile Include="azure-cli\azure\cli\command_modules\backup\custom_base.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\custom_common.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\custom_afs.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\custom_wl.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\custom_help.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\latest\preparers.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\latest\test_backup_commands.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\latest\test_afs_commands.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\latest\test_workload_commands.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\latest\__init__.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\tests\__init__.py" />
<Compile Include="azure-cli\azure\cli\command_modules\backup\_client_factory.py" />
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Release History

* Fix issue #11100: AttributeError for az webapp up when create service plan

**Backup**

* Added Backup support for SQL and SAP Hana workload.

**Packaging**

* Rewrite the az wrapper in python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def backup_storage_configs_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_resource_storage_configs


# Protection Client Factories
def protection_intent_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).protection_intent


def protection_policies_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).protection_policies

Expand Down Expand Up @@ -107,6 +112,10 @@ def backup_jobs_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_jobs


def backup_workload_items_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).backup_workload_items


# Job Client Factories
def job_details_cf(cli_ctx, *_):
return _backup_client_factory(cli_ctx).job_details
Expand Down
15 changes: 15 additions & 0 deletions src/azure-cli/azure/cli/command_modules/backup/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ def transform_recovery_point(result):
('Consistency', result['properties']['recoveryPointType'])])


def transform_protectable_item(result):
columns = []
columns.append(('Name', result['name']))
columns.append(('Protectable Item Type', result['properties']['protectableItemType']))
columns.append(('ParentName', result['properties']['parentName']))
columns.append(('ServerName', result['properties']['serverName']))
columns.append(('isProtected', result['properties']['protectionState']))

return OrderedDict(columns)


def transform_container_list(container_list):
return [transform_container(c) for c in container_list]

Expand All @@ -82,3 +93,7 @@ def transform_policy_list(policy_list):

def transform_recovery_point_list(recovery_point_list):
return [transform_recovery_point(rp) for rp in recovery_point_list]


def transform_protectable_item_list(protectable_item_list):
return [transform_protectable_item(i) for i in protectable_item_list]
100 changes: 99 additions & 1 deletion src/azure-cli/azure/cli/command_modules/backup/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@
crafted: true
"""

helps['backup container register'] = """
type: command
short-summary: Register a Resource to the given Recovery Services Vault.
examples:
- name: This command allows Azure Backup to convert the 'Resource' to a 'Backup Container' which is then registered to the given Recovery services vault. The Azure Backup service can then discover workloads of the given workload type within this container to be protected later.
text: az backup container register --resource-group MyResourceGroup --vault-name MyVault --resource-id MyResourceId --workload-type MSSQL --backup-management-type AzureWorkload --resource-id MyResourceID
"""

helps['backup container re-register'] = """
type: command
short-summary: Reset the registration details for a given container.
examples:
- name: Reset the registration details for a given container. To be used only in error scenarios as specified here (https://docs.microsoft.com/azure/backup/backup-sql-server-azure-troubleshoot#re-registration-failures). Understand the failure symptoms and causes before attempting re-registration.
text: az backup container re-register --resource-group MyResourceGroup --vault-name MyVault --container-name MyContainer --workload-type MSSQL --backup-management-type AzureWorkload --yes
"""

helps['backup container show'] = """
type: command
short-summary: Show details of a container registered to a Recovery services vault.
Expand Down Expand Up @@ -181,7 +197,36 @@
short-summary: Create a new policy for the given BackupManagementType and workloadType.
examples:
- name: Create a new policy for the given BackupManagementType and workloadType.
text: az backup policy create --policy {policy} --resource-group MyResourceGroup --vault-name MyVault --name MyPolicy
text: az backup policy create --policy {policy} --resource-group MyResourceGroup --vault-name MyVault --name MyPolicy --backup-management-type AzureStorage
"""

helps['backup protectable-item'] = """
type: group
short-summary: An item which can be protected or backed up to an Azure Recovery services vault with an associated policy.
"""

helps['backup protectable-item initialize'] = """
type: command
short-summary: Trigger the discovery of any unprotected items of the given workload type in the given container.
examples:
- name: Trigger the discovery of any unprotected items of the given workload type in the given container. Use this command to manually discover new DBs and proceed to protect them.
text: az backup protectable-item initialize --resource-group MyResourceGroup --vault-name MyVault --workload-type MSSQL --container-name MyContainer
"""

helps['backup protectable-item list'] = """
type: command
short-summary: Retrieve all protectable items within a certain container or across all registered containers.
examples:
- name: Retrieve all protectable items within a certain container or across all registered containers. It consists of all the elements in the hierarchy of the application. Returns DBs and their upper tier entities like Instance, AvailabilityGroup etc.
text: az backup protectable-item list --resource-group MyResourceGroup --vault-name MyVault --workload-type MSSQL --container-name MyContainer
"""

helps['backup protectable-item show'] = """
type: command
short-summary: Retrieve the specified protectable item within the given container.
examples:
- name: Retrieve the specified protectable item within the given container.
text: az backup protectable-item show --resource-group MyResourceGroup --vault-name MyVault --workload-type MSSQL --protectable-item-type SQLAG --name Name --server-name MyServerName
"""

helps['backup protection'] = """
Expand Down Expand Up @@ -233,6 +278,43 @@
text: az backup protection enable-for-azurefileshare --policy-name MyPolicy --resource-group MyResourceGroup --vault-name MyVault --storage-account MyStorageAccount --azure-file-share MyAzureFileShare
"""

helps['backup protection enable-for-azurewl'] = """
type: command
short-summary: Start protecting a previously unprotected workload within an Azure VM as per the specified policy to a Recovery services vault. Provide the workload details as a protectable item.
examples:
- name: Start protecting a previously unprotected workload within an Azure VM as per the specified policy to a Recovery services vault. Provide the workload details as a protectable item.
text: az backup protection enable-for-azurewl --policy-name MyPolicy --resource-group MyResourceGroup --vault-name MyVault --protectable-item-name ItemName --protectable-item-type SQLInstance --server-name Myserver --workload-type MSSQL
"""

helps['backup protection auto-enable-for-azurewl'] = """
type: command
short-summary: Automatically protect all existing unprotected DBs and any DB which will be added later with the given policy.
examples:
- name: Automatically protect all existing unprotected DBs and any DB which will be added later with the given policy. Azure backup service will then regularly scan auto-protected containers for any new DBs and automatically protect them.
text: az backup protection auto-enable-for-azurewl --policy-name MyPolicy --resource-group MyResourceGroup --vault-name MyVault --protectable-item-name ItemName --protectable-item-type SQLInstance --server-name Myserver --workload-type MSSQL
"""

helps['backup protection auto-disable-for-azurewl'] = """
type: command
short-summary: Disable auto-protection for the specified item.
examples:
- name: Disable auto-protection for the specified item.
text: az backup protection auto-disable-for-azurewl --resource-group MyResourceGroup --vault-name MyVault --item-name MyItemName
"""

helps['backup recoveryconfig'] = """
type: group
short-summary: Manage recovery configuration of an Azure workload backed up item.
"""

helps['backup recoveryconfig show'] = """
type: command
short-summary: Construct the recovery configuration of an Azure workload backed up item.
examples:
- name: Construct the recovery configuration of an Azure workload backed up item. The configuration object stores all details such as the recovery mode, target destinations for the restore and application specific parameters like target physical paths for SQL.
text: az backup recoveryconfig show --container-name MyContainer --item-name MyItem --resource-group MyResourceGroup --vault-name MyVault --restore-mode OriginalWorkloadRestore
"""

helps['backup recoverypoint'] = """
type: group
short-summary: A snapshot of data at that point-of-time, stored in Recovery Services Vault, from which you can restore information.
Expand All @@ -256,6 +338,14 @@
crafted: true
"""

helps['backup recoverypoint show-log-chain'] = """
type: command
short-summary: List the start and end points of the unbroken log chain(s) of the given backup item.
examples:
- name: List the start and end points of the unbroken log chain(s) of the given backup item. Use it to determine whether the point-in-time, to which the user wants the DB to be restored, is valid or not.
text: az backup recoverypoint show-log-chain --container-name MyContainer --item-name MyItem --resource-group MyResourceGroup --vault-name MyVault
"""

helps['backup restore'] = """
type: group
short-summary: Restore backed up items from recovery points in a Recovery Services vault.
Expand Down Expand Up @@ -309,6 +399,14 @@
text: az backup restore restore-azurefiles --resource-group MyResourceGroup --vault-name MyVault --container-name MyContainer --item-name MyItem --rp-name recoverypoint --resolve-conflict Overwrite --restore-mode OriginalLocation --source-file-type File --source-file-path MyPath
"""

helps['backup restore restore-azurewl'] = """
type: command
short-summary: Restore backed up Azure Workloads in a Recovery services vault to another registered container or to the same container.
examples:
- name: Restore backed up Azure Workloads in a Recovery services vault to another registered container or to the same container.
text: az backup restore restore-azurewl --resource-group MyResourceGroup --vault-name MyVault --recovery-config MyRecoveryConfig
"""

helps['backup vault'] = """
type: group
short-summary: Online storage entity in Azure used to hold data such as backup copies, recovery points and backup policies.
Expand Down
Loading