Граф коммитов

896 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Meng d8b577111a
[EngSys] Pin @azure/msal-* version temporarily (#31819)
because upgrading them caused identity unit tests to fail. This allows
us to upgrade other packages to address security alerts.
2024-11-19 15:29:16 -08:00
Matthew Podwysocki 6ba62e82a7
[identity] Bump vitest hook/test timeout (#31841)
### Packages impacted by this PR

- @azure/identity

### Issues associated with this PR


### Describe the problem that is addressed by this PR

Bumps the `hookTimeout` and `testTimeout` for @azure/identity tests.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
2024-11-19 13:35:07 -05:00
Maor Leger a6b5a3614a
[identity] Various test fixes (#31764)
A few fixes as a result of the identity ESM migration:

1. Missing `ctx` parameter that's now fixed
2. Default vitest config excludes managed identity tests. Adding a
separate vitest config for managed identity test runs fixes this
2024-11-14 17:18:53 -05:00
Maor Leger 86ed16f451
[identity] Migrate to ESM and tshy (#31647)
### Packages impacted by this PR

@azure/identity-broker
@azure/identity 

### Issues associated with this PR

#31338 

### Describe the problem that is addressed by this PR

Migrates identity and identity-broker to ESM, tshy, and Vitest
2024-11-13 15:26:24 -08:00
Daniel Jurek 7da16dde82
Enable publishing for packages previously excluded from Docs MS (#31207)
Fixes #26770 

I have tested and validated that these packages will work with the new
`type2docfx` docs build system and this PR enables docs.ms publishing.

@xirzec -- When searching through `ci.yml` files I noticed two places
where we intentionally skip publishing docs on docs.ms:

*
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/ci.yml#L64-L69
*
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/ci.yml#L32-L49

In both of these instances these are `@azure-tools/___` packages. I left
these untouched. Should docs be published for these on
docs.microsoft.com whenever they release?
2024-11-06 15:52:43 -08:00
Minh-Anh Phan 49637752a5
[Core] Add CAE Support (#31501)
#31185

This PR adds `enableCAE: true` by default. The updated logic for
`BearerAuthenticationPolicy` is as follows:
- Check if initial response returns a challenge
- If CAE challenge, handle it and return whatever response received next
- If not CAE challenge and a custom challenge handler is provided
through `authorizeRequestOnChallenge`, use custom handler to handle the
challenge. If there is another CAE challenge after, handle it and return
whatever response next. At max, the policy will resolve 2 challenges (1
non-CAE and 1 CAE challenge)
2024-11-06 15:40:24 -08:00
Maor Leger 7153c83f76
[identity] Cleanup legacy MSI code (#31625)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

Resolves #31208

### Describe the problem that is addressed by this PR

Now that Managed Identity migration to MSAL has been stabilized, we can
finish the migration with my favorite part: deleting code!

This PR deletes all the legacy code, and simplifies where possible.
Obsolete tests have been deleted or updated.
2024-11-04 12:52:08 -08:00
Jeremy Meng a28e8f0795 [EngSys] move to vendored version of cross-env via dev-tool
***NO_CI***

- apply the transformation

- update samples' README
2024-11-02 00:48:06 +00:00
Jeremy Meng 6a2c7300eb [eslint-plugin] add rule "@typescript-eslint/consistent-type-imports": "warn"
- apply lint:fix results

- revert fixes that are not related to consistent-type-imports and cases error

- regenerate .api.md files

- format

- update core-comparison diff
2024-10-30 15:48:52 +00:00
Minh-Anh Phan 7e47aa26e3
[Identity] Mark German cloud as deprecated (#31519)
Closes #31276 

- [x] Mark German cloud as deprecated
- [x] Fix links in Changelog entry
2024-10-28 09:27:57 -07:00
Jeremy Meng 1cae9db8e1 [EngSys] remove "audit" NPM script and it's related file
as we no longer use it and rely on GitHub security features.

***NO_CI***
2024-10-25 19:28:06 +00:00
Jeremy Meng 59bb0809ba [EngSys] use vendored version of `mkdirp` and `rimraf` from dev-tool
also remove dependency on `@microsoft/api-extractor` as we already move to
`dev-tool run extract-api` which calls api-extractor Api instead.

***NO_CI***
2024-10-23 17:53:07 +00:00
Scott Addie 276c94b6d4
Improve API docs for DAC and ChainedTokenCredential (#31454)
Drive traffic to the new credential chains doc on Learn. Also, eliminate
duplication in the `DefaultAzureCredential` API docs.

---------

Co-authored-by: Karishma Ghiya <kaghiya@microsoft.com>
2024-10-19 09:34:54 -05:00
Minh-Anh Phan dfd239c0c5
[Identity] Add subscription property for AzureCliCredentialOptions (#31451)
Closes #27781

Add subscription property for AzureCliCredentialOptions

---------

Co-authored-by: Charles Lowell <10964656+chlowell@users.noreply.github.com>
2024-10-18 13:22:08 -07:00
Azure SDK Bot b18c38d1d1
Post release automated changes for identity releases (#31452)
Post release automated changes for azure-identity
2024-10-17 13:50:11 -07:00
KarishmaGhiya 2d33359509
[Identity] Add Pop token support (#30961)
Fixes https://github.com/Azure/azure-sdk-for-js/issues/23329

- Added SHR PoP token support to @azure/core-auth 
- Added SHR PoP token support to `InteractiveBrowserCredential` Native
Broker Scenarios via @azure/identity and @azure/identity-broker
2024-10-16 19:18:28 +00:00
Scott Addie e0becfcea0
Drive traffic to credential chains doc (#31414)
Replace much of the `DefaultAzureCredential` content in the Azure
Identity README with a link to the new credential chains doc on Learn.
2024-10-15 15:00:03 -05:00
Wes Haggard 1c50b6ac49
Switch to TME test subscription (#31329) 2024-10-14 18:19:12 -07:00
Maor Leger f64cb62716
[identity] Add to guidelines when to use MSAL directly (#31337)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

Resolves #31307

### Describe the problem that is addressed by this PR

It is not clear from our documentation that @azure/identity is optimized
for the "pass a credential to another client library" use-case and that
refreshing / caching / etc. are implementation details without proper API support and
documentation.

This PR attempts to provide additional information regarding when to use
something like MSAL directly.

---------

Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
2024-10-09 12:00:32 -07:00
KarishmaGhiya e460e3b0d4
[Identity] Azure pipelines credentials - added headers for troubleshooting and prevent redirection (#31209) 2024-10-07 12:33:29 -07:00
Matthew Podwysocki 61c8b9aae4 [EngSys] Add update-snippets to all package.json files ***NO_CI*** 2024-09-26 17:59:37 +00:00
Maor Leger 8b249ecdae
[identity] document various user-assigned managed identities (#31216)
Resolves #31214

---------

Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
2024-09-26 17:29:17 +00:00
Matthew Podwysocki 8597959155
[dev-tool] Add snippets extraction (#31143)
### Packages impacted by this PR

- @azure/dev-tool

### Issues associated with this PR

### Describe the problem that is addressed by this PR

This PR implements a new dev-tool command: `dev-tool run
update-snippets`.

This command looks for code fences in markdown files and JSDoc comments,
and updates them with the contents of test methods in a file named
`snippets.spec.ts`.

For example, the following fence indicates that the contents of a test
named "new_configurationclient" should be used:

````
```js snippet:new_configurationclient
```
````

After running `dev-tool run update-snippets`, the contents of the
snippet will be populated:

````
```js snippet:new_configurationclient
import { ConfigurationClient } from "@azure/template";
import { DefaultAzureCredential } from "@azure/identity";

const client = new ConfigurationClient(
  "<app configuration endpoint>",
  new DefaultAzureCredential()
);
```
````

To accomplish this, the command uses the TypeScript compiler API to
extract and transpile snippets from `snippets.spec.ts`. Snippets are the
contents of calls to the `it` function. If syntax with the shape
`it(<literal string>, <function with block>)` appears in
`snippets.spec.ts`, it will be considered a snippet that is valid for
injection.

("Function with block" means either a `function () { ... }` expression
or an arrow function with a block on the arrow side (`() => { ... }`).
An arrow function that has an expression on the right hand side (`() =>
(...)`) will not be recognized.)

For example:

```ts
  it("new_configurationclient", function () {
    // @ts-ignore
    const client = new ConfigurationClient(
      process.env.ENDPOINT ?? "<app configuration endpoint>",
      new DefaultAzureCredential()
    );
  });
```

The transpiler automatically "cleans" and validates the snippet using
similar techniques as the sample transpiler. As a result, it enforces
the same syntactic rules that the sample transpiler does. In addition to
those, it removes references to `process.env` (if an alternative is
specified), removes compiler pragmas like `// @ts-ignore`, and
automatically inserts imports for symbols that the snippet uses. So in
the above snippet, imports for `ConfigurationClient` and
`DefaultAzureCredential` are required, automatically detected, and
injected into the resulting snippet.

Snippets without `snippet:${name}` tags are _errors_ when using this
command, so a package must be fully migrated to use it.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_

- #24536

### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
2024-09-20 19:05:10 -04:00
Jeremy Meng a7b3656a05 [EngSys] upgrade dev dependency `typescript` version to `~5.6.2`
***NO_CI***

- replace version to "~5.6.2"
- rush update
- add `"skipLibCheck": true` for several packages that are affected by https://github.com/vitest-dev/vitest/issues/4688

- [formrecognizer] help TypeScript to understand with more explicit type

- [schema-registry-{avro,json}] skip lib check due to lru-cache issue with the Iterator TReturn change

https://github.com/isaacs/node-lru-cache/issues/348
2024-09-19 18:07:31 -07:00
KarishmaGhiya 1d8154ed5e
[Identity] update changelog for beta release (#31144) 2024-09-17 23:57:30 +00:00
Maor Leger c69c12472b
[identity] Support AZURE_AUTHORITY_HOST in cross cloud requests (#31134)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

#30557

### Describe the problem that is addressed by this PR

Looks like we missed one place where we need to read the
AZURE_AUTHORITY_HOST env var when porting logic over to msalClient. 
This PR addresses the issue and allows for environment variable to be read 
when needed.
2024-09-17 09:51:54 -07:00
KarishmaGhiya e58bc20587
[Identity] Client assertion add token cache persistence (#31129)
To have ClientAssertionCredentialOptions implement
ISupportsTokenCachePersistenceOptions. As a consumer of Identity, Azure
PowerShell is dependent on the Azure Identity library for .NET. Now the
client assertion workflow has increasing usage, so the ask should have
higher priority.

Business Impact:
In the client assertion auth flow, Azure PowerShell customers acquire
the access token with the federated token. The access token must be used
by the subsequent Azure PowerShell cmdlets. We depend on Azure.Identity
to save the tokens to the MSAL cache. As the federated token has a short
lifetime, it's impossible to cache the federated token and
reauthenticate every time a cmdlet is run.
2024-09-16 15:29:06 -07:00
Maor Leger 33c18dd48b
[identity] Use helper from core-util (#31115)
### Packages impacted by this PR

@azure/identity 

### Issues associated with this PR

#30187

### Describe the problem that is addressed by this PR

Now that core-util is published with a `calculateRetryDelay` helper, we
can use that instead of duplicating the logic from core-rest-pipeline

### Are there test cases added in this PR? _(If not, why?)_

There's an existing test suite for this policy, and this should be
considered a pure refactor now
2024-09-13 13:42:27 -07:00
KarishmaGhiya 9fd61e0dda
[identity] update changelog for a previous release (#31103) 2024-09-12 15:01:18 -07:00
Scott Addie 75132cedff
Edit pass on Azure Identity README (#31038)
**Summary of changes**
- Create new section for credential chains. Listing them in
"Authenticate Azure-hosted applications" is misleading.
- Incorporate Acrolinx feedback
- Remove unused links
- Document the `AZURE_CLIENT_SEND_CERTIFICATE_CHAIN` env var
2024-09-10 15:36:25 +00:00
Maor Leger db5023631b
[identity] Throw if user-assigned IDs are used for CloudShell MSI (#30955)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

Resolves #30380

### Describe the problem that is addressed by this PR

If the Cloud Shell ManagedIdentitySource is detected via MSAL and a
user-assigned managed identity clientID or resourceID is supplied, the
ManagedIdentityCredential should throw.

The rationale for taking this minor breaking change is that CloudShell
does not support specifying a clientID or ResourceID and the current
behavior of silently falling back to attempting to use a system-assigned
identity could be unexpected.

### Provide a list of related PRs _(if any)_

https://github.com/Azure/azure-sdk-for-cpp/pull/5837
2024-09-03 10:18:56 -07:00
KarishmaGhiya 6dd8b582e2
bump core versions (#30916) 2024-08-27 15:04:26 -07:00
Jeremy Meng d5f6d677ec [EngSys] standardize OSS copyright header
- [eslint-plugin] github-source-headers rule should use "MIT License".

  This change updates our linter rule and the whole repository to have consistent
  license header.

***NO_CI***

- remove "All rights reserved." from header

- "MIT license" => "MIT License"
2024-08-27 13:01:38 -07:00
KarishmaGhiya a8a48e1870
[Identity] [Core] Add support for refresh_on parameter (#30402) 2024-08-26 20:47:41 +00:00
Jeremy Meng f04044e34e [eslint] remove ESLINT_USE_FLAT_CONFIG=true env variable
now that we have moved to eslint v9.

***NO_CI***
2024-08-26 12:52:48 -07:00
Jeremy Meng 6015c69093 - [identity-broker] move sample to flat config 2024-08-23 16:38:09 -07:00
Jeremy Meng 5adb09d715 [engsys] upgrade dev dependency eslint to v9
***NO_CI***

- bump eslint version to ^9.9.0
- [eslint-plugin] remove eslint-plugin-import for now. Will re-visit until it supports eslint v9
2024-08-23 16:37:40 -07:00
Jeremy Meng 2ce3c5feb4 [eslint-plugin] upgrade typescript-eslint to v8
***NO_CI***

- bump typescript-eslint dependencies version to ~8.2.0

- [eslint-plugin] suppress new linting errors appearing with v8

- [eslint-plugin] react to removed typescript-eslint property

  related PR https://github.com/typescript-eslint/typescript-eslint/pull/9025

- [eslint-plugin] turn off @typescript-eslint/no-unused-expressions

  as no-unused-expressions is already reported by eslint

- [dev-tool] fix new linting errors

- Remove @typescript-eslint/ban-types that no longer exists

  and replace with more specific rules wherever applicable.

- [cosmosdb] combine the test eslint config with the main one

- delete catch expression when caught error is not used

- fix or suppress linting errors in code files
2024-08-23 10:19:23 -07:00
Maor Leger 295443be60
[identity] Add support for Managed Identity ObjectID (#30771)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

Resolves https://github.com/Azure/azure-sdk-for-js-pr/issues/262

### Describe the problem that is addressed by this PR

Adds support for providing an objectID to be used in managed Identity.
2024-08-22 12:46:44 -07:00
Maor Leger 65316d1a15
[identity] Use federated token in az cli (#30815)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

N/A - test fixes

### Describe the problem that is addressed by this PR

Identity client libraries need some extensive setup to test various
credentials in different workloads. Some of the commands
require the az cli, and this enables us to login using az cli.

Eventually, my hope is to use this to provide federated credentials for
keyvault managed HSMs resource creation where our credential expires by
the time the HSM is deployed
2024-08-22 12:15:47 -07:00
Jeremy Meng 4ab6590ffe Apply automated migration to eslint flat config 2024-08-22 11:43:19 -07:00
Jeremy Meng 405c244bb1 [linting] move perf tests to use eslint flat config
***NO_CI***

- add one flat config file for perf tests

- update NPM scripts of these packages to use that flat config for perf tests

  As eslint v8 still not switched to flat config by default, this change
  temporarily uses `cross-env` to set `ESLINT_USE_FLAT_CONFIG=true`

  Once we moved to eslint v9 the env var can be removed.
2024-08-15 10:56:56 -07:00
Azure SDK Bot 5669561f22
Post release automated changes for identity releases (#30749)
Post release automated changes for azure-identity
2024-08-13 17:07:14 -07:00
KarishmaGhiya ee3922c5cf
[identity] 4.5.0-beta.2 release (#30748) 2024-08-13 22:28:00 +00:00
Jeremy Meng 78671335a4
[EngSys] upgrade dev dependency `puppeteer` to ^23.0.2 (#30727)
- replace v22 version with v23 version
- run `rush update`
2024-08-13 12:05:49 -07:00
Maor Leger 3d843f8cbb
[identity] Update parameter validation errors (#30610)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR

Improve client error messages

### Describe the problem that is addressed by this PR

Noticed in passing in the AzurePipelinesCredential - the error message
lists all required parameters but does not specify _which_ parameter was not
provided.

Now that I am paying attention to errors, I did a sweep of our
credentials updating each credential with better / more specific error messages

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?

Alternatively we can add some method to collect all required parameters
and which were not provided to avoid getting errors one at a time for each
parameter, but I decided not to go that route here - keeping things
simple and straightforward
2024-08-13 08:27:19 -07:00
Maor Leger a4776a03a0
[identity] Add support for AsSecureString in PowerShellCredential (#30720)
### Packages impacted by this PR

@azure/identity 

### Issues associated with this PR

Resolves #30356

### Describe the problem that is addressed by this PR

Adds support for the `-AsSecureString` flag for
`AzurePowerShellCredential` in order to support upcoming breaking
changes from Az Pwsh modules in a backwards compat way
2024-08-12 15:31:31 -07:00
KarishmaGhiya 5513635f78
[Identity] update docs for IDC and device code credentials (#30656) 2024-08-05 12:59:16 -07:00
Maor Leger 0ee273f99a
[identity] Only set error.cause if it exists (#30629)
### Packages impacted by this PR

@azure/identity 

### Issues associated with this PR

N/A

### Describe the problem that is addressed by this PR

A minor cosmetic fix where we only set `cause` if it exists in the
options.
Before this change, node would print `[cause]: undefined` which can be
misleading. 

Now, we'll omit `cause` entirely if its not set.
2024-08-05 11:29:21 -07:00
Maor Leger 90d14cc69a
[identity] Errors can include a cause field (#30532)
### Packages impacted by this PR

@azure/identity

### Issues associated with this PR


### Describe the problem that is addressed by this PR


### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?

In order to improve the error experience for Managed Identity we want to
do a few things:

1. Remove misleading error messages like authority_not_found for any 400
2. Display the error's cause / InnerException / etc. 
3. Provide helpful debugging information in the exception message

(1) and (2) are done here, (3) is still in flux as I need to think about
what information will be helpful without being overwhelming.

### Are there test cases added in this PR? _(If not, why?)_

Printing out the error's cause is an implementation detail of the
runtime and _not_ something that gets stringified

Co-authored-by: Christopher Scott <chriscott@hotmail.com>
2024-08-01 12:01:58 -07:00