-
Notifications
You must be signed in to change notification settings - Fork 4.1k
SQL Ledger Cmdlets #14997
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
SQL Ledger Cmdlets #14997
Changes from 24 commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
dbdcfc0
ledger changes + changes for new SDK version
rewongmicrosoft af01912
adding tests, updating cmdlets
rewongmicrosoft 9b02401
adding tests, fixing cmdlets
rewongmicrosoft 5dc5c66
adding comments to locations model
rewongmicrosoft 7b3d2db
adding to changelog.md
rewongmicrosoft 6225512
adding markdowe help files
rewongmicrosoft 801da5e
fixing merge problems with backup restore resources
rewongmicrosoft 4a6b843
updating help file for new-azsqldatabase
rewongmicrosoft b24ecb7
rerecording tests
rewongmicrosoft efef183
removing EnableLedger from Set-AzureSqlDatabase
rewongmicrosoft ca33bc4
removing extra parameter
rewongmicrosoft c71933f
adding whatif text
rewongmicrosoft 2e76d33
upgrading Microsoft.Azure.Management.Sql to 1.52
rewongmicrosoft 0276433
fixing online version link
rewongmicrosoft 05c8a6e
adding audit action group for ledger
rewongmicrosoft 7b01c3d
adding default parameter set
rewongmicrosoft b732ead
adding default parameter set
rewongmicrosoft 033f2cf
adding -EnableLedger description to new-azsqldatabase help file
rewongmicrosoft 2f1d5b1
adding ResourceIdentityWithUserAssignedIdentities to breaking changes…
rewongmicrosoft cf9a296
adding breaking change message
rewongmicrosoft 0bebc05
fixing type name
rewongmicrosoft ea33943
adding using directive
rewongmicrosoft fa97167
updating breaking changes message
rewongmicrosoft 14b7295
testing updating TestDatabaseDataMaskingPrivilegedUsersChanges test
rewongmicrosoft 547499a
adding first batch of test re-records
rewongmicrosoft 510d4c4
adding more re-recordings
rewongmicrosoft dabf2b9
more changes for re-recording
rewongmicrosoft 0633b81
adding re-recordings, adding ignore api version to some tests
rewongmicrosoft f0591fd
adding ignore API version to instance pools test
rewongmicrosoft dfd0f0c
removing ignore API version from Auditing
rewongmicrosoft 7599efa
adding auditing tests, removing database override from vulnerability …
rewongmicrosoft 4640b3e
addding test re-recordings
rewongmicrosoft 94ecd76
updating version to newest SDK, removing breaking change warnings
rewongmicrosoft 3641573
adding server crud test re-records, instance pool crud tests to ignor…
rewongmicrosoft fc7a898
adding skip to managed instance tests
rewongmicrosoft cd90d0d
Commenting out instance pool, adding vulnerability assessment tests
rewongmicrosoft 5b12258
Adding more test rescordings, skipping tests
rewongmicrosoft c79598f
reverting unneeded file changes
rewongmicrosoft 830d876
Merge branch 'master' into sqlledger
rewongmicrosoft fb8838f
Update ChangeLog.md
wyunchi-ms 8b09bcb
rerecording test
rewongmicrosoft 3763528
Merge branch 'sqlledger' of https://github.com/rewongmicrosoft/azure-…
rewongmicrosoft 8a43525
update changelog
rewongmicrosoft 785a61e
ledger changes + changes for new SDK version
rewongmicrosoft 74767bf
adding tests, updating cmdlets
rewongmicrosoft 8dd0b33
adding tests, fixing cmdlets
rewongmicrosoft f107957
adding comments to locations model
rewongmicrosoft 3f51814
adding to changelog.md
rewongmicrosoft 12db9b2
adding markdowe help files
rewongmicrosoft 6e73321
fixing merge problems with backup restore resources
rewongmicrosoft 5430b6b
updating help file for new-azsqldatabase
rewongmicrosoft 32fc76f
rerecording tests
rewongmicrosoft f13328c
removing EnableLedger from Set-AzureSqlDatabase
rewongmicrosoft 003a6d8
removing extra parameter
rewongmicrosoft d1b451c
adding whatif text
rewongmicrosoft a8eda69
upgrading Microsoft.Azure.Management.Sql to 1.52
rewongmicrosoft f4c7b84
fixing online version link
rewongmicrosoft d76b84c
adding audit action group for ledger
rewongmicrosoft 6fb3579
adding default parameter set
rewongmicrosoft acff20a
adding default parameter set
rewongmicrosoft a8129ad
adding -EnableLedger description to new-azsqldatabase help file
rewongmicrosoft c7a5413
adding ResourceIdentityWithUserAssignedIdentities to breaking changes…
rewongmicrosoft a580359
adding breaking change message
rewongmicrosoft 1a851dd
fixing type name
rewongmicrosoft 8c1471c
adding using directive
rewongmicrosoft 9585886
updating breaking changes message
rewongmicrosoft 481b086
testing updating TestDatabaseDataMaskingPrivilegedUsersChanges test
rewongmicrosoft 9686c98
adding first batch of test re-records
rewongmicrosoft 89a17c1
adding more re-recordings
rewongmicrosoft 6e33b2e
more changes for re-recording
rewongmicrosoft f422f37
adding re-recordings, adding ignore api version to some tests
rewongmicrosoft 94f1627
adding ignore API version to instance pools test
rewongmicrosoft fda30bf
removing ignore API version from Auditing
rewongmicrosoft c67c789
adding auditing tests, removing database override from vulnerability …
rewongmicrosoft 87b1a74
addding test re-recordings
rewongmicrosoft af1c19c
updating version to newest SDK, removing breaking change warnings
rewongmicrosoft e248b32
adding server crud test re-records, instance pool crud tests to ignor…
rewongmicrosoft 12e0f35
adding skip to managed instance tests
rewongmicrosoft d22d599
Commenting out instance pool, adding vulnerability assessment tests
rewongmicrosoft d95f104
Adding more test rescordings, skipping tests
rewongmicrosoft 78a9386
reverting unneeded file changes
rewongmicrosoft 8a3afed
rerecording test
rewongmicrosoft 13f56e7
Update ChangeLog.md
wyunchi-ms 227dc72
update changelog
rewongmicrosoft cb1a3ca
Merge branch 'sqlledger' of https://github.com/rewongmicrosoft/azure-…
rewongmicrosoft 5bffdde
re-recording named secondary test after rebase
rewongmicrosoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // Copyright Microsoft Corporation | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // ---------------------------------------------------------------------------------- | ||
|
|
||
| using Microsoft.Azure.Commands.ScenarioTest.SqlTests; | ||
| using Microsoft.Azure.ServiceManagement.Common.Models; | ||
| using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
| using Xunit; | ||
| using Xunit.Abstractions; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests | ||
| { | ||
| public class LedgerDigestUploadTests : SqlTestsBase | ||
| { | ||
| public LedgerDigestUploadTests(ITestOutputHelper output) : base(output) | ||
| { | ||
| base.resourceTypesToIgnoreApiVersion = new string[] { | ||
| "Microsoft.Sql/servers" | ||
| }; | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestGetDefaultLedgerDigestUpload() | ||
| { | ||
| RunPowerShellTest("Test-GetDefaultLedgerDigestUpload"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestSetLedgerDigestUploadByName() | ||
| { | ||
| RunPowerShellTest("Test-SetLedgerDigestUploadByName"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestSetLedgerDigestUploadByDatabaseObject() | ||
| { | ||
| RunPowerShellTest("Test-SetLedgerDigestUploadByDatabaseObject"); | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestSetLedgerDigestUploadByResourceId() | ||
| { | ||
| RunPowerShellTest("Test-SetLedgerDigestUploadByResourceId"); | ||
| } | ||
| } | ||
| } | ||
197 changes: 197 additions & 0 deletions
197
src/Sql/Sql.Test/ScenarioTests/LedgerDigestUploadTests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| # ---------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright Microsoft Corporation | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ---------------------------------------------------------------------------------- | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests getting default ledger digest upload configuration | ||
| #> | ||
| function Test-GetDefaultLedgerDigestUpload | ||
| { | ||
| # Setup | ||
| $testSuffix = getAssetName | ||
| $params = Get-LedgerTestEnvironmentParameters $testSuffix | ||
| Create-LedgerTestEnvironment $params | ||
|
|
||
| $databaseResourceId = "/subscriptions/" + $params.subscriptionId + "/resourceGroups/" + $params.rgname + "/providers/Microsoft.Sql/servers/" + $params.serverName + "/databases/" + $params.databaseName | ||
| $databaseObject = Get-AzSqlDatabase -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| try | ||
| { | ||
| # Test | ||
| $ledgerDigestUpload = Get-AzSqlDatabaseLedgerDigestUpload -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUpload.State "Disabled" | ||
rewongmicrosoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Test | ||
| $ledgerDigestUploadByResourceId = Get-AzSqlDatabaseLedgerDigestUpload -ResourceId $databaseResourceId | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadByResourceId.State "Disabled" | ||
|
|
||
| # Test | ||
| $ledgerDigestUploadByDatabase = Get-AzSqlDatabaseLedgerDigestUpload -InputObject $databaseObject | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadByDatabase.State "Disabled" | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-LedgerTestEnvironment $testSuffix | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests enabling and disabling ledger digest uploading using named parameters | ||
| #> | ||
| function Test-SetLedgerDigestUploadByName | ||
| { | ||
| # Setup | ||
| $testSuffix = getAssetName | ||
| $params = Get-LedgerTestEnvironmentParameters $testSuffix | ||
| Create-LedgerTestEnvironment $params | ||
| $endpoint = "https://test.confidential-ledger.azure.com" | ||
|
|
||
| try | ||
| { | ||
| # Test enabling | ||
| $ledgerDigestUploadEnable = Enable-AzSqlDatabaseLedgerDigestUpload -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName -Endpoint $endpoint | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnable.State "Enabled" | ||
| Assert-AreEqual $ledgerDigestUploadEnable.Endpoint $endpoint | ||
|
|
||
| # Test get enabled settings | ||
| $ledgerDigestUploadEnabledGet = Get-AzSqlDatabaseLedgerDigestUpload -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.State "Enabled" | ||
rewongmicrosoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.Endpoint $endpoint | ||
|
|
||
| # Test disabling | ||
| $ledgerDigestUploadDisable = Disable-AzSqlDatabaseLedgerDigestUpload -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisable.State "Disabled" | ||
|
|
||
| # Test get disabled settings | ||
| $ledgerDigestUploadDisabledGet = Get-AzSqlDatabaseLedgerDigestUpload -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisabledGet.State "Disabled" | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-LedgerTestEnvironment $testSuffix | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests enabling and disabling ledger digest uploading using the database object | ||
| #> | ||
| function Test-SetLedgerDigestUploadByDatabaseObject | ||
| { | ||
| # Setup | ||
| $testSuffix = getAssetName | ||
| $params = Get-LedgerTestEnvironmentParameters $testSuffix | ||
| Create-LedgerTestEnvironment $params | ||
| $endpoint = "https://test.confidential-ledger.azure.com" | ||
| $databaseObject = Get-AzSqlDatabase -ResourceGroupName $params.rgname -ServerName $params.serverName -DatabaseName $params.databaseName | ||
|
|
||
| try | ||
| { | ||
| # Test enabling | ||
| $ledgerDigestUploadEnable = Enable-AzSqlDatabaseLedgerDigestUpload -InputObject $databaseObject -Endpoint $endpoint | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnable.State "Enabled" | ||
| Assert-AreEqual $ledgerDigestUploadEnable.Endpoint $endpoint | ||
|
|
||
| # Test get enabled settings | ||
| $ledgerDigestUploadEnabledGet = Get-AzSqlDatabaseLedgerDigestUpload -InputObject $databaseObject | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.State "Enabled" | ||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.Endpoint $endpoint | ||
|
|
||
| # Test disabling | ||
| $ledgerDigestUploadDisable = Disable-AzSqlDatabaseLedgerDigestUpload -InputObject $databaseObject | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisable.State "Disabled" | ||
|
|
||
| # Test get disabled settings | ||
| $ledgerDigestUploadDisabledGet = Get-AzSqlDatabaseLedgerDigestUpload -InputObject $databaseObject | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisabledGet.State "Disabled" | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-LedgerTestEnvironment $testSuffix | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests enabling and disabling ledger digest uploading using the resource ID | ||
| #> | ||
| function Test-SetLedgerDigestUploadByResourceId | ||
| { | ||
| # Setup | ||
| $testSuffix = getAssetName | ||
| $params = Get-LedgerTestEnvironmentParameters $testSuffix | ||
| Create-LedgerTestEnvironment $params | ||
| $endpoint = "https://test.confidential-ledger.azure.com" | ||
| $databaseResourceId = "/subscriptions/" + $params.subscriptionId + "/resourceGroups/" + $params.rgname + "/providers/Microsoft.Sql/servers/" + $params.serverName + "/databases/" + $params.databaseName | ||
|
|
||
| try | ||
| { | ||
| # Test enabling | ||
| $ledgerDigestUploadEnable = Enable-AzSqlDatabaseLedgerDigestUpload -ResourceId $databaseResourceId -Endpoint $endpoint | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnable.State "Enabled" | ||
| Assert-AreEqual $ledgerDigestUploadEnable.Endpoint $endpoint | ||
|
|
||
| # Test get enabled settings | ||
| $ledgerDigestUploadEnabledGet = Get-AzSqlDatabaseLedgerDigestUpload -ResourceId $databaseResourceId | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.State "Enabled" | ||
| Assert-AreEqual $ledgerDigestUploadEnabledGet.Endpoint $endpoint | ||
|
|
||
| # Test disabling | ||
| $ledgerDigestUploadDisable = Disable-AzSqlDatabaseLedgerDigestUpload -ResourceId $databaseResourceId | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisable.State "Disabled" | ||
|
|
||
| # Test get disabled settings | ||
| $ledgerDigestUploadDisabledGet = Get-AzSqlDatabaseLedgerDigestUpload -ResourceId $databaseResourceId | ||
|
|
||
| # Assert | ||
| Assert-AreEqual $ledgerDigestUploadDisabledGet.State "Disabled" | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Remove-LedgerTestEnvironment $testSuffix | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.