Skip to content

Update Set-AzureRmSqlServerAuditing and Set-AzureRmSqlDatabaseAuditing Cmdlets #6457

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 15 commits into from
Jun 19, 2018
Merged

Conversation

bashahee
Copy link
Contributor

@bashahee bashahee commented Jun 13, 2018

Description

Adding a new parameter (-StorageAccountSubscriptionId) existing Set-AzureRmSqlServerAuditing and Set-AzureRmSqlDatabaseAuditing Cmdlets.

Checklist

@praries880
Copy link
Contributor

@bashahee

  • netcore build has failing tests
  • you need to add a change log that described the changes in the PR.

@praries880
Copy link
Contributor

/// <summary>
/// Gets or sets storage account subscription id.
/// </summary>
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = AuditingHelpMessages.AuditStorageAccountSubscriptionIdHelpMessage)]
Copy link
Contributor

Choose a reason for hiding this comment

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

As per the discussion in the design review

The behavior as the changes stand currently is that the user can specify StorageAccountSubscriptionId without specifying StorageAccountName.

Given that StorageAccountName is required when StorageAccountSubscriptionIdis specified, I would recomment adding a parameter set whereStorageAccountNameis required andStorageAccountSubscriptionId` is optional.

/// <summary>
/// Gets or sets storage account subscription id.
/// </summary>
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = AuditingHelpMessages.AuditStorageAccountSubscriptionIdHelpMessage)]
Copy link
Contributor

Choose a reason for hiding this comment

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

As per the discussion in the design review

The behavior as the changes stand currently is that the user can specify StorageAccountSubscriptionId without specifying StorageAccountName.

Given that StorageAccountName is required when StorageAccountSubscriptionIdis specified, I would recomment adding a parameter set whereStorageAccountNameis required andStorageAccountSubscriptionId` is optional.

bashahee and others added 6 commits June 17, 2018 15:15
…me parameter set

Combined StorageAccountSubscriptionId and StorageAccountName under same parameter set
Update old auditing cmdlets
Fix errors regarding md files
Fix error in md file
Fix examples in md file
@bashahee
Copy link
Contributor Author

@praries880 Your requests were addressed.

StringBuilder uriBuilder = new StringBuilder(Context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager).ToString());
uriBuilder.AppendFormat("{0}/listKeys?api-version={1}",
storageAccountId,
isClassicStorage ? "2016-11-01" : "2017-06-01");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick : These string literals should be constants instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@praries880 Versions were extracted to constants, while Uri template was not due to readability.

if (isClassicStorage)
{
primaryKey = (string)storageAccountKeysResponse["primaryKey"];
secondaryKey = (string)storageAccountKeysResponse["secondaryKey"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick : These string literals should be constants instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@praries880 Done.

praries880
praries880 previously approved these changes Jun 18, 2018
Copy link
Contributor

@praries880 praries880 left a comment

Choose a reason for hiding this comment

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

Minor nitpicks, otherwise LGTM

Extract some hardcoded strings to constants
@bashahee
Copy link
Contributor Author

@praries880 Since all requests were addressed and relevant open issue was accepted, can "cmdlet review required" and "needs revision" Labels be removed from PR?

@praries880
Copy link
Contributor

@praries880 praries880 merged commit ea26bbc into Azure:preview Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants