Skip to content

Commit 780a87c

Browse files
update compute api-version (Azure#31226)
* update compute api-version * update commit hash after merge * update api-version and mitigate the breaking changes * record test cases after the api-version update * update again * mitigate the breaking change in a suggested way * refine some names and regenerate samples * some more refinement * re-record to fix the recordings * record all the test cases again * update code * add a new test * update changelog * record new test cases * fix some missing part for binary data * update api * temp * update config to include the converter * add a comment * regenerate * add some more unit test cases for those types with modified properties * re-record test cases * update automanage to remove the dependency on compute * some tweak to securitycenter * fix chaos * fixed some warnings in cosmosdb * fixed a bug in compute customized code
1 parent b280663 commit 780a87c

File tree

579 files changed

+748545
-48106
lines changed

Some content is hidden

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

579 files changed

+748545
-48106
lines changed

sdk/automanage/Azure.ResourceManager.Automanage/tests/AutomanageTestBase.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Linq;
56
using System.Net.Http;
67
using System.Threading.Tasks;
78
using Azure.Core;
@@ -95,17 +96,16 @@ protected async Task<ConfigurationProfileResource> CreateConfigurationProfile(Co
9596
/// <summary>
9697
/// Creates an assignment between a configuration profile and a virtual machine
9798
/// </summary>
98-
/// <param name="vm">Virtual Machine to assign a profile to</param>
99+
/// <param name="vmId">The ID of the Virtual Machine to assign a profile to</param>
99100
/// <param name="profileId">ID of desired configuration profile to use</param>
100-
/// <param name="scope">Scope to create the assignment under</param>
101101
/// <returns>ConfigurationProfileAssignmentResource</returns>
102-
protected async Task<ConfigurationProfileAssignmentResource> CreateAssignment(VirtualMachineResource vm, string profileId)
102+
protected async Task<ConfigurationProfileAssignmentResource> CreateAssignment(ResourceIdentifier vmId, string profileId)
103103
{
104104
var data = new ConfigurationProfileAssignmentData();
105105
data.Properties = new ConfigurationProfileAssignmentProperties() { ConfigurationProfile = profileId };
106106

107107
// fetch assignments collection
108-
var collection = ArmClient.GetConfigurationProfileAssignments(vm.Id);
108+
var collection = ArmClient.GetConfigurationProfileAssignments(vmId);
109109
var assignment = await collection.CreateOrUpdateAsync(WaitUntil.Completed, "default", data);
110110

111111
return assignment.Value;
@@ -116,8 +116,8 @@ protected async Task<ConfigurationProfileAssignmentResource> CreateAssignment(Vi
116116
/// </summary>
117117
/// <param name="vmName">Desired name of the Virtual Machine</param>
118118
/// <param name="rg">Resource Group to perform actions against</param>
119-
/// <returns>VirtualMachineResource</returns>
120-
protected async Task<VirtualMachineResource> CreateVirtualMachineFromTemplate(string vmName, ResourceGroupResource rg)
119+
/// <returns>The <see cref="ResourceIdentifier"/> of the created VirtualMachineResource</returns>
120+
protected async Task<ResourceIdentifier> CreateVirtualMachineFromTemplate(string vmName, ResourceGroupResource rg)
121121
{
122122
// get ARM template contents
123123
var httpClient = new HttpClient();
@@ -134,11 +134,12 @@ protected async Task<VirtualMachineResource> CreateVirtualMachineFromTemplate(st
134134
});
135135

136136
// create vm
137-
await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, "deployVM", deploymentContent);
137+
var deploymentLro = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, "deployVM", deploymentContent);
138+
var deployment = deploymentLro.Value.Data;
138139

139-
// fetch vm
140-
var vm = rg.GetVirtualMachineAsync(vmName).Result.Value;
141-
return vm;
140+
var vmId = deployment.Properties.OutputResources.Select(sub => sub.Id).First(id => id.ResourceType == VirtualMachineResource.ResourceType);
141+
142+
return vmId;
142143
}
143144
}
144145
}

sdk/automanage/Azure.ResourceManager.Automanage/tests/Scenario/ConfigurationProfileAssignmentTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ public async Task CanGetAssigment()
1919
var rg = await CreateResourceGroup("SDKAutomanage-", DefaultLocation);
2020

2121
// create VM from existing ARM template
22-
var vm = CreateVirtualMachineFromTemplate(vmName, rg).Result;
22+
var vmId = await CreateVirtualMachineFromTemplate(vmName, rg);
2323

