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

[Identity] Migrated to samples v2 #19085

Merged
merged 11 commits into from
Dec 13, 2021

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented Dec 9, 2021

I’m following the migration guide to move Identity to the samples v2: https://github.com/Azure/azure-sdk-for-js/wiki/Samples-v2-Migration-Guide

Important: Added the dependencyOverrides in order to require @azure/keyvault-keys on the samples, since Identity can’t depend on @azure/keyvault-keys (it would get recursive).

Fixes #14474

@sadasant sadasant self-assigned this Dec 9, 2021
@ghost ghost added the Azure.Identity label Dec 9, 2021
Copy link
Member

@witemple-msft witemple-msft left a comment

Choose a reason for hiding this comment

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

I always only thought of dependencyOverrides as being to override dependency version selectors and not to inject them, but this should totally work and is honestly quite clever.

I have one comment about how the build errors might be fixed, and another about why we need to import from the identity package name and not from ../src.

Comment on lines 8 to 9
import { ClientSecretCredential } from "../src";
import { KeyClient } from "@azure/keyvault-keys";
Copy link
Member

Choose a reason for hiding this comment

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

Two comments here:

  • We need to still be importing from @azure/identity here. Adding it to the paths entry in tsconfig should enable this, so you don't need to import from source for that to resolve (as you can think of paths as adding a manual module resolution entry to the TypeScript compiler).
  • We will also need an entry for @azure/keyvault-keys. I never thought to use dependencyOverrides for this purpose, but it should totally work if we also add a paths entry for it! I think something like "@azure/keyvault-keys": ["../../keyvault/keyvault-keys/src/index"] should work nicely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, I updated the references to @azure/identity on the samples, but "@azure/keyvault-keys": ["../../keyvault/keyvault-keys/src/index"] didn’t work. We talked over teams and we realized that adding keyvault on paths would alter significantly how the dist folder appears (it grabs a large part of the repository structure, to group these two projects under the same root).

