Skip to content

Commit

Permalink
Merge pull request #26048 from yifanz7/merge
Browse files Browse the repository at this point in the history
[Storage] [Do Not Squash] Merge recent changes from main to Az.Storage-preview
  • Loading branch information
msJinLei authored Sep 10, 2024
2 parents 6a72411 + f423d3d commit e400f97
Show file tree
Hide file tree
Showing 2,395 changed files with 310,697 additions and 191,352 deletions.
27 changes: 21 additions & 6 deletions .azure-pipelines/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ jobs:
custom: msbuild
arguments: 'build.proj /t:Build /p:Configuration=Release;TurnOnTestCoverage=true;ModifiedModuleBuild=true'

- task: EsrpCodeSigning@4
- task: EsrpCodeSigning@5
displayName: "Sign Dll [Authenticode + Strong Name]"
inputs:
ConnectedServiceName: '$(signServiceConnection)'
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: 'artifacts'
Pattern: |
Release/**/Microsoft*Azure*PowerShell*.dll
Expand Down Expand Up @@ -128,10 +133,15 @@ jobs:
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@4
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign Scripts [Authenticode]"
inputs:
ConnectedServiceName: '$(signServiceConnection)'
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: 'artifacts'
Pattern: |
Release/**/*.ps1
Expand Down Expand Up @@ -164,10 +174,15 @@ jobs:
"ToolVersion": "1.0"
}
]
- task: EsrpCodeSigning@4
- task: EsrpCodeSigning@5
displayName: 'Sign 3rd Party [Strong Name]'
inputs:
ConnectedServiceName: '$(signServiceConnection)'
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: artifacts
Pattern: 'Release/**/FuzzySharp.dll'
UseMinimatch: true
Expand Down
67 changes: 66 additions & 1 deletion .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,22 @@ configuration:
- sgellock
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
label: Service Attention
- labelAdded:
label: Cloud Service (Ext)
- hasLabel:
label: Service Attention
- hasLabel:
label: Cloud Service (Ext)
then:
- mentionUsers:
mentionees:
- hirenshah1
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
Expand Down Expand Up @@ -1026,6 +1042,22 @@ configuration:
- swmachan
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
label: Service Attention
- labelAdded:
label: Cognitive Services
- hasLabel:
label: Service Attention
- hasLabel:
label: Cognitive Services
then:
- mentionUsers:
mentionees:
- gxy001
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
Expand Down Expand Up @@ -1599,7 +1631,6 @@ configuration:
mentionees:
- edwinc
- mvvsubbu
- v-vyedavelly
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
Expand Down Expand Up @@ -2370,6 +2401,23 @@ configuration:
- Lighthouse-Azure
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
label: Service Attention
- labelAdded:
label: Management Groups
- hasLabel:
label: Service Attention
- hasLabel:
label: Management Groups
then:
- mentionUsers:
mentionees:
- rthorn17
- cemheren
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
Expand Down Expand Up @@ -3374,6 +3422,23 @@ configuration:
- ricardo-espinoza
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
label: Service Attention
- labelAdded:
label: Quota
- hasLabel:
label: Service Attention
- hasLabel:
label: Quota
then:
- mentionUsers:
mentionees:
- rahuls-microsoft
- devatula
replyTemplate: Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}.
assignMentionees: False
- if:
- or:
- labelAdded:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,32 @@ We are recommended to use string array as the type of UserAssignedIdentity with
- No syntax changes if service supports one more user assigned identity in future;
- Service will provide correct error response if customer reaches the count limitation of `UserAssignedIdentity` ideally, which means no harm.