2424
// create assignment between best practices profile and VM
2525
string profileId = "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction";
26-
var result = await CreateAssignment(vm, profileId);
26+
var result = await CreateAssignment(vmId, profileId);
2727

2828
// fetch assignment
29-
var assignment = await ArmClient.GetConfigurationProfileAssignmentAsync(vm.Id, "default");
29+
var assignment = await ArmClient.GetConfigurationProfileAssignmentAsync(vmId, "default");
3030

3131
// assert
3232
Assert.True(assignment.Value.HasData);
3333
Assert.NotNull(assignment.Value.Data.Name);
3434
Assert.NotNull(assignment.Value.Data.Id);
35-
Assert.AreEqual(vm.Id, assignment.Value.Data.Properties.TargetId);
35+
Assert.AreEqual(vmId, assignment.Value.Data.Properties.TargetId);
3636
}
3737

3838
[TestCase]
@@ -44,11 +44,11 @@ public async Task CanCreateBestPracticesProductionProfileAssignment()
4444
var rg = await CreateResourceGroup("SDKAutomanage-", DefaultLocation);
4545

4646
// create VM from existing ARM template
47-
var vm = CreateVirtualMachineFromTemplate(vmName, rg).Result;
47+
var vmId = await CreateVirtualMachineFromTemplate(vmName, rg);
4848

4949
// create assignment between best practices profile and VM
5050
string profileId = "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction";
51-
var assignment = CreateAssignment(vm, profileId).Result;
51+
var assignment = await CreateAssignment(vmId, profileId);
5252

5353
// assert
5454
Assert.True(assignment.HasData);
@@ -72,10 +72,10 @@ public async Task CanCreateCustomProfileAssignment()
7272
var profile = await CreateConfigurationProfile(profileCollection, profileName);
7373

7474
// create VM from existing ARM template
75-
var vm = CreateVirtualMachineFromTemplate(vmName, rg).Result;
75+
var vmId = await CreateVirtualMachineFromTemplate(vmName, rg);
7676

7777
// create assignment between custom profile and VM
78-
var assignment = CreateAssignment(vm, profile.Id).Result;
78+
var assignment = await CreateAssignment(vmId, profile.Id);
7979

8080
// assert
8181
Assert.True(assignment.HasData);

sdk/automanage/Azure.ResourceManager.Automanage/tests/Scenario/ConfigurationProfileVersionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ public async Task CanMakeAssignmentWithConfigurationProfileVersion()
107107
var version = await versionCollection.GetAsync("1");
108108

109109
// create vm & assignment
110-
var vm = await CreateVirtualMachineFromTemplate(vmName, rg);
111-
var assignment = await CreateAssignment(vm, version.Value.Id);
110+
var vmId = await CreateVirtualMachineFromTemplate(vmName, rg);
111+
var assignment = await CreateAssignment(vmId, version.Value.Id);
112112

113113
// assert
114114
Assert.True(assignment.HasData);
115115
Assert.NotNull(assignment.Data.Name);
116116
Assert.NotNull(assignment.Data.Id);
117-
Assert.AreEqual(vm.Id, assignment.Data.Properties.TargetId);
117+
Assert.AreEqual(vmId, assignment.Data.Properties.TargetId);
118118
}
119119

120120
[TestCase]

sdk/automanage/Azure.ResourceManager.Automanage/tests/Scenario/ReportTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public async Task CanGetAssignmentReports()
2626
var profile = await CreateConfigurationProfile(profileCollection, profileName);
2727

2828
// create VM from existing ARM template
29-
var vm = await CreateVirtualMachineFromTemplate(vmName, rg);
29+
var vmId = await CreateVirtualMachineFromTemplate(vmName, rg);
3030

3131
// create assignment between custom profile and VM
32-
await CreateAssignment(vm, profile.Id);
32+
await CreateAssignment(vmId, profile.Id);
3333

3434
// get reports
3535
var reports = rg.GetReportsByConfigurationProfileAssignmentsAsync(vmName, "default");

sdk/automanage/Azure.ResourceManager.Automanage/tests/SessionRecords/ConfigurationProfileAssignmentTests/CanCreateBestPracticesProductionProfileAssignment().json

Lines changed: 0 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/automanage/Azure.ResourceManager.Automanage/tests/SessionRecords/ConfigurationProfileAssignmentTests/CanCreateBestPracticesProductionProfileAssignment()Async.json

Lines changed: 0 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)