Skip to content

Update auth lib to latest#29505

Draft
isra-fel wants to merge 6 commits intoAzure:mainfrom
isra-fel:azure-identity-1.21.0
Draft

Update auth lib to latest#29505
isra-fel wants to merge 6 commits intoAzure:mainfrom
isra-fel:azure-identity-1.21.0

Conversation

@isra-fel
Copy link
Copy Markdown
Member

@isra-fel isra-fel commented May 5, 2026

  • Update dependencies and suppress warnings for obsolete credential types
  • todo
  • Update package references and clean up unused dependencies across multiple projects
  • continue addressing the namespace conflicts

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings May 5, 2026 16:40
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@@ -22,10 +22,12 @@ namespace Microsoft.Azure.PowerShell.Authenticators.Factories
{
public class AzureCredentialFactory
{
#pragma warning disable CS0618 // ManagedIdentityCredential(string) is obsolete; suppressed pending migration to ManagedIdentityId API
public virtual TokenCredential CreateManagedIdentityCredential(string clientId)
{
return new ManagedIdentityCredential(clientId);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid more testing down the road, switch to the replacement overload for user-assigned managed identity with client ID. Then you can remove the warning suppression for this method.

Suggested change
return new ManagedIdentityCredential(clientId);
return new ManagedIdentityCredential(ManagedIdentityId.FromUserAssignedClientId(clientId));

@@ -56,8 +56,10 @@ public async Task UserAssignedMSI()

var mockAzureCredentialFactory = new Mock<AzureCredentialFactory>();
//id must be equal to accountId
#pragma warning disable CS0618 // ManagedIdentityCredential(string) is obsolete; suppressed pending migration
mockAzureCredentialFactory.Setup(f => f.CreateManagedIdentityCredential(It.Is<string>(id => id == accountId)))
.Returns(new ManagedIdentityCredential(accountId));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment about using the replacement overload

Copilot AI review requested due to automatic review settings May 8, 2026 04:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 62 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (2)

src/Search/Search/Models/PSIdentity.cs:33

  • The explicit conversion operator parameter type is Azure.Management.Search.Models.Identity, but this module’s SDK types are in Microsoft.Azure.Management.Search.Models (and the file already imports that namespace). This will not compile unless an Azure.Management.Search.Models namespace exists. Update the operator signature to use the SDK Identity type.
        public PSIdentityType Type { get; set; }

        public static explicit operator PSIdentity(Azure.Management.Search.Models.Identity v)
        {
            PSIdentityType? identityType = v?.Type.ParsePSIdentityType();

            if (identityType.HasValue)

src/OperationalInsights/OperationalInsights/Models/PSIdentity.cs:33

  • The file imports Microsoft.Azure.Management.OperationalInsights.Models, but the constructor parameter type is Management.OperationalInsights.Models.Identity, which doesn’t resolve without a Management namespace alias. This will fail compilation; use the SDK Identity type from the imported namespace (or fully-qualify Microsoft.Azure.Management.OperationalInsights.Models.Identity).
            TenantId = tenantId;
            Type = string.IsNullOrEmpty(type) ? "SystemAssigned" : type;
        }

        public PSIdentity(Management.OperationalInsights.Models.Identity identity)
        {
            this.PrincipalId = identity.PrincipalId;
            this.TenantId = identity.TenantId;
            this.Type = identity.Type.ToString();
        }

NetworkRuleSet = networkRuleSet ?? service.NetworkRuleSet,
PublicNetworkAccess = publicNetworkAccess ?? service.PublicNetworkAccess,
Identity = (Identity)identity ?? service.Identity,
Identity = (Azure.Management.Search.Models.Identity)identity ?? service.Identity,
Comment on lines 193 to 195
publicNetworkAccess: publicNetworkAccess,
identity: (Identity)identity,
identity: (Azure.Management.Search.Models.Identity)identity,
networkRuleSet: networkRuleSet,
Comment on lines 46 to 56
}

public static explicit operator Identity(PSIdentity v)
public static explicit operator Azure.Management.Search.Models.Identity(PSIdentity v)
{
string identityType = v?.Type.ToString();
if (identityType != null)
{
return new Identity(
return new Azure.Management.Search.Models.Identity(
type: identityType,
principalId: v?.PrincipalId,
tenantId: v?.TenantId);
public string PublicNetworkAccess { get; private set; }

public Identity Identity { get; private set; }
public Azure.Management.CognitiveServices.Models.Identity Identity { get; private set; }
}

updateParameters.Identity = new Identity(resourceIdentityType);
updateParameters.Identity = new Azure.Management.CognitiveServices.Models.Identity(resourceIdentityType);
Comment on lines 52 to 57
}

public Identity GetIdentity()
public Management.OperationalInsights.Models.Identity GetIdentity()
{
return new Identity(this.getIdentityType(), this.PrincipalId, this.TenantId);
return new Management.OperationalInsights.Models.Identity(this.getIdentityType(), this.PrincipalId, this.TenantId);
}
@@ -18,7 +18,6 @@
<PackageReference Include="Portable.BouncyCastle" Version="1.8.8" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
<PackageReference Include="Microsoft.Azure.KeyVault.WebKey" Version="3.0.1" />
<ProjectReference Include="..\RecoveryServices.Backup.CrossRegionRestore.Management.Sdk\RecoveryServices.Backup.CrossRegionRestore.Management.Sdk.csproj" />
</ItemGroup>

<ItemGroup>
Comment on lines +27 to +31
if (clientId != null)
{
return new ManagedIdentityCredential(ManagedIdentityId.FromUserAssignedClientId(clientId));
}
return new ManagedIdentityCredential(ManagedIdentityId.SystemAssigned);
Comment thread TODO.md
Comment on lines +1 to +6
- [x] create an agent
- [x] update azure.identity and msal
- [x] address namespace conflict of types named Identity because Azure.Core pulls in namespaces of Microsoft.Identity (because of Microsoft.Identity.Client)
- [x] update other dependencies
- [ ] System.Text.Json might not be necessary for PowerShell 7+?
- [ ] Errors of "Could not load file or assembly 'Microsoft.Azure.PowerShell.AssemblyLoading, Version=5.3.3.0" during smoke test. Might be regression of parallal loading, need to investigate.
<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.82.1" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.82.1" />
<PackageReference Include="Azure.Identity" Version="1.21.0" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to use this version of Azure.Core instead, so that extra querystring parameters can be passed via the new AdditionalQueryParameters property. All the Azure.Identity credentials you need live in Azure.Core now.

Suggested change
<PackageReference Include="Azure.Identity" Version="1.21.0" />
<PackageReference Include="Azure.Core" Version="1.55.0" />

</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" Version="1.50.0"/>
<PackageReference Include="Azure.Core" Version="1.54.0"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump to latest stable release

Suggested change
<PackageReference Include="Azure.Core" Version="1.54.0"/>
<PackageReference Include="Azure.Core" Version="1.55.0"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants