Files
9d0b6db6b3 Fix broken Microsoft Learn documentation links in loadtesting package (#36500)
### Packages impacted by this PR

- @azure-rest/load-testing

### Issues associated with this PR

Fixes broken documentation links that were causing link verification
failures.

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

Microsoft Learn reorganized the Load Testing API documentation from
`/rest/api/loadtesting/` to `/rest/api/apptesting/loadtest/`. This
caused link verification failures across the README and sample files.

### 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?

Direct URL replacement is the only approach. Updated all references
from:
- `https://learn.microsoft.com/rest/api/loadtesting/` →
`https://learn.microsoft.com/rest/api/apptesting/loadtest/`
- `https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri` →
`https://learn.microsoft.com/rest/api/apptesting/loadtest/data-plane-uri`

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

No. Documentation link updates only. Link verification will be performed
by existing CI.

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

N/A

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

N/A

### Checklists
- [x] Added impacted package name to the issue description
- [x] 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)

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `learn.microsoft.com`
> - Triggering command: `curl -s -o /dev/null -w %{http_code} REDACTED`
(dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/Azure/azure-sdk-for-js/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>[doc] loadtesting readme broken links</issue_title>
> <issue_description>We got this failure in link verification:
> 
> >Summary of broken links:
>
'file:///mnt/vss/_work/1/s/sdk/loadtesting/load-testing-rest/README.md'
has 2 broken link(s):
>   https://learn.microsoft.com/rest/api/loadtesting/
>   https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri
> Checked 98 links with 1 broken link(s) found.
> 
> Looks that the url has been changed to 
> 
>
https://learn.microsoft.com/rest/api/apptesting/loadtest/</issue_description>
> 
> <agent_instructions>Fix the issue by updating the broken
links</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

- Fixes Azure/azure-sdk-for-js#36499

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jeremymeng <[email protected]>
2025-11-12 16:04:07 -08:00

51 lines
1.7 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how to add App Components to an existing test.
*
* @summary Demonstrates how to add app components to an existing test.
*/
import AzureLoadTesting, { isUnexpected } from "@azure-rest/load-testing";
import { DefaultAzureCredential } from "@azure/identity";
async function main(): Promise<void> {
/**
* The dataplane endpoint for the Azure Load Testing resource.
* Refer to https://learn.microsoft.com/rest/api/apptesting/loadtest/data-plane-uri to understand how to obtain the data-plane endpoint.
*/
const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || "";
/** Microsoft Entra ID authentication */
/**
* In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth
*/
const credential = new DefaultAzureCredential();
const testId = process.env["LOADTESTSERVICE_TESTID"] || ""; // TestId of a test already created.
// Build a client through AAD
const client = AzureLoadTesting(endpoint, credential);
const appComponentCreationResult = await client
.path("/tests/{testId}/app-components", testId)
.patch({
contentType: "application/merge-patch+json",
body: {
components: {
"/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/App-Service-Sample-Demo-rg/providers/Microsoft.Web/sites/App-Service-Sample-Demo":
{
resourceName: "App-Service-Sample-Demo",
resourceType: "Microsoft.Web/sites",
},
},
},
});
if (isUnexpected(appComponentCreationResult)) {
throw appComponentCreationResult.body.error;
}
}
main().catch(console.error);