Skip to content

Commit 5421326

Browse files
SIG direct sharing (#17439)
* updated * update * update * help doc and test * updated * update * update * help doc and test * merge * update * all * update test * add * update changelog * update changelog * Update RecoveryServices.Backup.Test.csproj
1 parent 852ba4e commit 5421326

31 files changed

+3176
-24
lines changed

src/Compute/Compute.Test/Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
15-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="52.0.0" />
15+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="54.0.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="4.0.0-preview.1" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="21.0.0" />
1818
</ItemGroup>

src/Compute/Compute.Test/ScenarioTests/GalleryTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,11 @@ public void TestGalleryImageVersionDiskImage()
5151
{
5252
TestRunner.RunTestScript("Test-GalleryImageVersionDiskImage");
5353
}
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void TestGalleryDirectSharing()
57+
{
58+
TestRunner.RunTestScript("Test-GalleryDirectSharing");
59+
}
5460
}
5561
}

src/Compute/Compute.Test/ScenarioTests/GalleryTests.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,3 +709,48 @@ function Test-GalleryImageVersionDiskImage
709709
Clean-ResourceGroup $rgname
710710
}
711711
}
712+
713+
function Test-GalleryDirectSharing
714+
{
715+
# Setup
716+
$rgname = Get-ComputeTestResourceName;
717+
$galleryName = 'gallery' + $rgname;
718+
719+
try
720+
{
721+
$loc = 'eastus'
722+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
723+
724+
# create gallery with permissions groups
725+
New-AzGallery -ResourceGroupName $rgname -Location $loc -Name $galleryName -Permission 'Groups'
726+
727+
# get that gallery check for SharingProfile
728+
$gal = Get-AzGallery -ResourceGroupName $rgname -Name $galleryName -Expand 'SharingProfile/Groups'
729+
Assert-AreEqual $gal.sharingProfile.Permissions 'Groups'
730+
731+
# Add 2 subscriptions to share with
732+
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Permission 'Groups' -Share -Subscription '88fd8cb2-8248-499e-9a2d-4929a4b0133c','54b875cc-a81a-4914-8bfd-1a36bc7ddf4d'
733+
734+
# check
735+
Assert-AreEqual $gal.SharingProfile.Groups[0].Type 'Subscriptions'
736+
Assert-AreEqual $gal.SharingProfile.Groups[0].Ids.count 2
737+
738+
# remove 1
739+
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Permission 'Groups' -Share -RemoveSubscription '88fd8cb2-8248-499e-9a2d-4929a4b0133c'
740+
741+
# check
742+
Assert-AreEqual $gal.SharingProfile.Groups[0].Type 'Subscriptions'
743+
Assert-AreEqual $gal.SharingProfile.Groups[0].Ids.count 1
744+
745+
# Reset that gallery
746+
$gal = Update-AzGallery -ResourceGroupName $rgname -Name $galleryName -Share -Reset
747+
748+
# check
749+
Assert-AreEqual $gal.SharingProfile.Permissions 'Private'
750+
}
751+
finally
752+
{
753+
# Cleanup
754+
Clean-ResourceGroup $rgname
755+
}
756+
}

0 commit comments

Comments
 (0)