Skip to content

Commit d62b9d8

Browse files
authored
Merge branch 'main' into codegen/Compute
2 parents 6c8d2f3 + c414be6 commit d62b9d8

File tree

42 files changed

+13723
-12814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13723
-12814
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="59.0.0" />
15+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="60.0.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="4.0.0-preview.1" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="25.0.0" />
1818
</ItemGroup>

src/Compute/Compute.Test/ScenarioTests/ComputeTestCommon.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Gets default CRP Image
473473
#>
474474
function Get-DefaultCRPImage
475475
{
476-
param([string] $loc = "westus", [string] $query = '*Microsoft*Windows*Server*')
476+
param([string] $loc = "westus", [string] $query = '*Microsoft*Windows*Server*', [bool] $New = $False)
477477

478478
$result = (Get-AzVMImagePublisher -Location $loc) | select -ExpandProperty PublisherName | where { $_ -like $query };
479479
if ($result.Count -eq 1)
@@ -495,7 +495,12 @@ function Get-DefaultCRPImage
495495
$defaultOffer = $result[0];
496496
}
497497

498-
$result = (Get-AzVMImageSku -Location $loc -PublisherName $defaultPublisher -Offer $defaultOffer) | select -ExpandProperty Skus;
498+
if ($New -eq $True){
499+
$result = (Get-AzVMImageSku -Location $loc -PublisherName $defaultPublisher -Offer $defaultOffer) | select -ExpandProperty Skus| where { $_ -like '*2022-datacenter*'};
500+
}
501+
else {
502+
$result = (Get-AzVMImageSku -Location $loc -PublisherName $defaultPublisher -Offer $defaultOffer) | select -ExpandProperty Skus;
503+
}
499504
if ($result.Count -eq 1)
500505
{
501506
$defaultSku = $result;
@@ -517,6 +522,7 @@ function Get-DefaultCRPImage
517522

518523
$vmimg = Get-AzVMImage -Location $loc -Offer $defaultOffer -PublisherName $defaultPublisher -Skus $defaultSku -Version $defaultVersion;
519524

525+
520526
return $vmimg;
521527
}
522528

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ function Test-GalleryImageVersion
472472
$maxVCPU = 32;
473473
$purchasePlanName = "purchasePlanName";
474474
$purchasePlanProduct = "purchasePlanProduct";
475-
$purchasePlanPublisher = "";
475+
$purchasePlanPublisher = "20";
476476
$osState = "Generalized";
477477
$osType = "Windows";
478478

@@ -502,7 +502,7 @@ function Test-GalleryImageVersion
502502
$galleryImageVersionName = "1.0.0";
503503

504504
# Create a VM first
505-
$vmsize = 'Standard_A4';
505+
$vmsize = 'Standard_A2_v2';
506506
$vmname = 'vm' + $rgname;
507507
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
508508
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;
@@ -548,7 +548,7 @@ function Test-GalleryImageVersion
548548
# $p.StorageProfile.OSDisk = $null;
549549
$p = Set-AzVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
550550

551-
$imgRef = Get-DefaultCRPImage -loc $loc;
551+
$imgRef = Get-DefaultCRPImage -loc $loc -New $True;
552552
$p = ($imgRef | Set-AzVMSourceImage -VM $p);
553553

554554
# Virtual Machine
@@ -565,26 +565,37 @@ function Test-GalleryImageVersion
565565
$targetRegions = @(@{Name='South Central US';ReplicaCount=1;StorageAccountType='Standard_LRS'},@{Name='East US';ReplicaCount=2},@{Name='Central US'});
566566
$tag = @{test1 = "testval1"; test2 = "testval2" };
567567

568+
# Set TargetExtendedLocation
569+
$storageAccountType = "Standard_LRS"
570+
$extendedLocation = @{Name = 'microsoftlosangeles1';Type='EdgeZone'}
571+
$edgezone_losangeles = @{Location = "westus";ExtendedLocation=$extendedLocation;ReplicaCount = 3;StorageAccountType = 'StandardSSD_LRS'}
572+
$targetExtendedLocations = @($edgezone_losangeles)
573+
568574
New-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
569575
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName `
570576
-Location $loc -SourceImageId $image.Id -ReplicaCount 1 `
571577
-PublishingProfileEndOfLifeDate $endOfLifeDate `
572578
-StorageAccountType Standard_LRS `
573-
-TargetRegion $targetRegions;
579+
-TargetRegion $targetRegions -TargetExtendedLocation $targetExtendedLocations;
574580

581+
# Check TargetExtendedLocation
575582
$version = Get-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
576583
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName;
577584
Verify-GalleryImageVersion $version $rgname $galleryImageVersionName $loc `
578585
$image.Id 1 $endOfLifeDate $targetRegions;
586+
Assert-AreEqual $version.PublishingProfile.TargetExtendedLocations.count 1
579587

588+
# remove TargetExtendedLocation
580589
Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
581590
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName `
582-
-Tag $tag;
591+
-Tag $tag -TargetExtendedLocation @() -AllowDeletionOfReplicatedLocation $True;
583592

584593
$version = Get-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
585594
-GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName;
586595
Verify-GalleryImageVersion $version $rgname $galleryImageVersionName $loc `
587-
$image.Id 1 $endOfLifeDate $targetRegions;
596+
$image.Id 1 $endOfLifeDate $targetRegions
597+
# check TargetExtendedLocation count
598+
Assert-AreEqual $version.PublishingProfile.TargetExtendedLocations.count 0
588599

589600
$version | Remove-AzGalleryImageVersion -Force;
590601
Wait-Seconds 300;

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.GalleryTests/GalleryImageVersion.json

Lines changed: 1937 additions & 3908 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
* Updated Compute PS to use the new .Net SDK version 59.0.0. This includes an approved breaking change for a non-functional feature.
2727
- The type of the property `Source` of type `Microsoft.Azure.Management.Compute.Models.GalleryDataDiskImage`, `Microsoft.Azure.Management.Compute.Models.GalleryOSDiskImage`, and `Microsoft.Azure.Management.Compute.Models.GalleryImageVersionStorageProfile` has changed from `Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource` to `Microsoft.Azure.Management.Compute.Models.GalleryDiskImageSource`.
2828
* Updated Set-AzVMRunCommand and Set-AzVmssRunCommand ScriptLocalPath parameter set to work with Linux and with files that have comments.
29+
* Added `-TargetExtendedLocation` parameter to `New-AzGalleryImageVersion` and `Update-AzGalleryImageVersion`
30+
* Added `-AllowDeletionOfReplicatedLocation` to `Update-AzGalleryImageVersion`
2931

3032
## Version 5.3.0
3133
* Removed the image `Win2008R2SP1` from the list of available images and documentation. This image is no longer available on the backend so the client tools need to sync to that change.

src/Compute/Compute/Compute.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<ItemGroup>
1616
<PackageReference Include="Microsoft.Azure.PowerShell.AutoMapper" Version="6.2.2" />
1717
<PackageReference Include="Microsoft.Azure.Management.ResourceGraph" Version="2.1.0" />
18-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="59.0.0" />
18+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="60.0.0" />
1919
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
2020
<PackageReference Include="System.ServiceModel.Primitives" Version="4.7.0" />
2121
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />

0 commit comments

Comments
 (0)