Skip to content

Conversation

@adeal
Copy link
Contributor

@adeal adeal commented May 29, 2018

Description

This change introduces 2 new cmdlets:

  • Get-AzureRmSqlDatabaseBackupShortTermRetentionPolicy
  • Set-AzureRmSqlDatabaseBackupShortTermRetentionPolicy

Cmdlet review: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/54
I made small modifications to what was reviewed (renamed AzureRmSqlDatabaseShortTermRetentionPolicy->AzureRmSqlDatabaseBackupShortTermRetentionPolicy) to better align with resource names and existing cmdlets.

Additionally, I added a temporary validation of the -RetentionDays param to enforce that the value is a multiple of 7 (we decided we only want retention to be in weeks for now). This validation is not deployed WW server-side yet, so I am doing the validation client-side for now and I will remove once the server validation is gone.

Checklist

antoniowmsft and others added 30 commits April 9, 2018 10:41
…d Add-AzureBatchComputeNodeServiceLogs cmdlets
[Parameter(ParameterSetName = PolicyByResourceServerDatabaseSet,
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually the atribute parameter ValueFromPipeline is used to bind by complex types.

public string ServerName { get; set; }

For string type you may want to keep using ValueFromPipelineByPropertyName.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agh, I switched this when I was playing around with it and forgot to switch back. Thanks for the catch!

ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Database to use.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

HelpMessage = "The database object to get the policy for.")]
[ValidateNotNullOrEmpty]
public AzureSqlDatabaseModel InputObject { get; set; }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually the InputObject name is uses for parameter of the same type as the cmdlet output type.
In this case you may want to rename the parameter from InputObject to AzureSqlDatabase, for example.

Copy link
Contributor Author

@adeal adeal Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

```
Get-AzureRmSqlDatabaseBackupShortTermRetentionPolicy -ResourceId <String> [-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[-ResourceGroupName] is useless here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating help docs again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same for Set-

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vladimir-shcherbakov vladimir-shcherbakov merged commit 3b2209d into Azure:AzureRM.Sql.STR Jun 5, 2018
@adeal adeal deleted the AzureRM.Sql.ShortTermRetentionHotRelease branch June 5, 2018 23:32
@adeal adeal restored the AzureRM.Sql.ShortTermRetentionHotRelease branch June 5, 2018 23:32
@adeal adeal deleted the AzureRM.Sql.ShortTermRetentionHotRelease branch June 7, 2018 22:58
@dvmorris
Copy link

Is there a reason this code is no longer in the latest release of AzureRm.Sql, 4.12.1? I really need this method, and I can't find it in the latest release.

@adeal
Copy link
Contributor Author

adeal commented Jan 22, 2019

@dvmorris it is currently only in the preview releases. I'll move it over to our release branch today!

@dvmorris
Copy link

@dealaus thanks! That would be great. It's the only way I can find to actually set the PITR days value dynamically from PowerShell, and we need to do it as part of a regulatory requirement.

@adeal
Copy link
Contributor Author

adeal commented Jan 22, 2019

@dvmorris No problem. I will let you know when my pull request goes through, but if you'd like to be unblocked before our next release of the Az.Sql module, you can temporarily use the latest preview module which has the cmdlet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.