Skip to content

Commit bec02c6

Browse files
authored
Merge pull request #20970 from wastoresh/mergestorge1
[Do not Squash] Merge main branch to Az.Storage-preview branch (#1)
2 parents 0068e9d + f1a98d3 commit bec02c6

File tree

664 files changed

+117218
-1536
lines changed

Some content is hidden

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

664 files changed

+117218
-1536
lines changed

.azure-pipelines/sync-aliases.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Variable 'ADOToken' and 'BotAccessToken' was defined in the Variables tab
2+
schedules:
3+
- cron: "50 15 * * *"
4+
displayName: 11:50 PM (UTC + 8:00) China Daily Run
5+
branches:
6+
include:
7+
- main
8+
9+
jobs:
10+
- job: UpdateJson
11+
displayName: Update fabricbot.json
12+
steps:
13+
- pwsh: |
14+
./tools/Github/ParseWiki2Json.ps1 -ADOToken $(ADOToken)
15+
displayName: Update fabricbot.json file locally
16+
17+
- task: PowerShell@2
18+
displayName: Git commit and push
19+
inputs:
20+
targetType: inline
21+
script: |
22+
git config --global user.email "[email protected]"
23+
git config --global user.name "azure-powershell-bot"
24+
git checkout -b "internal/sync-fabricbot-json"
25+
26+
git add .
27+
git commit -m "Sync fabricbot.json"
28+
29+
git remote set-url origin https://$(BotAccessToken)@github.com/Azure/azure-powershell.git;
30+
git push origin internal/sync-fabricbot-json --force
31+
32+
- pwsh: |
33+
$Title = "Sync fabricbot.json According To ADO Wiki Page"
34+
$HeadBranch = "internal/sync-fabricbot-json"
35+
$BaseBranch = "main"
36+
$Description = "This PR sync taskType: scheduledAndTrigger part of fabricbot.json from table of Service-Team-Label-and-Contact-List in ADO wiki page"
37+
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description
38+
displayName: Create PR to main branch
39+

.azure-pipelines/util/smoke-test-steps.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ jobs:
7878
Write-Host "List artifacts..."
7979
Get-ChildItem "$(Pipeline.Workspace)\\LocalRepo\\"
8080
81-
- task: NuGetCommand@2
82-
condition: and(succeeded(), eq('${{ parameters.psVersion }}', '5.1.14'))
83-
displayName: 'Download ThreadJob .nupkg File for PowerShell 5.1.14'
84-
inputs:
85-
command: custom
86-
arguments: 'install ThreadJob -directdownload -packagesavemode nupkg -source https://www.powershellgallery.com/api/v2 -OutputDirectory packages'
87-
8881
- task: NuGetCommand@2
8982
condition: and(succeeded(), eq(variables['GalleryName'], 'LocalRepo'))
9083
displayName: 'Download Previous Az .nupkg Files'

src/Accounts/Accounts/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Updated Azure.Core library to 1.28.0.
23+
* Fixed an issue that the helper message about missing modules shows up at the wrong time. [#19228]
2224

2325
## Version 2.11.2
2426
* Supported Web Account Manager on ARM64-based Windows systems. Fixed an issue where `Connect-AzAccount` failed with error "Unable to load DLL 'msalruntime_arm64'". [#20700]

src/Accounts/Accounts/Utilities/CommandNotFoundHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ public static void RegisterCommandNotFoundAction(CommandInvocationIntrinsics cii
131131

132132
private static void OnCommandNotFound(object sender, CommandLookupEventArgs args)
133133
{
134-
if (IsAzOrAzureRMCmdlet(args.CommandName))
134+
// The command was dispatched by the msh engine as a result of a dispatch request from an already running command.
135+
// We are not interested in such cases.
136+
if (args.CommandOrigin == CommandOrigin.Runspace && IsAzOrAzureRMCmdlet(args.CommandName))
135137
{
136138
bool isHelpful = true;
137139
if (IsAzureRMCommand(args.CommandName))

src/Accounts/AssemblyLoading/ConditionalAssemblyProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void Initialize(string rootPath, IConditionalAssemblyContext conte
4242
// todo: add a tool to update assembly versions after replacing the assemblies. (Can it support newly introduced assemblies?)
4343
// todo: consider moving the list to a standalone config file
4444
#region AssemblyList
45-
CreateAssembly("netcoreapp2.1", "Azure.Core", "1.25.0.0").WithPowerShellCore(),
45+
CreateAssembly("netcoreapp2.1", "Azure.Core", "1.28.0.0").WithPowerShellCore(),
4646
CreateAssembly("netcoreapp2.1", "Microsoft.Identity.Client", "4.49.1.0").WithPowerShellCore(),
4747
CreateAssembly("netcoreapp3.1", "Microsoft.Identity.Client.Extensions.Msal", "2.23.0.0").WithPowerShellCore(),
4848

@@ -64,7 +64,7 @@ public static void Initialize(string rootPath, IConditionalAssemblyContext conte
6464
CreateAssembly("netstandard2.0", "System.ServiceModel.Primitives", "4.7.0.0").WithWindowsPowerShell(),
6565
CreateAssembly("netstandard2.0", "System.Threading.Tasks.Extensions", "4.2.0.1").WithWindowsPowerShell(),
6666

67-
CreateAssembly("netfx", "Azure.Core", "1.25.0.0").WithWindowsPowerShell(),
67+
CreateAssembly("netfx", "Azure.Core", "1.28.0.0").WithWindowsPowerShell(),
6868
CreateAssembly("netfx", "Microsoft.Identity.Client", "4.49.1.0").WithWindowsPowerShell(),
6969
CreateAssembly("netfx", "Microsoft.Identity.Client.Extensions.Msal", "2.23.0.0").WithWindowsPowerShell(),
7070
CreateAssembly("netfx", "Newtonsoft.Json", "12.0.0.0").WithWindowsPowerShell(),

src/Automation/Automation.Sdk/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
[assembly: CLSCompliant(false)]
2727
[assembly: Guid("ca7999e0-ca2f-47fc-9c30-f982d9e3a6ed")]
2828

29-
[assembly: AssemblyVersion("1.9.0")]
30-
[assembly: AssemblyFileVersion("1.9.0")]
29+
[assembly: AssemblyVersion("1.9.1")]
30+
[assembly: AssemblyFileVersion("1.9.1")]

src/Automation/Automation/Az.Automation.psd1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 1/6/2023
6+
# Generated on: 2/7/2023
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.9.0'
15+
ModuleVersion = '1.9.1'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'
@@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2'
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.11.0'; })
56+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.11.2'; })
5757

5858
# Assemblies that must be loaded prior to importing this module
5959
RequiredAssemblies = 'Microsoft.Azure.PowerShell.Automation.Sdk.dll'
@@ -179,7 +179,7 @@ PrivateData = @{
179179
# IconUri = ''
180180

181181
# ReleaseNotes of this module
182-
ReleaseNotes = '* Updated Example: Start-AzAutomationRunbook should pass ordered dictionary for parameters [#20408]'
182+
ReleaseNotes = '* Fixed bug: Runbooks Name Pattern failures. '
183183

184184
# Prerelease string of this module
185185
# Prerelease = ''

src/Automation/Automation/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
22+
## Version 1.9.1
2123
* Fixed bug: Runbooks Name Pattern failures.
2224

2325
## Version 1.9.0

src/Automation/Automation/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
// You can specify all the values or you can default the Build and Revision Numbers
4444
// by using the '*' as shown below:
4545

46-
[assembly: AssemblyVersion("1.9.0")]
47-
[assembly: AssemblyFileVersion("1.9.0")]
46+
[assembly: AssemblyVersion("1.9.1")]
47+
[assembly: AssemblyFileVersion("1.9.1")]
4848
#if !SIGN
4949
[assembly: InternalsVisibleTo("Microsoft.Azure.PowerShell.Cmdlets.Automation.Test")]
5050
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"TestKey": "TestValue"}

src/PolicyInsights/PolicyInsights.Test/EnvSetup/EnvironmentSetup.ps1

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,74 @@ Start-TestSleep -Seconds 60
9191
foreach ($resourceGroupName in @($resourceGroup1, $resourceGroup2)) {
9292
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile "$PSScriptRoot/CreateNSGsTemplate.json" -resourceCount 510 -resourceNamePrefix $(Get-TestResourceNamePrefix)
9393
}
94+
95+
#region Attestation Tests Setup
96+
$resourceGroup3 = $(Get-PSAttestationTestRGName)
97+
98+
# Create the required RG(s) for attestations.
99+
foreach ($resourceGroupName in @($resourceGroup3)) {
100+
Get-AzResourceGroup -Name $resourceGroupName -ErrorVariable rgNotPresent -ErrorAction SilentlyContinue
101+
if ($rgNotPresent) {
102+
New-AzResourceGroup -Name $resourceGroupName -Location "northcentralus"
103+
}
104+
}
105+
106+
# Create Subscription targetting manual policy
107+
$manualPolicySubcriptionDefinition = New-AzPolicyDefinition -Name $(Get-TestManualPolicyDefinitonNameSub) -Policy "$PSScriptRoot/ManualPolicySubDefinition.json" -DisplayName "PS cmdlet tests: Subscription Manual Policy" -Mode All
108+
109+
# Create RG targetting manual policy
110+
$manualPolicyRGDefinition = New-AzPolicyDefinition -Name $(Get-TestManualPolicyDefinitonNameRG) -Policy "$PSScriptRoot/ManualPolicyRGDefinition.json" -DisplayName "PS cmdlet tests: RG Manual Policy" -Mode All
111+
112+
# Create Resource targetting manual policy
113+
$manualPolicyResourceDefinition = New-AzPolicyDefinition -Name $(Get-TestManualPolicyDefinitonNameResource) -Policy "$PSScriptRoot/ManualPolicyResourceDefinition.json" -DisplayName "PS cmdlet tests: Resource Manual Policy" -Mode All
114+
115+
# Create a network security group for testing resource level attestations.
116+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroup3 -TemplateFile "$PSScriptRoot/CreateNSGsTemplate.json" -resourceCount 1 -resourceNamePrefix $(Get-TestResourceNamePrefix)
117+
118+
# Assign the manual policies targetting each of Subscription, Resource Groups and Resource Types to the subscription
119+
$manualPolicySubAssignment = New-AzPolicyAssignment -Name $(Get-TestAttestationSubscriptionPolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: Subscription Manual Policy" -PolicyDefinition $manualPolicySubcriptionDefinition
120+
121+
$manualPolicyRGAssignment = New-AzPolicyAssignment -Name $(Get-TestAttestationRGPolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: RG Manual Policy" -PolicyDefinition $manualPolicyRGDefinition
122+
123+
$manualPolicyResourceAssignment = New-AzPolicyAssignment -Name $(Get-TestAttestationResourcePolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: Resource Manual Policy" -PolicyDefinition $manualPolicyResourceDefinition
124+
125+
# Define Policy Initiatives
126+
$manualpolicyDefinitionsSubscription = @"
127+
[
128+
{
129+
"policyDefinitionId":"$($manualPolicySubcriptionDefinition.ResourceId)",
130+
"policyDefinitionReferenceId": "$(Get-TestManualPolicyDefinitonNameSub)_1"
131+
}
132+
]
133+
"@
134+
135+
$manualpolicyDefinitionsRG = @"
136+
[
137+
{
138+
"policyDefinitionId":"$($manualPolicyRGDefinition.ResourceId)",
139+
"policyDefinitionReferenceId": "$(Get-TestManualPolicyDefinitonNameRG)_1"
140+
}
141+
]
142+
"@
143+
144+
$manualpolicyDefinitionsResource = @"
145+
[
146+
{
147+
"policyDefinitionId":"$($manualPolicyResourceDefinition.ResourceId)",
148+
"policyDefinitionReferenceId": "$(Get-TestManualPolicyDefinitonNameResource)_1"
149+
}
150+
]
151+
"@
152+
153+
$policySetDefinitionSub = New-AzPolicySetDefinition -Name $(Get-TestManualPolicyInitiativeNameSub) -DisplayName "PS cmdlet tests: Attestation initiative SUB" -PolicyDefinition $manualpolicyDefinitionsSubscription -SubscriptionId $subscriptionId
154+
$policySetDefinitionRG = New-AzPolicySetDefinition -Name $(Get-TestManualPolicyInitiativeNameRG) -DisplayName "PS cmdlet tests: Attestation initiative RG" -PolicyDefinition $manualpolicyDefinitionsRG -SubscriptionId $subscriptionId
155+
$policySetDefinitionResource = New-AzPolicySetDefinition -Name $(Get-TestManualPolicyInitiativeNameResource) -DisplayName "PS cmdlet tests: Attestation initiative Resource" -PolicyDefinition $manualpolicyDefinitionsResource -SubscriptionId $subscriptionId
156+
157+
# Assign the initiatives to the subscription
158+
New-AzPolicyAssignment -Name $(Get-TestInitiativeAttestationSubPolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: Attestation initiative SUB" -PolicySetDefinition $policySetDefinitionSub
159+
160+
New-AzPolicyAssignment -Name $(Get-TestInitiativeAttestationRGPolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: Attestation initiative RG" -PolicySetDefinition $policySetDefinitionRG
161+
162+
New-AzPolicyAssignment -Name $(Get-TestAttestationInitiativeResourcePolicyAssignmentName) -Scope "/subscriptions/$subscriptionId" -DisplayName "PS cmdlet tests: Attestation initiative Resource" -PolicySetDefinition $policySetDefinitionResource
163+
164+
#endregion
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"if": {
3+
"field": "type",
4+
"equals": "microsoft.resources/subscriptions/resourcegroups"
5+
},
6+
"then": {
7+
"effect": "manual"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"if": {
3+
"field": "type",
4+
"equals": "Microsoft.Network/networkSecurityGroups"
5+
},
6+
"then": {
7+
"effect": "manual"
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"if": {
3+
"field": "type",
4+
"equals": "microsoft.resources/subscriptions"
5+
},
6+
"then": {
7+
"effect": "manual"
8+
}
9+
}

src/PolicyInsights/PolicyInsights.Test/PolicyInsights.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.PolicyInsights" Version="5.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.PolicyInsights" Version="5.1.0" />
1515
</ItemGroup>
1616

1717
</Project>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Text;
19+
using Xunit;
20+
using Xunit.Abstractions;
21+
22+
namespace Microsoft.Azure.Commands.PolicyInsights.Test.ScenarioTests
23+
{
24+
public class AttestationTests : PolicyInsightsTestRunner
25+
26+
{
27+
public AttestationTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
28+
{
29+
}
30+
31+
[Fact]
32+
[Trait(Category.AcceptanceType, Category.CheckIn)]
33+
public void SubscriptionScopeCrud()
34+
{
35+
TestRunner.RunTestScript("Attestation-SubscriptionScope-Crud");
36+
}
37+
38+
[Fact]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
public void ResourceGroupScopeCrud()
41+
{
42+
TestRunner.RunTestScript("Attestation-ResourceGroupScope-Crud");
43+
}
44+
45+
46+
[Fact]
47+
[Trait(Category.AcceptanceType, Category.CheckIn)]
48+
public void ResourceScopeCrud()
49+
{
50+
TestRunner.RunTestScript("Attestation-ResourceScope-Crud");
51+
}
52+
53+
[Fact]
54+
[Trait(Category.AcceptanceType, Category.CheckIn)]
55+
public void AttestationGetCollection()
56+
{
57+
TestRunner.RunTestScript("Attestation-GetCollection");
58+
}
59+
60+
[Fact]
61+
[Trait(Category.AcceptanceType, Category.CheckIn)]
62+
public void AttestationErrorHandling()
63+
{
64+
TestRunner.RunTestScript("Attestation-Error-Handling");
65+
}
66+
67+
}
68+
}

0 commit comments

Comments
 (0)