Skip to content

Commit

Permalink
[EventHub]: Deprecating MSI properties for breaking change release (#…
Browse files Browse the repository at this point in the history
…18031)

* Deprecating MSI properties

* Push Recordings

* Fixes

* Fixes

* fixes

* Update BreakingChangeIssues.csv

* Update BreakingChangeIssues.csv

* Update BreakingChangeIssues.csv

* Update BreakingChangeIssues.csv

* fix

* Pushing recording
  • Loading branch information
damodaravadhani authored May 16, 2022
1 parent 4597e1b commit b4d3d17
Show file tree
Hide file tree
Showing 27 changed files with 8,407 additions and 14,992 deletions.
4 changes: 2 additions & 2 deletions src/EventHub/EventHub.Test/ScenarioTests/Namespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public void NamespaceAuthorizationRulesCRUD()
TestRunner.RunTestScript("NamespaceAuthTests");
}

[Fact(Skip = "Skip as current test framework does not support recording generated cmdlets.")]
[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
public void MSIEncryptionTest()
{
TestRunner.RunTestScript("EncryptionTest");
}

[Fact(Skip = "Skip as current test framework does not support recording generated cmdlets.")]
[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
public void MSITest()
{
Expand Down
34 changes: 0 additions & 34 deletions src/EventHub/EventHub.Test/ScenarioTests/NamespaceBYOK.cs

This file was deleted.

105 changes: 0 additions & 105 deletions src/EventHub/EventHub.Test/ScenarioTests/NamespaceBYOKTests.ps1

This file was deleted.

46 changes: 23 additions & 23 deletions src/EventHub/EventHub.Test/ScenarioTests/NamespaceTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function NamespaceTests
Assert-AreEqual $result.Sku.Name "Premium" "Namespace Premium"


$result = Set-AzEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName3 -Identity -Location $location
$result = Set-AzEventHubNamespace -ResourceGroup $resourceGroupName -Name $namespaceName3 -IdentityType "SystemAssigned" -Location $location
Assert-AreEqual $result.ResourceGroup $resourceGroupName "Namespace create : ResourceGroup name matches"
Assert-AreEqual $result.ResourceGroupName $resourceGroupName "Namespace create : ResourceGroupName name matches"
Assert-True { $result.DisableLocalAuth }
Expand Down Expand Up @@ -286,10 +286,10 @@ function NamespaceTests
#Assert
Assert-True {$allCreatedNamespace.Count -ge 0 } "Namespace created earlier is not found. in list"

Write-Debug "Get all the namespaces created in the subscription"
$allCreatedNamespace = Get-AzEventHubNamespace
#Write-Debug "Get all the namespaces created in the subscription"
#$allCreatedNamespace = Get-AzEventHubNamespace

Assert-True {$allCreatedNamespace.Count -ge 0} "Namespaces created earlier is not found."
#Assert-True {$allCreatedNamespace.Count -ge 0} "Namespaces created earlier is not found."

Write-Debug " Delete namespaces"
Remove-AzEventHubNamespace -ResourceGroup $secondResourceGroup -Name $namespaceName2
Expand Down Expand Up @@ -406,11 +406,11 @@ function MSITest{
$namespace2 = getAssetName "Namespace2-"
try{

$uad1 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi1
$uad2 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi2
$uad3 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi3
$uad1 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI1"
$uad2 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI2"
$uad3 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI3"

$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -SkuName Standard -Location northeurope
$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -SkuName Standard -Location eastus
Assert-AreEqual $namespace.Name $namespace1
Assert-AreEqual $namespace.Sku.Name "Standard"

Expand All @@ -419,19 +419,19 @@ function MSITest{
Assert-AreEqual $namespace.Sku.Name "Standard"
Assert-AreEqual $namespace.IdentityType "SystemAssigned"

$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "UserAssigned" -IdentityId $uad1.Id,$uad2.Id
$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "UserAssigned" -IdentityId $uad1,$uad2
Assert-AreEqual $namespace.Name $namespace1
Assert-AreEqual $namespace.Sku.Name "Standard"
Assert-AreEqual $namespace.IdentityType "UserAssigned"
Assert-True { $namespace.IdentityId.Count -eq 2 }

$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "SystemAssigned, UserAssigned" -IdentityId $uad1.Id,$uad2.Id
$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "SystemAssigned, UserAssigned"
Assert-AreEqual $namespace.Name $namespace1
Assert-AreEqual $namespace.Sku.Name "Standard"
Assert-AreEqual $namespace.IdentityType "SystemAssignedUserAssigned"
Assert-True { $namespace.IdentityId.Count -eq 2 }

$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "None"
$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -IdentityType "None" -IdentityId @()
Assert-AreEqual $namespace.Name $namespace1
Assert-AreEqual $namespace.Sku.Name "Standard"
Assert-Null $namespace.Identity
Expand All @@ -447,18 +447,18 @@ function EncryptionTest{
$msi1 = "PS-Testing-MSI1"
$msi2 = "PS-Testing-MSI2"
$msi3 = "PS-Testing-MSI3"
$kv1 = "PS-Testing-kv1"
$kv2 = "PS-Testing-kv2"
$kv1uri = "https://ps-testing-kv1.vault.azure.net/"
$kv2uri = "https://ps-testing-kv2.vault.azure.net"
$kv1 = "PS-Test-kv1"
$kv2 = "PS-Test-kv2"
$kv1uri = "https://ps-test-kv1.vault.azure.net/"
$kv2uri = "https://ps-test-kv2.vault.azure.net"
$namespace1 = getAssetName "Namespace1-"
$namespace2 = getAssetName "Namespace2-"

$uad1 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi1
$uad2 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi2
$uad3 = Get-AzUserAssignedIdentity -ResourceGroupName $resourceGroupName -Name $msi3
$uad1 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI1"
$uad2 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI2"
$uad3 = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourceGroups/PS-Testing/providers/Microsoft.ManagedIdentity/userAssignedIdentities/PS-Testing-MSI3"

$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace2 -SkuName Premium -Location northeurope -IdentityType SystemAssigned
$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace2 -SkuName Premium -Location eastus -IdentityType SystemAssigned
Assert-AreEqual $namespace.Name $namespace2
Assert-AreEqual $namespace.Sku.Name "Premium"
Assert-AreEqual $namespace.IdentityType "SystemAssigned"
Expand All @@ -474,17 +474,17 @@ function EncryptionTest{
Assert-AreEqual $namespace.IdentityType "SystemAssigned"
Assert-True { $namespace.EncryptionConfig.Count -eq 2 }

$ec1 = New-AzEventHubEncryptionConfig -KeyName key1 -KeyVaultUri $kv1uri -UserAssignedIdentity $uad1.Id
$ec2 = New-AzEventHubEncryptionConfig -KeyName key2 -KeyVaultUri $kv1uri -UserAssignedIdentity $uad1.Id
$ec1 = New-AzEventHubEncryptionConfig -KeyName key1 -KeyVaultUri $kv1uri -UserAssignedIdentity $uad1
$ec2 = New-AzEventHubEncryptionConfig -KeyName key2 -KeyVaultUri $kv1uri -UserAssignedIdentity $uad1

$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -SkuName Premium -Location northeurope -IdentityType UserAssigned -IdentityId $uad1.Id,$uad2.Id -EncryptionConfig $ec1,$ec2
$namespace = New-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -SkuName Premium -Location northeurope -IdentityType UserAssigned -IdentityId $uad1,$uad2 -EncryptionConfig $ec1,$ec2
Assert-AreEqual $namespace.Name $namespace1
Assert-AreEqual $namespace.Sku.Name "Premium"
Assert-AreEqual $namespace.IdentityType "UserAssigned"
Assert-True { $namespace.IdentityId.Count -eq 2 }
Assert-True { $namespace.EncryptionConfig.Count -eq 2 }

$ec3 = New-AzEventHubEncryptionConfig -KeyName key1 -KeyVaultUri $kv2uri -UserAssignedIdentity $uad1.id
$ec3 = New-AzEventHubEncryptionConfig -KeyName key1 -KeyVaultUri $kv2uri -UserAssignedIdentity $uad1
$namespace.EncryptionConfig += $ec3

$namespace = Set-AzEventHubNamespace -ResourceGroupName $resourceGroupName -Name $namespace1 -EncryptionConfig $namespace.EncryptionConfig -Location northeurope
Expand Down
Loading

0 comments on commit b4d3d17

Please sign in to comment.