Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchAccountIdentity constructor breaking change #23633

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
-->
<ItemGroup Condition="'$(IsClientLibrary)' != 'true'">
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.4.11" />
<PackageReference Update="Microsoft.Azure.Batch" Version="15.0.0" />
<PackageReference Update="Microsoft.Azure.Batch" Version="15.1.0" />
<PackageReference Update="Microsoft.Azure.Devices.Client" Version="1.23.2" />
<PackageReference Update="Microsoft.Azure.Devices" Version="1.19.0" />
<PackageReference Update="Microsoft.Azure.KeyVault.Core" Version="3.0.3" />
<PackageReference Update="Microsoft.Azure.Management.Batch" Version="4.2.0" />
<PackageReference Update="Microsoft.Azure.Management.Batch" Version="14.1.0" />
<PackageReference Update="Microsoft.Azure.Services.AppAuthentication" Version="[1.0.3, 2.0.0)" />
<PackageReference Update="Microsoft.Azure.Storage.Blob" Version="11.1.7" />
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="[2.4.0]" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<PackageReleaseNotes>
Improve usability of GetOutputStoragePath.
</PackageReleaseNotes>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

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

Expand Down
6 changes: 6 additions & 0 deletions sdk/batch/Microsoft.Azure.Management.Batch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 14.1.0 (2021-09-01)

### Bug Fixes

- Fixes a breaking type ambiguity in BatchAccountIdentity's constructor, introduced in #14.0.0.

## 14.0.0 (2021-08-01)

### REST API version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>Provides management capabilities for Azure Batch service accounts.</Description>
<AssemblyTitle>Microsoft Azure Batch Management Library</AssemblyTitle>
<AssemblyName>Microsoft.Azure.Management.Batch</AssemblyName>
<Version>14.0.0</Version>
<Version>14.1.0</Version>
<PackageTags>Microsoft Azure batch management;batch;</PackageTags>
<PackageReleaseNotes>For detailed release notes, see: https://aka.ms/batch-net-management-changelog</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Management.Batch.Models
{
public partial class BatchAccountIdentity
{
public BatchAccountIdentity(ResourceIdentityType type, string principalId = default(string), string tenantId = default(string), IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> userAssignedIdentities = default(IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue>))
: this(type, principalId, tenantId, userAssignedIdentities as IDictionary<string, UserAssignedIdentities>)
public BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, UserAssignedIdentities> userAssignedIdentities)
: this(type, default(string), default(string), userAssignedIdentities)
{
}

[Obsolete("Please use BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, UserAssignedIdentities> userAssignedIdentities) instead.")]
public BatchAccountIdentity(ResourceIdentityType type, IDictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> userAssignedIdentities)
: this(type, default(string), default(string), userAssignedIdentities.ToDictionary(k => k.Key, v => (UserAssignedIdentities)v.Value))
{
// This constructor exists for legacy support. Do not add anything here.
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

namespace Microsoft.Azure.Management.Batch.Models
{
[Obsolete("Please use UserAssignedIdentities instead.")]
public class BatchAccountIdentityUserAssignedIdentitiesValue : UserAssignedIdentities
{
public BatchAccountIdentityUserAssignedIdentitiesValue(string principalId = default(string), string clientId = default(string))
: base(principalId, clientId)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -907,14 +907,16 @@ public void ListOutboundNetworkDependenciesEndpointsValidateResponse()
[Fact]
public void UserAssignedIdentitiesShouldSubstituteForBatchAccountIdentityUserAssignedIdentitiesValue()
{
string principalId = "TestPrincipal";
string tenantId = "TestTenant";
BatchAccountIdentityUserAssignedIdentitiesValue testIdentity = new BatchAccountIdentityUserAssignedIdentitiesValue();
BatchAccountIdentity identity = new BatchAccountIdentity(ResourceIdentityType.UserAssigned, principalId, tenantId, new Dictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> { { "", testIdentity } });

string testPrincipalId = "testPrincipalId";
string testClientId = "testClientId";
string testAccount = "testAccount";
#pragma warning disable CS0618 // Type or member is obsolete
BatchAccountIdentityUserAssignedIdentitiesValue testIdentity = new BatchAccountIdentityUserAssignedIdentitiesValue(testPrincipalId, testClientId);
BatchAccountIdentity identity = new BatchAccountIdentity(ResourceIdentityType.UserAssigned, new Dictionary<string, BatchAccountIdentityUserAssignedIdentitiesValue> { { testAccount, testIdentity } });
#pragma warning restore CS0618 // Type or member is obsolete
Assert.True(testIdentity is UserAssignedIdentities);
Assert.Equal(principalId, identity.PrincipalId);
Assert.Equal(tenantId, identity.TenantId);
Assert.Equal(testPrincipalId, identity.UserAssignedIdentities[testAccount].PrincipalId);
Assert.Equal(testClientId, identity.UserAssignedIdentities[testAccount].ClientId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static string FindLocation(MockContext context)
var resourceManagementClient = context.GetServiceClient<ResourceManagementClient>();
Provider provider = resourceManagementClient.Providers.Get("Microsoft.Batch");
IList <string> locations = provider.ResourceTypes.First(resType => resType.ResourceType == "batchAccounts").Locations;
return locations.First(location => location == "East US");
return locations.First(location => location == "West US");
}

// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public async Task ListSupportedCloudServiceSkusFilterFamilyNameAsync()
{
using (MockContext context = StartMockContextAndInitializeClients(GetType()))
{
string filterValue = "basic";
string filterValue = "standardD";
string filterExpression = $"startswith(familyName,'{filterValue}')"; // Select family names beginning with 'basic'.
IPage<SupportedSku> result;

Expand Down
Loading