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

Fluent SDK only allows username/password on WithPrivateImageRegistry #1291

Open
wkoeter opened this issue Jan 19, 2022 · 5 comments
Open

Fluent SDK only allows username/password on WithPrivateImageRegistry #1291

wkoeter opened this issue Jan 19, 2022 · 5 comments

Comments

@wkoeter
Copy link

wkoeter commented Jan 19, 2022

Describe the bug
WithPrivateImageRegistry does not accept identity as parameter.
It is only possible to use username/password. There is no overload for an identity.
When leaving username/password empty, an error occurs.

ARM indicates it expects username/pw or identity.
SDK only allows setting identity.

Exception or Stack Trace
Microsoft.Rest.Azure.CloudException: The registry credential type in the 'imageRegistryCredentials' of container group 'xxxxx' cannot be detected. Please set exactly one of username or identity

To Reproduce

  • create registry
  • create user assigned managed identity with 'AcrPull` permission on registry
  • create container group

Code Snippet

await azure.ContainerGroups.Define(containerGroupName)
                .WithRegion(azureRegion)
                .WithExistingResourceGroup(_configuration.ResourceGroupName)
                .WithLinux()
                .WithPrivateImageRegistry(
                    registry.LoginServerUrl,
                    "",    //username left empty
                    "")    //password left empty
                .WithoutVolume()
                .DefineContainerInstance(containerGroupName + "-1")
                .WithImage(_configuration.ContainerImageName)
                .WithExternalTcpPort(80)
                .WithCpuCoreCount(_configuration.CpuCoreCount)
                .WithMemorySizeInGB(_configuration.MemorySizeInGB)
                .Attach()
                .WithNetworkProfileId(azure.SubscriptionId, x, y)
                .WithExistingUserAssignedManagedServiceIdentity(userAssignedIdentity)
                .CreateAsync();

Expected behavior
Should have an overload allowing a user assigned identity on the WithPrivateImageRegistry method

Screenshots
Stacktrace says it all. ARM expects username or identity. SDK only allows username/password.

Setup (please complete the following information):

  • OS: W10
  • IDE : VS2022
  • Version of the Library used 1.38.0

Additional context

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ X ] Bug Description Added
  • [ X ] Repro Steps Added
  • [ X ] Setup information Added
@wkoeter wkoeter changed the title SDK only allows username/password on WithPrivateImageRegistry Fluent SDK only allows username/password on WithPrivateImageRegistry Jan 19, 2022
@weidongxu-microsoft
Copy link
Member

For .NET, the development focus has shifted to the next generation of Azure SDKs which follows the new SDK guideline and introduces a set of important new features. Those new packages are currently in preview state and we are actively working on making it production ready. You can visit this link here to see the latest .NET packages:
https://devblogs.microsoft.com/azure-sdk/october-2020-management-ga/

We have also published a few blog posts on why we are doing this:
https://devblogs.microsoft.com/azure-sdk/introducing-new-previews-for-azure-management-libraries/

With this background, .NET Fluent is currently in a low maintenance mode, and we mostly do security and bug fixes. It is subject to deprecation in the future when the new set of .NET packages become Generally Available (GA). Please let us know if there are further questions, thanks!

@wkoeter
Copy link
Author

wkoeter commented Jan 20, 2022

Hi @weidongxu-microsoft I've read the posts. Hi, am I to understand that Container Instances are not covered in those SDK's for .NET? I see them for Java and Python. Will they be covered?

This page suggests that the old API's are the only ones available for Container Instances.
https://aka.ms/azsdk/releases

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Jan 20, 2022

@wkoeter

It is to be covered. All service will be covered in these new SDKs.

Though the new lib is not released yet. If you are urgent, you can use https://www.nuget.org/packages/Microsoft.Azure.Management.ContainerInstance/. But this will also be replaced by the new SDK in future.

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Jan 20, 2022

For new SDK, you can follow on https://azure.github.io/azure-sdk/releases/latest/mgmt/dotnet.html (ignore the preview ones)
or https://aka.ms/azsdk/dotnet/mgmt

@wkoeter
Copy link
Author

wkoeter commented Jan 20, 2022

All right @weidongxu-microsoft . For now I will use the "old" non-fluent SDK that you mentioned since that appears to be more flexible (albeit more verbose).

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

No branches or pull requests

2 participants