Skip to content

Commit da62f57

Browse files
authored
BatchAccountIdentity constructor breaking change (Azure#25043)
* Fixed BatchAccountIdentity constructor breaking change. Changed test location for CloudService test. Update changelog and version. Added more legacy constructors. Fixed constructor and test Add another 2 argument constructor for BatchAccountIdentity Mark legacy identity class and related constructor as obsolete Mark legacy identity class and related constructor as obsolete Added nuget config to fix package build order issue. Revert "Added nuget config to fix package build order issue." This reverts commit b59ade3. Updated batch version Revert "Updated batch version" This reverts commit 86a050d. Fixed changelog date Fixed changelog * Updated session recordings Session records Updated session recordings. Updated location filter value to fix scenario test. * Updated batch version Updated package version Updated version Fixed versioning Fixed version Reverted to v4.2, will address in pending DataPlane update. * Removed GeneratePackageOnBuild Revert "Set RestorePackagePath" This reverts commit f69ea24ed26d600c35d2df438804a8e7f121b731. Removed GeneratePackageOnBuild This resolved a packing issue. See [here](dotnet/sdk#10335) for more information.
1 parent cddee22 commit da62f57

19 files changed

+1822
-1577
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
-->
1313
<ItemGroup Condition="'$(IsClientLibrary)' != 'true'">
1414
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.4.11" />
15-
<PackageReference Update="Microsoft.Azure.Batch" Version="15.0.0" />
15+
<PackageReference Update="Microsoft.Azure.Batch" Version="15.1.0" />
1616
<PackageReference Update="Microsoft.Azure.Devices.Client" Version="1.23.2" />
1717
<PackageReference Update="Microsoft.Azure.Devices" Version="1.19.0" />
1818
<PackageReference Update="Microsoft.Azure.KeyVault.Core" Version="3.0.3" />

sdk/batch/Microsoft.Azure.Batch.Conventions.Files/src/Microsoft.Azure.Batch.Conventions.Files.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<PackageReleaseNotes>
1313
Improve usability of GetOutputStoragePath.
1414
</PackageReleaseNotes>
15-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1615
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1716
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
1817
<SignAssembly>true</SignAssembly>

sdk/batch/Microsoft.Azure.Batch.FileStaging/src/Microsoft.Azure.Batch.FileStaging.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
</PropertyGroup>
1919
<PropertyGroup>
2020
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
21-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2221
</PropertyGroup>
2322

2423
<ItemGroup>

sdk/batch/Microsoft.Azure.Batch/src/Microsoft.Azure.Batch.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
<PropertyGroup>
1717
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
18-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1918
<PackageReleaseNotes>For detailed release notes, see: https://aka.ms/batch-net-dataplane-changelog </PackageReleaseNotes>
2019
</PropertyGroup>
2120

sdk/batch/Microsoft.Azure.Management.Batch/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 14.1.0 (2021-11-01)
4+
5+
### Bug Fixes
6+
7+
- Fixes a breaking type ambiguity in BatchAccountIdentity's constructor, introduced in v14.0.0.
8+
39
## 14.0.0 (2021-08-01)
410

511
### REST API version

sdk/batch/Microsoft.Azure.Management.Batch/src/Microsoft.Azure.Management.Batch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Description>Provides management capabilities for Azure Batch service accounts.</Description>
99
<AssemblyTitle>Microsoft Azure Batch Management Library</AssemblyTitle>
1010
<AssemblyName>Microsoft.Azure.Management.Batch</AssemblyName>
11-
<Version>14.0.0</Version>
11+
<Version>14.1.0</Version>
1212
<PackageTags>Microsoft Azure batch management;batch;</PackageTags>
1313
<PackageReleaseNotes>For detailed release notes, see: https://aka.ms/batch-net-management-changelog</PackageReleaseNotes>
1414
</PropertyGroup>

sdk/batch/Microsoft.Azure.Management.Batch/src/Models/BatchAccountIdentity.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ namespace Microsoft.Azure.Management.Batch.Models
88
{
99
public partial class BatchAccountIdentity
1010
{
11-
public BatchAccountIdentity(ResourceIdentityType type, string principalId = default(string), string tenantId = default(string), IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> userAssignedIdentities = default(IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue>))
12-
: this(type, principalId, tenantId, userAssignedIdentities as IDictionary<string, UserAssignedIdentities>)
11+
public BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, UserAssignedIdentities> userAssignedIdentities)
12+
: this(type, default(string), default(string), userAssignedIdentities)
1313
{
1414
}
15+
16+
[Obsolete("Please use BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, UserAssignedIdentities> userAssignedIdentities) instead.")]
17+
public BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> userAssignedIdentities)
18+
: this(type, default(string), default(string), userAssignedIdentities.ToDictionary(k => k.Key, v => (UserAssignedIdentities)v.Value))
19+
{
20+
// This constructor exists for legacy support. Do not add anything here.
21+
}
1522
}
1623
}

