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

SIG direct sharing #17439

Merged
merged 19 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/Compute/Compute.Test/Compute.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="52.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="54.0.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="4.0.0-preview.1" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="21.0.0" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/GalleryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ public void TestGalleryImageVersionDiskImage()
{
TestRunner.RunTestScript("Test-GalleryImageVersionDiskImage");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGalleryDirectSharing()
{
TestRunner.RunTestScript("Test-GalleryDirectSharing");
}
}
}
45 changes: 45 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/GalleryTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -709,3 +709,48 @@ function Test-GalleryImageVersionDiskImage
Clean-ResourceGroup $rgname
}
}

function Test-GalleryDirectSharing
{
# Setup
$rgname = Get-ComputeTestResourceName;
$galleryName = 'gallery' + $rgname;

try
{
$loc = 'eastus'
New-AzResourceGroup -Name $rgname -Location $loc -Force;

# create gallery with permissions groups
New-AzGallery -ResourceGroupName $rgname -Location $loc -Name $galleryName -Permission 'Groups'

# get that gallery check for SharingProfile
$gal = Get-AzGallery -ResourceGroupName $rgname -Name $galleryName -Expand 'SharingProfile/Groups'
Assert-AreEqual $gal.sharingProfile.Permissions 'Groups'

# Add 2 subscriptions to share with
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Permission 'Groups' -Share -Subscription '88fd8cb2-8248-499e-9a2d-4929a4b0133c','54b875cc-a81a-4914-8bfd-1a36bc7ddf4d'

# check
Assert-AreEqual $gal.SharingProfile.Groups[0].Type 'Subscriptions'
Assert-AreEqual $gal.SharingProfile.Groups[0].Ids.count 2

# remove 1
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Permission 'Groups' -Share -RemoveSubscription '88fd8cb2-8248-499e-9a2d-4929a4b0133c'

# check
Assert-AreEqual $gal.SharingProfile.Groups[0].Type 'Subscriptions'
Assert-AreEqual $gal.SharingProfile.Groups[0].Ids.count 1

# Reset that gallery
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Share -Reset

# check
Assert-AreEqual $gal.SharingProfile.Permissions 'Private'
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading