question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[swagger][Container Instance] Username is required even if user assigned identity is passed

See original GitHub issue
  • Package Name: @azure/arm-containerinstance
  • Package Version: 7.1.0
  • Operating system: Linux x86-64
  • nodejs
    • version: 17
  • browser
    • name/version:
  • typescript
    • version: 4.6.2
  • Is the bug related to documentation in

Describe the bug Spawning a container group using client.containerGroups.createOrUpdate requires passing username in imageRegistryCredentials (type ImageRegistryCredential), but this field should not be required if identity is present.

To Reproduce Try to call client.containerGroups.createOrUpdate with only an identity:

const principalPath = '/subscriptions/...';

await someContainerClient.containerGroups.createOrUpdate('some-group', 'some-name', {
    containers: containers,
    name: name,
    osType: 'Linux',
    sku: 'Standard',
    location: this.azureContainerInstanceConfig.instanceRegion,
    identity: {
        type: 'UserAssigned',
        userAssignedIdentities: {
            [principalPath]: {},
        },
    },
    imageRegistryCredentials: [
        {
            server: 'some-server',
            identity: principalPath,
        },
    ],
    restartPolicy: 'OnFailure'
})

The types will complain that username must be present.

Expected behavior The types do not complain about username if identity is present, since the two are mutually exclusive.

Additional context If you pass undefined as unknown as string to circumvent the error, the serializer will complain that username must not be null or undefined. If you set it to an actual value, Azure will complain that you cannot combine username with identity. The only workaround so far is to pass the empty string '' as username value - Azure seems to ignore it, and the SDK does not complain.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
qiaozhacommented, Jul 20, 2022

close it as it should have been resolved. @NoTuxNoBux feel free to reopen it if you still found any issues about it. Thanks

1reaction
MaryGaocommented, Apr 27, 2022

@NoTuxNoBux Thanks for reporting this issue! We reproduced in local environment and we think this is a valid issue and are contacting the service team to fix it. Will let you know once we have a release to fix it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managed identities for Azure resources - Microsoft Entra
Here are some of the benefits of using managed identities: You don't need to manage credentials. Credentials aren't even accessible to you.
Read more >
Azure Managed Identities: Complete Guide with Free ...
Use this guide to learn about Azure managed identities: What they are, how many types there are, and what benefits they offer, plus...
Read more >
Demystifying system-assigned managed identity and user ...
R: When you create a user-assigned managed identity, there is no used as you have for Azure AD. Even if the name contains...
Read more >
[QUERY] User Managed Identity not working #23954 - GitHub
do we need to explicitly pass client id for user managed identity? For system assigned identity its working fine without passing the client...
Read more >
There is a new way to reference managed identity in ARM ...
A user-assigned managed identity is created as a standalone Azure ... you need to pass the string value full as the last parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found