Skip to content
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

Added live test cases for Compute and KeyVault #20968

Merged
merged 127 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
fc89a3b
Fix example 1 in Set-AzVirtualNetworkPeering.md (#20588)
Ar-Sa Jan 10, 2023
950f7d4
{EventHub} Fix #20562: Fix 'New-AzEventHubAuthorizationRuleSASToken' …
RakeshMohanMSFT Jan 10, 2023
f3f65e2
Revise common assembly doc (#20465)
isra-fel Jan 10, 2023
9a3ae62
[AKS] support AadProfile (#20596)
YanaXu Jan 10, 2023
7ff173a
[Network] New-AzNetworkWatcherPacketCapture - TotalBytesPerSession wi…
v-sapanchal Jan 11, 2023
bb60fb4
Move LoadTesting to main (#20622)
azure-powershell-bot Jan 11, 2023
e98462b
Move BillingBenefits to main (#20624)
azure-powershell-bot Jan 11, 2023
e1ff717
Update changelog as per PR#20426 (#20616)
imsiddhartha Jan 12, 2023
c5b7bf0
Fix the issue that CI will fail to when tools is updated in generatio…
wyunchi-ms Jan 12, 2023
98a1b3a
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 16, 2023
1ce2d4e
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 16, 2023
2e3c703
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 16, 2023
c0dcab7
Enabled to set perform snat to always when PrivateRange is set to 255…
Gizachew-Eshetie Jan 16, 2023
94fd995
Rename the name to PhaseName (#20651)
wyunchi-ms Jan 16, 2023
33ad3cb
Fix format issue of Remove-AzPostgreSqlFlexibleServerDatabase ref doc…
msJinLei Jan 16, 2023
4145dd4
Fix Az.Accounts cannot be imported due to assembly not found (#20637)
isra-fel Jan 16, 2023
7c135d8
Add support for the case that psd1 and help are in the {module}.Manae…
dolauli Jan 16, 2023
ceec33e
Fixed the issue when support help and psd1 in {module}.Management fol…
dolauli Jan 16, 2023
04417f5
Update the check rules and update some exception files (#20647)
wyunchi-ms Jan 16, 2023
7dfbf1c
Mitryakh/nrp test fixes (#20612)
MikhailTryakhov Jan 17, 2023
f4012a6
Fixed typo "resouce group"→"resource group" (#20664)
hyoshioka0128 Jan 17, 2023
4f9d618
[AppService]: doc-update #12181- AppSettingsOverrides in New-AzWebApp…
Kotasudhakarreddy Jan 17, 2023
54a771d
Migrate MobileNetwork from generation to main (#20673)
azure-powershell-bot Jan 17, 2023
332c0bd
Change test coverage log to debug level (#20648)
isra-fel Jan 17, 2023
fe9757d
Added HAReplicaCount parameter to restore-AzSqlDatabase cmdlet (#20580)
rebeccaxu-ms Jan 17, 2023
c15aaf3
[Storage Dataplane] - Remove Validation Set and move to track2 SDK fo…
blueww Jan 18, 2023
dbfd3f6
Updated script to build TestFx environment as well as the document (#…
vidai-msft Jan 18, 2023
d1d0f71
{AppServices} Update AccountName parameter description (#20607)
SaurabhSharma-MSFT Jan 18, 2023
b5de2a7
add param to New-AzRestorePoint (#20645)
grizzlytheodore Jan 19, 2023
ac1f259
Move BillingBenefits to main (#20706)
azure-powershell-bot Jan 19, 2023
6961ced
BillingBenefits and LoadTesting OOB (#20629)
isra-fel Jan 20, 2023
1599bae
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
34c86bf
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
7c473f9
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
5e1c5dd
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
66fbe36
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
4a96b1b
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
7112437
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
c1a97a3
Domain name of online doc is changed from docs.microsoft.com to learn…
LucasYao93 Jan 20, 2023
2c6181f
Microsoft mandatory file (#20737)
microsoft-github-policy-service[bot] Jan 26, 2023
a54d400
Fill in empty Compute parameter descriptions (#20726)
Sandido Jan 27, 2023
68218ca
Update StorageAccountType LRS values to correct _LRS format (#20727)
Sandido Jan 27, 2023
a370dcd
Remove the useless projects under tools folder (#20633)
wyunchi-ms Jan 27, 2023
ef2ee75
[CosmosDB] Modify Example 1 with the correct cmdlet (#20707)
SaurabhSharma-MSFT Jan 28, 2023
a9e9131
update Compute .Net SDK version to 59 (#20524)
Sandido Jan 28, 2023
2b5fb75
{AzurePolicy} fixes Azure/azure-powershell#20654 fix the description …
navba-MSFT Jan 28, 2023
c54c766
[SQL] umi support for auditing (#20750)
IliasKhan Jan 28, 2023
1a06246
Updated the max value for HAReplicaCount parameter (#20752)
rebeccaxu-ms Jan 28, 2023
8915c32
[AppGW] Start-AzApplicationGateway docs example (#20699)
JackStromberg Jan 28, 2023
12e4910
{Sql} Fix #20703: Fix 'Set-AzSqlServerAudit' missing WorkSpaceResourc…
RakeshMohanMSFT Jan 28, 2023
df75309
Fix the issue of wrong format of csv (#20765)
wyunchi-ms Jan 29, 2023
134b0bd
[Redis] Update `Get-AzRedisCacheLink` and `New-AzRedisCacheLink` to p…
austintolani Jan 30, 2023
9e0d50d
Add Azure Firewall SKU Upgrade Example (#20686)
bewatersmsft Jan 30, 2023
e403a7f
[DataFactory]Updated ADF .Net SDK version to 9.0.0 (#20676)
Jingshu923 Jan 30, 2023
62745f1
Typo "resouce group"→"resource group" (#20713)
hyoshioka0128 Jan 30, 2023
867ce18
[Storage] Add warning message for AllowBlobPublicAccess default behav…
yifanz0 Jan 30, 2023
b24a273
Corrected disallowed html tags from docs build report (#20643)
mikefrobbins Jan 30, 2023
810d64f
Corrected broken links from docs build report (#20642)
mikefrobbins Jan 30, 2023
23aad2b
Replace Get-InstalledModule with Get-Module -ListAvailable (#20632)
msJinLei Jan 30, 2023
459b6f6
Migrate ApplicationInsights from generation to main (#20782)
azure-powershell-bot Jan 30, 2023
4773fed
Managed database cross subscription restore (#20735)
milanbrkic-ms Jan 31, 2023
eaa4d09
Add module version to changelog (#20669)
wyunchi-ms Jan 31, 2023
c414be6
TargetExtendedLocation support for GalleryImageVersion (#20748)
grizzlytheodore Jan 31, 2023
d969f2d
Migrate StackHCI from generation to main (#20785)
azure-powershell-bot Jan 31, 2023
7750474
[Peering] Migrate to autorest and support API version 2022-10-01 (#20…
lijinpei2008 Jan 31, 2023
0ecbc3c
[AKS] support HostGroupID (#20796)
YanaXu Jan 31, 2023
664e09d
Migrate DataProtection from generation to main (#20786)
azure-powershell-bot Jan 31, 2023
0997c93
[Resources] Handle nested array changes in What-If formatter (#20689)
shenglol Jan 31, 2023
577ff8d
Migrate Compute from generation to main (#20788)
azure-powershell-bot Jan 31, 2023
4f3758a
win-arm64 support for WAM (#20797)
isra-fel Jan 31, 2023
1cc694b
[AppService]: fix #20746 New-AzWebAppCertificate -hostname indicates …
Kotasudhakarreddy Jan 31, 2023
1ee69ed
Format changelog.md (#20800)
isra-fel Jan 31, 2023
eaa5066
Migrate VoiceServices from generation to main (#20798)
azure-powershell-bot Jan 31, 2023
90495c5
Add managed instance DTC cmdlets (#20805)
krivi37 Jan 31, 2023
9cca982
Revert the UbuntuLTS image alias to use the version 16.04 instead of …
Sandido Feb 1, 2023
f8ebd0d
Fixed query issue when objectId in assignment is empty for Get-DenyAs…
BethanyZhou Feb 1, 2023
9de7b56
changed domain name of online. (#20802)
LucasYao93 Feb 1, 2023
bc01fa8
Typo "udpate"→"update" (#20810)
hyoshioka0128 Feb 1, 2023
71cf922
[Compute] Added `-SkipIdentity`, `-PathUserIdentity`, `-IsTest` to `S…
maxthedread Feb 1, 2023
41a7c38
[Az.RecoveryServices.Backup] Added support for Private Endpoints and …
hiaga Feb 1, 2023
31d2506
Move MobileNetwork to release-2023-02-07 (#20821)
azure-powershell-bot Feb 1, 2023
d2fbb74
Update the logic of get commit id in autorest generation (#20827)
wyunchi-ms Feb 2, 2023
bc78f20
Move Peering to release-2023-02-07 (#20833)
azure-powershell-bot Feb 2, 2023
fc2fa77
[AKS] fix a bug in zip on windows (#20832)
YanaXu Feb 3, 2023
1115b94
Fix the bugs for AzKeyStore (#20768)
msJinLei Feb 3, 2023
1545f52
Migrate Monitor from generation to release-2023-02-07 (#20841)
azure-powershell-bot Feb 3, 2023
e9b7a68
release-2023-02-07 (#20843)
isra-fel Feb 3, 2023
82d7d99
Merge branch 'main' into release-2023-02-07
isra-fel Feb 3, 2023
27b6922
Update Reference to latest swagger for Runbook Cmdlets (#20803)
sushil490023 Feb 6, 2023
563a918
{AzureDataShare} fixes Azure/azure-powershell#20822 fix the descripti…
navba-MSFT Feb 6, 2023
c21cc3f
{AzureSubscription} fixes Azure/azure-powershell#20812 fix the worklo…
navba-MSFT Feb 6, 2023
7cb8173
release-2023-02-07
isra-fel Feb 6, 2023
88a2cc5
Fix daily smoke test error of ThreadJob installation (#20856)
msJinLei Feb 6, 2023
93a8895
Migrate DataMigration from generation to main (#20857)
azure-powershell-bot Feb 7, 2023
c663ad8
[Az.Automanage] Az.Automanage General Available (#20860)
BethanyZhou Feb 7, 2023
d6ba47d
[Storage] Fix help file format per static analysis result (#20774)
yifanz0 Feb 7, 2023
8afc22b
Bug : classic fw private ranges reverts to default when doing get & s…
Gizachew-Eshetie Feb 7, 2023
380bb09
added support for windows 2022 server for service fabric cluster (#20…
demodh Feb 8, 2023
ebe9037
OOB release for Az.Automation (#20874)
BethanyZhou Feb 8, 2023
d4fb1f6
Removed some of the run instances for the time being
vidai-msft Feb 8, 2023
64c1955
add pipeline yml for syncing fabricbot.json aliases (#20772)
greathongtu Feb 9, 2023
939205c
[Policy Insights] Added cmdlets for policy attestations (#20696)
samarthlakhotia Feb 9, 2023
cf2cba8
[Security] Update Security module based on .NET SDK track1, using sou…
yibirnba Feb 9, 2023
7ca311e
Fix ThreadJob installation error of smoke test (#20867)
msJinLei Feb 9, 2023
e723880
Fix unexpected recommendation message (#20880)
isra-fel Feb 9, 2023
e55bf29
Update Azure.Core from 1.25.0 to 1.28.0 (#20889)
isra-fel Feb 10, 2023
d4510cc
updata some old moudle metadata json file (#20892)
greathongtu Feb 10, 2023
0587ef1
Merge remote-tracking branch 'upstream/shared/livetest' into shared/l…
vidai-msft Feb 10, 2023
5672de1
Enabled debug log and added more debug info to Aks live test
vidai-msft Feb 10, 2023
e2ed802
[DataFactory]Updated ADF .Net SDK version to 9.1.0 (#20875)
Jingshu923 Feb 10, 2023
2577567
Service Client Code generation for Redis Cache RP (#20894)
rohanand-MS Feb 10, 2023
a317e63
Change sync alias.yml (#20899)
greathongtu Feb 10, 2023
97176e9
Correct help docs for *-AzCosmosDBAccount (#20891)
BethanyZhou Feb 10, 2023
58aa75d
Sync fabricbot.json (#20831)
azure-powershell-bot Feb 13, 2023
565c798
[Az.DataMigration] Change Azure Database Migration Service in documen…
ash1625 Feb 13, 2023
e28579e
Corrected syntax for ConfirmAction (#20902)
brettmillerb Feb 13, 2023
d67d180
Update New-AzSynapseRoleAssignment.md (#20905)
meenalsri Feb 13, 2023
33f2ffe
Update Remove-AzSynapseRoleAssignment.md (#20906)
meenalsri Feb 13, 2023
7c0057c
Added note for scenario when an SPN role assignment is listed (#20907)
meenalsri Feb 13, 2023
ddf4080
Use pwsh7.2.8 temporarily till 7.2.10 is available (#20911)
BethanyZhou Feb 13, 2023
4d1b136
Fix the issue that CI doesn't check online version of help doc (#20901)
wyunchi-ms Feb 13, 2023
80470b8
Snat cmdlet fwp (#20854)
Gizachew-Eshetie Feb 14, 2023
f44cad1
OOB of Az.ConnectedKubernetes (#20904)
Nickcandy Feb 14, 2023
488facc
Merge remote-tracking branch 'upstream/main' into shared/livetest
vidai-msft Feb 14, 2023
d366972
Merge remote-tracking branch 'upstream/shared/livetest' into shared/l…
vidai-msft Feb 15, 2023
9518e59
Merge remote-tracking branch 'upstream/shared/livetest' into shared/l…
vidai-msft Feb 19, 2023
c0ebc5f
Added live test cases for KeyVault and Compute
vidai-msft Feb 19, 2023
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
70 changes: 69 additions & 1 deletion src/Compute/Compute.Test/LiveTests/TestLiveScenarios.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,76 @@ Invoke-LiveTestScenario -Name "Removes a virtual machine from Azure" -Descriptio
$userData = [Convert]::ToBase64String($bytes);

New-AzVM -ResourceGroupName $rgName -Name $name -Credential $Credential -DomainNameLabel $domainNameLabel -UserData $userData;
Remove-AzVM -ResourceGroupName $rgName -Name $name -Force
Remove-AzVM -ResourceGroupName $rgName -Name $name -Force

$removedVM = Get-AzVM -ResourceGroupName $rgName -Name $name -ErrorAction SilentlyContinue
Assert-Null $removedVM
}

Invoke-LiveTestScenario -Name "Create a managed disk" -Description "Test creating a managed disk" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$diskName = New-LiveTestResourceName
$diskLocation = "westus"
$diskSize = 10
$diskSkuName = "Standard_LRS"

$diskCfg = New-AzDiskConfig -Location $diskLocation -DiskSizeGB $diskSize -SkuName $diskSkuName -OsType Windows -CreateOption Empty
New-AzDisk -ResourceGroupName $rgName -DiskName $diskName -Disk $diskCfg | Out-Null
$actual = Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName
Assert-NotNull $actual
Assert-AreEqual $rgName $actual.ResourceGroupName
Assert-AreEqual $diskName $actual.Name
Assert-AreEqual $diskLocation $actual.Location
Assert-AreEqual $diskSize $actual.DiskSizeGB
Assert-AreEqual $diskSkuName $actual.Sku.Name
Assert-AreEqual Windows $actual.OsType
}

Invoke-LiveTestScenario -Name "Update a managed disk" -Description "Test updating an existing managed disk" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$diskName = New-LiveTestResourceName
$diskLocation = "westus"
$diskSize = 10
$diskSizeUpdated = 20
$diskSkuName = "Standard_LRS"
$diskSkuNameUpdated = "StandardSSD_LRS"

$diskCfg = New-AzDiskConfig -Location $diskLocation -DiskSizeGB $diskSize -SkuName $diskSkuName -OsType Windows -CreateOption Empty
New-AzDisk -ResourceGroupName $rgName -DiskName $diskName -Disk $diskCfg

$disk = Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName
$disk.DiskSizeGB = $diskSizeUpdated
Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName -Disk $disk

$diskUpdateCfg = New-AzDiskUpdateConfig -SkuName $diskSkuNameUpdated
Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName -DiskUpdate $diskUpdateCfg

$actual = Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName
Assert-NotNull $actual
Assert-AreEqual $diskSizeUpdated $actual.DiskSizeGB
Assert-AreEqual $diskSkuNameUpdated $actual.Sku.Name
}

Invoke-LiveTestScenario -Name "Remove a managed disk" -Description "Test removing an existing managed disk" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$diskName = New-LiveTestResourceName
$diskLocation = "westus"
$diskSize = 10
$diskSkuName = "Standard_LRS"

$diskCfg = New-AzDiskConfig -Location $diskLocation -DiskSizeGB $diskSize -SkuName $diskSkuName -OsType Windows -CreateOption Empty
New-AzDisk -ResourceGroupName $rgName -DiskName $diskName -Disk $diskCfg
Remove-AzDisk -ResourceGroupName $rgName -DiskName $diskName -Force

$actual = Get-AzDisk -ResourceGroupName $rgName -DiskName $diskName -ErrorAction SilentlyContinue
Assert-Null $actual
}
134 changes: 132 additions & 2 deletions src/KeyVault/KeyVault.Test/LiveTests/TestLiveScenarios.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Invoke-LiveTestScenario -Name "Create new standard key vault" -Description "Test
$vaultName = New-LiveTestResourceName
$vaultLocation = "westus"

$actual = New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
$actual = Get-AzKeyVault -ResourceGroupName $rgName -VaultName $vaultName
Assert-AreEqual $vaultName $actual.VaultName
Assert-AreEqual $rgName $actual.ResourceGroupName
Assert-AreEqual $vaultLocation $actual.Location
Expand All @@ -26,7 +27,8 @@ Invoke-LiveTestScenario -Name "Create new premium key vault" -Description "Test
$vaultName = New-LiveTestResourceName
$vaultLocation = "eastus"

$actual = New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation -Sku premium -EnabledForDeployment
New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation -Sku premium -EnabledForDeployment
$actual = Get-AzKeyVault -ResourceGroupName $rgName -VaultName $vaultName
Assert-AreEqual $vaultName $actual.VaultName
Assert-AreEqual $rgName $actual.ResourceGroupName
Assert-AreEqual $vaultLocation $actual.Location
Expand Down Expand Up @@ -76,3 +78,131 @@ Invoke-LiveTestScenario -Name "Delete key vault" -Description "Test deleting key
# purge deleted vault
Remove-AzKeyVault -VaultName $vaultName -Location $vaultLocation -InRemovedState -Force
}

Invoke-LiveTestScenario -Name "Create key vault secret" -Description "Test creating a key vault secret" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$vaultName = New-LiveTestResourceName
$vaultLocation = "eastus"
$secretName = New-LiveTestResourceName

New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
$sp = Get-AzADServicePrincipal -ApplicationId (Get-AzContext).Account.Id
$objectId = $sp.Id
Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectId $objectId -PermissionsToSecrets get, set, list

$secretValue = ConvertTo-SecureString -String 'Password' -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -SecretValue $secretValue

$actual = Get-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -ErrorAction SilentlyContinue
Assert-NotNull $actual
Assert-AreEqual $vaultName $actual.VaultName
Assert-AreEqual $secretName $actual.Name
}

Invoke-LiveTestScenario -Name "Create key vault secret with multi-versions" -Description "Test creating a key vault secret with multiple versions" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$vaultName = New-LiveTestResourceName
$vaultLocation = "westus"
$secretName = New-LiveTestResourceName

New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
$sp = Get-AzADServicePrincipal -ApplicationId (Get-AzContext).Account.Id
$objectId = $sp.Id
Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectId $objectId -PermissionsToSecrets get, set, list

$secretValue = ConvertTo-SecureString -String 'Password' -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -SecretValue $secretValue
Set-AzKeyVaultSecret -VaultName $vaultName -name $secretName -SecretValue $secretValue

$actual = Get-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -IncludeVersions -ErrorAction SilentlyContinue
Assert-NotNull $actual
Assert-AreEqual 2 $actual.Count
}

Invoke-LiveTestScenario -Name "Update key vault secret attributes" -Description "Test updating attributes of a key vault secret" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$vaultName = New-LiveTestResourceName
$vaultLocation = "westus"
$secretName = New-LiveTestResourceName

New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
$sp = Get-AzADServicePrincipal -ApplicationId (Get-AzContext).Account.Id
$objectId = $sp.Id
Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectId $objectId -PermissionsToSecrets get, set, list

$secretValue = ConvertTo-SecureString -String 'Password' -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -SecretValue $secretValue

$exp = (Get-Date).AddYears(1).ToUniversalTime()
$nbf = (Get-Date).ToUniversalTime()
$ctp= "text"
$tags = @{ "Severity" = "low" }
Update-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -NotBefore $nbf -Expires $exp -ContentType $ctp -Tag $tags -Enable $true

$actual = Get-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -ErrorAction SilentlyContinue
Assert-NotNull $actual
Assert-AreEqual $true $actual.Enabled
Assert-AreEqual $ctp $actual.ContentType
}

Invoke-LiveTestScenario -Name "Remove key vault secret" -Description "Test removing a key vault secret" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$vaultName = New-LiveTestResourceName
$vaultLocation = "eastus"
$secretName = New-LiveTestResourceName

New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
$sp = Get-AzADServicePrincipal -ApplicationId (Get-AzContext).Account.Id
$objectId = $sp.Id
Set-AzKeyVaultAccessPolicy -VaultName $vaultName -ObjectId $objectId -PermissionsToSecrets get, set, list, delete

$secretValue = ConvertTo-SecureString -String 'Password' -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -SecretValue $secretValue

Remove-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -Force

$actual = Get-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -ErrorAction SilentlyContinue
Assert-Null $actual
}

Invoke-LiveTestScenario -Name "Backup and restore key vault secret" -Description "Test backing up and restoring a key vault secret" -ScenarioScript `
{
param ($rg)

$rgName = $rg.ResourceGroupName
$vaultName1 = New-LiveTestResourceName
$vaultName2 = New-LiveTestResourceName
$vaultLocation = "eastus"
$secretName = New-LiveTestResourceName

New-AzKeyVault -VaultName $vaultName1 -ResourceGroupName $rgName -Location $vaultLocation
New-AzKeyVault -VaultName $vaultName2 -ResourceGroupName $rgName -Location $vaultLocation
$sp = Get-AzADServicePrincipal -ApplicationId (Get-AzContext).Account.Id
$objectId = $sp.Id
Set-AzKeyVaultAccessPolicy -VaultName $vaultName1 -ObjectId $objectId -PermissionsToSecrets get, set, list, backup
Set-AzKeyVaultAccessPolicy -VaultName $vaultName2 -ObjectId $objectId -PermissionsToSecrets get, set, list, restore

$secretValue = ConvertTo-SecureString -String 'Password' -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $vaultName1 -Name $secretName -SecretValue $secretValue

Backup-AzKeyVaultSecret -VaultName $vaultName1 -Name $secretName -OutputFile "SecretBackup.blob" -Force

Restore-AzKeyVaultSecret -VaultName $vaultName2 -InputFile "SecretBackup.blob"

$actual = Get-AzKeyVaultSecret -VaultName $vaultName2 -Name $secretName -ErrorAction SilentlyContinue
Assert-NotNull $actual
Assert-AreEqual $vaultName2 $actual.VaultName
Assert-AreEqual $secretName $actual.Name
}