@sadasant sadasant marked this pull request as ready for review December 11, 2021 00:05
@@ -10,7 +10,7 @@ Key links:
- [Package (npm)](https://www.npmjs.com/package/@azure/identity)
- [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/identity)
- [Product documentation](https://azure.microsoft.com/services/active-directory/)
- [Samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples)
- [Samples](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/v2)
Copy link
Member

Choose a reason for hiding this comment

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

I think other versions could be added in the future so do we want the customer to pick and choose the right version for them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh interesting! — Though I’d rather not think too much about it at the moment 🙏 I took a peek and it made me question other things. Makes me feel it’s a scope leak and could lead to a rabbit hole.

Copy link
Member

Choose a reason for hiding this comment

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

I took a peek and it made me question other things.

@sadasant interesting, anything you could share that could help with future migrations?

@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @summary Authenticates with a client and a client's secret.
Copy link
Member

Choose a reason for hiding this comment

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

The word client is overloaded in this context and could be confusing. Should we use "application" instead?

Copy link
Member

Choose a reason for hiding this comment

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

"App Registration"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated! Please let me know how it looks 👍

Copy link
Member

@witemple-msft witemple-msft left a comment

Choose a reason for hiding this comment

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

Very nice. I have just a couple of comments on the @summary tags.

@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @summary Authenticates with a client and a client's secret.
Copy link
Member

Choose a reason for hiding this comment

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

"App Registration"?

sdk/identity/identity/samples-dev/environmentCredential.ts Outdated Show resolved Hide resolved
@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* @summary Authenticates with a client and a app registration's secret.
Copy link
Member

Choose a reason for hiding this comment

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

could you update this summary as well?

Copy link
Contributor Author

@sadasant sadasant Dec 13, 2021

Choose a reason for hiding this comment

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

Oh now I think I should have said Authenticates with an app registration’s client Id and secret. I’ll update it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does this look? 9f525fc

Copy link
Member

Choose a reason for hiding this comment

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

Looks good, thanks!

@sadasant sadasant enabled auto-merge (squash) December 13, 2021 22:16
@sadasant sadasant merged commit a5289f1 into Azure:main Dec 13, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-js that referenced this pull request Jun 23, 2022
Mitryakh/network 2022 01 01 (Azure#19412)

* Adds base for updating Microsoft.Network from version stable/2021-08-01 to version 2022-01-01

* Updates readme

* Updates API version in new specs and examples

* Updated Explicit proxy settings by adding one boolean field to it (Azure#19011)

* API for provider port (Azure#19041)

* Update readme.md

* Create expressRouteProviderPort.json

* Create expressRouteProviderPortList.json

* Create expressRouteProviderPort.json

* Update custom-words.txt

* Update expressRouteProviderPort.json

* Update expressRouteProviderPortList.json

* Update expressRouteProviderPort.json

* Add WAF match variable operators (Azure#18925)

### webapplicationfirewall.json
* Add GreaterThanOrEquals operator and Any operator to custom rule
  match conditions in WAF policy spec

* Add VirtualHub Router autoscale configuration (Azure#19131)

Co-authored-by: Andrii Kalinichenko <[email protected]>

* Adding rule priority to Tls Proxy routing rule object model (Azure#19135)

Co-authored-by: Vinay Mundada <[email protected]>

* swagger changes for new ssl policies (Azure#19183)

* Update Swagger Spec for VMSS Packet Capture (Azure#19202)

* Update Swagger Spec for VMSS Packet Capture

* Remove extra line

* Update Swagger spec for Connection Monitor VMSS (Azure#19203)

* Adding new endpoint in ConnectionMonitor

* Changing ConnectionMonitor endpoints order

* Add flushConnection to NSG (Azure#19085)

* Merge NetworkManger into 2022-01-01 (Azure#19169)

* Merge NetworkManger into 2022-01-01

* Remove EffectiveVnet APIs

* Remove SecurityUser Resource

* update readme

* Fix as comments

* fix as comments

* remove network group type

* Add new parameter noInternetAdvertise to CustomIPPrefix (Azure#19340)

* fix

* fix

Co-authored-by: Weiheng Li <[email protected]>

* Route Server Integration feature swagger changes (Azure#19215)

* Route Server Integration feature swagger changes

* prettier run changes

* updating api version in examples file

* fixing test errors

* fixing test errors

* fixing modelvalidation errors

* fixing test errors

* fixing modelvalidation errors

* changes based on review comments

* fixing lintdiff failure

* updating examples

* update wrong enum value for customipprefix (Azure#19382)

* fix

* fix

* fix

Co-authored-by: Weiheng Li <[email protected]>

* Updated ExplicitProxySettings to ExplicitProxy on Firewall Policy ver2022-01-01 (Azure#19299)

Co-authored-by: Gizachew Eshetie <[email protected]>

* Add resource type (Azure#19434)

Co-authored-by: Andrii Kalinichenko <[email protected]>

* Fix prettier errors (Azure#19462)

Co-authored-by: Andrii Kalinichenko <[email protected]>

Co-authored-by: uditmisra52 <[email protected]>
Co-authored-by: jashsing-mic <[email protected]>
Co-authored-by: Anurag Kishore <[email protected]>
Co-authored-by: AndriiKalinichenko <[email protected]>
Co-authored-by: Andrii Kalinichenko <[email protected]>
Co-authored-by: Vinay Jayant Mundada <[email protected]>
Co-authored-by: Vinay Mundada <[email protected]>
Co-authored-by: kaushik-ms <[email protected]>
Co-authored-by: snagpal99 <[email protected]>
Co-authored-by: kumaam <[email protected]>
Co-authored-by: Satya-anshu <[email protected]>
Co-authored-by: yanfa317 <[email protected]>
Co-authored-by: Weiheng Li <[email protected]>
Co-authored-by: Weiheng Li <[email protected]>
Co-authored-by: Anchal Kapoor <[email protected]>
Co-authored-by: Gizachew-Eshetie <[email protected]>
Co-authored-by: Gizachew Eshetie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[identity] Migrate to Samples Workflow V2
3 participants