sdk/batch/Microsoft.Azure.Management.Batch/src/Models/BatchAccountIdentityUserAssignedIdentitiesValue.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
namespace Microsoft.Azure.Management.Batch.Models
88
{
9+
[Obsolete("Please use UserAssignedIdentities instead.")]
910
public class BatchAccountIdentityUserAssignedIdentitiesValue : UserAssignedIdentities
1011
{
12+
public BatchAccountIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string))
13+
: base(principalId, clientId)
14+
{
15+
}
1116
}
1217
}

sdk/batch/Microsoft.Azure.Management.Batch/tests/InMemoryTests/AccountTests.InMemory.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -907,14 +907,16 @@ public void ListOutboundNetworkDependenciesEndpointsValidateResponse()
907907
[Fact]
908908
public void UserAssignedIdentitiesShouldSubstituteForBatchAccountIdentityUserAssignedIdentitiesValue()
909909
{
910-
string principalId = "TestPrincipal";
911-
string tenantId = "TestTenant";
912-
BatchAccountIdentityUserAssignedIdentitiesValue testIdentity = new BatchAccountIdentityUserAssignedIdentitiesValue();
913-
BatchAccountIdentity identity = new BatchAccountIdentity(ResourceIdentityType.UserAssigned, principalId, tenantId, new Dictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> { { "", testIdentity } });
914-
910+
string testPrincipalId = "testPrincipalId";
911+
string testClientId = "testClientId";
912+
string testAccount = "testAccount";
913+
#pragma warning disable CS0618 // Type or member is obsolete
914+
BatchAccountIdentityUserAssignedIdentitiesValue testIdentity = new BatchAccountIdentityUserAssignedIdentitiesValue(testPrincipalId, testClientId);
915+
BatchAccountIdentity identity = new BatchAccountIdentity(ResourceIdentityType.UserAssigned, new Dictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> { { testAccount, testIdentity } });
916+
#pragma warning restore CS0618 // Type or member is obsolete
915917
Assert.True(testIdentity is UserAssignedIdentities);
916-
Assert.Equal(principalId, identity.PrincipalId);
917-
Assert.Equal(tenantId, identity.TenantId);
918+
Assert.Equal(testPrincipalId, identity.UserAssignedIdentities[testAccount].PrincipalId);
919+
Assert.Equal(testClientId, identity.UserAssignedIdentities[testAccount].ClientId);
918920
}
919921
}
920922
}

sdk/batch/Microsoft.Azure.Management.Batch/tests/ScenarioTests/BatchScenarioTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static string FindLocation(MockContext context)
4040
var resourceManagementClient = context.GetServiceClient<ResourceManagementClient>();
4141
Provider provider = resourceManagementClient.Providers.Get("Microsoft.Batch");
4242
IList <string> locations = provider.ResourceTypes.First(resType => resType.ResourceType == "batchAccounts").Locations;
43-
return locations.First(location => location == "East US");
43+
return locations.First(location => location == "West US");
4444
}
4545

4646
// Can be used to find a region to test against, but probably shouldn't record tests that use this as it will leave your subscription account details in the

0 commit comments

Comments
 (0)