### How to disable transforming IdentityType and UserAssignedIdentity to avoid breaking changes when migrate from autorest.powershell v3 to v4.
See details at [here](https://github.com/Azure/autorest.powershell/blob/main/docs/migration-from-v3-to-v4.md#how-to-mitigate-the-breaking-changes-of-managed-identity-best-practice-alignment).

### What should I do to mitigate one patch operation which is reported to parameter IdentityType can not be transformed as the best practice design?

autorest.powershell is unable to transform IdentityType as the best practice design for certain reasons. To mitigate this issue,
- Include a customization script to transform the parameter IdentityType to EnableSystemAssignedIdentity by `get` + `patch` update for this type of operation. The following are the detailed steps on how to accomplish this.
- disable transformation for the operation which reported error in README.md by
```
disable-transform-identity-type-for-operation
- Operation_id
```
- hide the corresponding Update cmdlet in directive by
```
- where:
verb: Update
subject: {Subject-Name}
hide: true
```
- run `autorest` and `./build-module.ps1`
- manually change IdentityType to EnableSystemAssignedIdentity<bool> in `Update-Az{ModuleName}{Subject-Name}` like
```
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.{ModuleName}.Category('Body')]
[System.Nullable[System.Boolean]]
# Decides if enable a system assigned identity for the resource.
${EnableSystemAssignedIdentity},
```
- calculate the value of IdentityType as swagger defined in process block, see [instance](https://github.com/Azure/azure-powershell/blob/827001c79c4416e0b74f5857c2ad72b7932b1f9a/src/Astro/Astro.Autorest/custom/Update-AzAstroOrganization.ps1#L269) for Update-Az{ModuleName}{Subject-Name}.
2 changes: 1 addition & 1 deletion documentation/migration-guides/Az.7.0.0-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ The `-DisplayName` parameter was removed.

#### Before
```powershell
PS C:\> New-AzManagedServicesDefinition -DisplayName "MyTestDefinition" -ManagedByTenantId 72f9acbf-86f1-41af-91ab-2d7ef011db47 -RoleDefinitionId acdd72a7-3385-48ef-bd42-f606fba81ae7 -PrincipalId 714160ec-87d5-42bb-8b17-287c0dd7417d
PS C:\> New-AzManagedServicesDefinition -DisplayName "MyTestDefinition" -ManagedByTenantId 00001111-aaaa-2222-bbbb-3333cccc4444 -RoleDefinitionId acdd72a7-3385-48ef-bd42-f606fba81ae7 -PrincipalId 714160ec-87d5-42bb-8b17-287c0dd7417d
```
#### After
```powershell
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ public void TestVirtualMachineScaleSetDefaultImgWhenStandard()
TestRunner.RunTestScript("Test-VirtualMachineScaleSetDefaultImgWhenStandard");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVirtualMachineScaleSetSkuProfile()
{
TestRunner.RunTestScript("Test-VirtualMachineScaleSetSkuProfile");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestResiliencyPolicyVMSS()
Expand Down
152 changes: 152 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5314,6 +5314,158 @@ function Test-VirtualMachineScaleSetDefaultImgWhenStandard
}
}

<#
.SYNOPSIS
Test Virtual Machine Scale Set with SkuProfile
#>
function Test-VirtualMachineScaleSetSkuProfile
{
# Setup
$rgname = Get-ComputeTestResourceName
$loc = Get-ComputeVMLocation;

# Basic case
try
{
# Common
New-AzResourceGroup -Name $rgname -Location $loc -Force;

$vmssName = 'vs' + $rgname;

$domainNameLabel1 = "d1" + $rgname;
$enable = $true;
$adminUsername = Get-ComputeTestResourceName;
$password = Get-PasswordForVM;
$adminPassword = $password | ConvertTo-SecureString -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);

$vmss = New-AzVmss -ResourceGroupName $rgname -Credential $cred -VMScaleSetName $vmssName -DomainNameLabel $domainNameLabel1 `
-VMSize "Mix" -SkuProfileVmSize @("Standard_D4s_v3", "Standard_D4s_v4");

Assert-AreEqual $vmss.OrchestrationMode "Flexible";
Assert-AreEqual $vmss.Sku.Name "Mix";
Assert-AreEqual $vmss.SkuProfile.AllocationStrategy "LowestPrice";
Assert-AreEqual $vmss.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmss.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}

# Changing allocation strategy
try
{
# Common
New-AzResourceGroup -Name $rgname -Location $loc -Force;

$vmssName = 'vs' + $rgname;

$domainNameLabel1 = "d1" + $rgname;
$enable = $true;
$adminUsername = Get-ComputeTestResourceName;
$password = Get-PasswordForVM;
$adminPassword = $password | ConvertTo-SecureString -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);

$vmss = New-AzVmss -ResourceGroupName $rgname -Credential $cred -VMScaleSetName $vmssName -DomainNameLabel $domainNameLabel1 `
-SkuProfileVmSize @("Standard_D4s_v3", "Standard_D4s_v4") -SkuProfileAllocationStrategy "CapacityOptimized";

Assert-AreEqual $vmss.OrchestrationMode "Flexible";
Assert-AreEqual $vmss.Sku.Name "Mix";
Assert-AreEqual $vmss.SkuProfile.AllocationStrategy "CapacityOptimized";
Assert-AreEqual $vmss.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmss.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}

# With azvmss config and update
try
{
# Common
New-AzResourceGroup -Name $rgname -Location $loc -Force;

$vmssName = 'vs' + $rgname;

$domainNameLabel1 = "d1" + $rgname;
$enable = $true;
$adminUsername = Get-ComputeTestResourceName;
$password = Get-PasswordForVM;
$adminPassword = $password | ConvertTo-SecureString -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);

$vmss = New-AzVmssConfig -Location $loc -Zone "1" -SkuCapacity 2 -SkuName 'Mix' -SkuProfileVmSize @("Standard_D4s_v3", "Standard_D4s_v4");

Assert-AreEqual $vmss.Sku.Name "Mix";
Assert-AreEqual $vmss.SkuProfile.AllocationStrategy "LowestPrice";
Assert-AreEqual $vmss.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmss.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";

$vmss = New-AzVmssConfig -Location $loc -Zone "1" -SkuCapacity 2 -SkuProfileVmSize @("Standard_D4s_v3", "Standard_D4s_v4") -SkuProfileAllocationStrategy "CapacityOptimized";

Assert-AreEqual $vmss.Sku.Name "Mix";
Assert-AreEqual $vmss.SkuProfile.AllocationStrategy "CapacityOptimized";
Assert-AreEqual $vmss.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmss.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";

$stnd = "Standard";
$ipName = Get-ComputeTestResourceName

# SRP
$stoname = 'sto' + $rgname;
$stotype = 'Standard_GRS';
New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
$stoaccount = Get-AzStorageAccount -ResourceGroupName $rgname -Name $stoname;

# NRP
$subnet = New-AzVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
$vnet = New-AzVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -Subnet $subnet;
$vnet = Get-AzVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
$subnetId = $vnet.Subnets[0].Id;

# New VMSS Parameters
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);

$imgRef = Get-DefaultCRPImage -loc $loc -New $True;
$ipCfg = New-AzVmssIPConfig -Name 'test' -SubnetId $subnetId -PublicIPAddressConfigurationName $ipName -PublicIPAddressConfigurationIdleTimeoutInMinutes 10 -DnsSetting "testvmssdnscom" -PublicIPAddressVersion "IPv4";

$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -UpgradePolicyMode 'Manual' -EncryptionAtHost -SecurityType $stnd -SkuProfileVmSize @("Standard_D4s_v3", "Standard_D4s_v4") -SkuProfileAllocationStrategy "CapacityOptimized"`
| Add-AzVmssNetworkInterfaceConfiguration -Name 'test' -Primary $true -IPConfiguration $ipCfg `
| Set-AzVmssOSProfile -ComputerNamePrefix 'test' -AdminUsername $adminUsername -AdminPassword $adminPassword `
| Set-AzVmssStorageProfile -OsDiskCreateOption 'FromImage' -OsDiskCaching 'None' `
-ImageReferenceOffer $imgRef.Offer -ImageReferenceSku $imgRef.Skus -ImageReferenceVersion 'latest' `
-ImageReferencePublisher $imgRef.PublisherName;

# creating new-azvmss using New-VmssConfig
$vmssResult = New-AzVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss

Assert-AreEqual $vmssResult.Sku.Name "Mix";
Assert-AreEqual $vmssResult.SkuProfile.AllocationStrategy "CapacityOptimized";
Assert-AreEqual $vmssResult.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmssResult.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";

# update vmss
$vmssUpdate = Update-AzVmss -ResourceGroupName $rgname -Name $vmssName -SkuCapacity 3 -SkuProfileVmSize @($vmSize1, $vmSize2) -SkuProfileAllocationStrategy "CapacityOptimized";

$vmssGet = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;

Assert-AreEqual $vmssGet.Sku.Name "Mix";
Assert-AreEqual $vmssGet.SkuProfile.AllocationStrategy "CapacityOptimized";
Assert-AreEqual $vmssGet.SkuProfile.VMSizes[0].Name "Standard_D4s_v3";
Assert-AreEqual $vmssGet.SkuProfile.VMSizes[1].Name "Standard_D4s_v4";
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Create a VMSS using New-Azvmssconfig
Expand Down
Loading

0 comments on commit e400f97

Please sign in to comment.