|
| 1 | +--- |
| 2 | +title: 'Create an Internet Analyzer test using CLI | Microsoft Docs' |
| 3 | +description: In this article, learn how to create your first Internet Analyzer test. |
| 4 | +services: internet-analyzer |
| 5 | +author: diego-perez-botero |
| 6 | + |
| 7 | +ms.service: internet-analyzer |
| 8 | +ms.topic: tutorial |
| 9 | +ms.date: 10/16/2019 |
| 10 | +ms.author: mebeatty |
| 11 | +# Customer intent: As someone interested in migrating to Azure/ AFD/ CDN, I want to set up an Internet Analyzer test to understand the expected performance impact to my end users. |
| 12 | + |
| 13 | +--- |
| 14 | +# Create an Internet Analyzer test using CLI (Preview) |
| 15 | + |
| 16 | +There are two ways to create an Internet Analyzer resource - using the [Azure portal](internet-analyzer-create-test-portal.md) or using CLI. This section helps you create a new Azure Internet Analyzer resource using our CLI experience. |
| 17 | + |
| 18 | + |
| 19 | +> [!IMPORTANT] |
| 20 | +> This public preview is provided without a service level agreement and should not be used for production workloads. Certain features may not be supported, may have constrained capabilities, or may not be available in all Azure locations. See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for details. |
| 21 | +> |
| 22 | +
|
| 23 | +## Before you begin |
| 24 | + |
| 25 | +The public preview is available to use globally; however, data storage is limited to *US West 2* during preview. |
| 26 | + |
| 27 | +## Object model |
| 28 | +The Internet Analyzer CLI exposes the following types of resources: |
| 29 | +* **Tests** - A test compares the end-user performance of two internet endpoints (A and B) over time. |
| 30 | +* **Profiles** - Tests are created under an Internet Analyzer profile. Profiles allow for related tests to be grouped; a single profile may contain one or more tests. |
| 31 | +* **Preconfigured Endpoints** - We have set up endpoints with a variety of configurations (regions, acceleration technologies, etc.). You may use any of these preconfigured endpoints in your tests. |
| 32 | +* **Scorecards** - A scorecard provides quick and meaningful summaries of measurement results. Refer to [Interpreting your Scorecard](internet-analyzer-scorecard.md). |
| 33 | +* **Time Series** - A time series shows how a metric changes over time. |
| 34 | + |
| 35 | +## Profile and Test Creation |
| 36 | +1. Get Internet Analyzer preview access by following the **How do I participate in the preview?** instructions from the [Azure Internet Analyzer FAQ](internet-analyzer-faq.md). |
| 37 | +2. [Install the Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest). |
| 38 | +3. Run the `login` command to start a CLI session: |
| 39 | + ```azurecli-interactive |
| 40 | + az login |
| 41 | + ``` |
| 42 | +
|
| 43 | + If the CLI can open your default browser, it will do so and load an Azure sign-in page. |
| 44 | + Otherwise, open a browser page at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal. |
| 45 | +
|
| 46 | +4. Sign in with your account credentials in the browser. |
| 47 | +
|
| 48 | +5. Select your Subscription ID that has been granted access to the Internet Analyzer public preview. |
| 49 | +
|
| 50 | + After logging in, you see a list of subscriptions associated with your Azure account. The subscription information with `isDefault: true` is the currently activated subscription after logging in. To select another subscription, use the [az account set](https://docs.microsoft.com/cli/azure/account#az-account-set) command with the subscription ID to switch to. For more information about subscription selection, see [Use multiple Azure subscriptions](https://docs.microsoft.com/cli/azure/manage-azure-subscriptions-azure-cli?view=azure-cli-latest). |
| 51 | +
|
| 52 | + There are ways to sign in non-interactively, which are covered in detail in [Sign in with Azure CLI](https://docs.microsoft.com/cli/azure/authenticate-azure-cli?view=azure-cli-latest). |
| 53 | +
|
| 54 | +6. **[Optional]** Create a new Azure Resource Group: |
| 55 | + ```azurecli-interactive |
| 56 | + az group create --location eastus --name "MyInternetAnalyzerResourceGroup" |
| 57 | + ``` |
| 58 | +
|
| 59 | +7. Install the Azure CLI Internet Analyzer Extension: |
| 60 | + ```azurecli-interactive |
| 61 | + az extension add --name internet-analyzer |
| 62 | + ``` |
| 63 | +
|
| 64 | +8. Create a new Internet Analyzer profile: |
| 65 | + ```azurecli-interactive |
| 66 | + az internet-analyzer profile create --location eastus --resource-group "MyInternetAnalyzerResourceGroup" --name "MyInternetAnalyzerProfile" --enabled-state Enabled |
| 67 | + ``` |
| 68 | +
|
| 69 | +9. List all preconfigured endpoints available to the newly created profile: |
| 70 | + ```azurecli-interactive |
| 71 | + az internet-analyzer preconfigured-endpoint list --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" |
| 72 | + ``` |
| 73 | +
|
| 74 | +10. Create a new test under the newly created InternetAnalyzer profile: |
| 75 | + ```azurecli-interactive |
| 76 | + az internet-analyzer test create --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" --endpoint-a-name "contoso" --endpoint-a-endpoint "www.contoso.com/some/path/to/trans.gif" --endpoint-b-name "microsoft" --endpoint-b-endpoint "www.microsoft.com/another/path/to/trans.gif" --name "MyFirstInternetAnalyzerTest" --enabled-state Enabled |
| 77 | + ``` |
| 78 | +
|
| 79 | + The command above assumes that both www.contoso.com and www.microsoft.com are hosting the one-pixel image ([trans.gif](https://fpc.msedge.net/apc/trans.gif)) under custom paths. If an object path isn't specified explicitly, Internet Analyzer will use `/apc/trans.gif` as the object path by default, which is where the preconfigured endpoints are hosting the one-pixel image. Also note that the schema (https/http) doesn't need to be specified; Internet Analyzer only supports HTTPS endpoints, so HTTPS is assumed. |
| 80 | +
|
| 81 | +11. The new test should appear under the Internet Analyzer profile: |
| 82 | + ```azurecli-interactive |
| 83 | + az internet-analyzer test list --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" |
| 84 | + ``` |
| 85 | +
|
| 86 | + Example output: |
| 87 | + ```` |
| 88 | + [ |
| 89 | + { |
| 90 | + "description": null, |
| 91 | + "enabledState": "Enabled", |
| 92 | + "endpointA": { |
| 93 | + "endpoint": "www.contoso.com/some/path/to/1k.jpg", |
| 94 | + "name": "contoso" |
| 95 | + }, |
| 96 | + "endpointB": { |
| 97 | + "endpoint": "www.microsoft.com/another/path/to/1k.jpg", |
| 98 | + "name": "microsoft" |
| 99 | + }, |
| 100 | + "id": "/subscriptions/faa9ddd0-9137-4659-99b7-cdc55a953342/resourcegroups/MyInternetAnalyzerResourceGroup/providers/Microsoft.Network/networkexperimentprofiles/MyInternetAnalyzerProfile/experiments/MyFirstInternetAnalyzerTest", |
| 101 | + "location": null, |
| 102 | + "name": "MyFirstInternetAnalyzerTest", |
| 103 | + "resourceGroup": "MyInternetAnalyzerResourceGroup", |
| 104 | + "resourceState": "Enabled", |
| 105 | + "scriptFileUri": "https://fpc.msedge.net/client/v2/d8c6fc64238d464c882cee4a310898b2/ab.min.js", |
| 106 | + "status": "Created", |
| 107 | + "tags": null, |
| 108 | + "type": "Microsoft.Network/networkexperimentprofiles/experiments" |
| 109 | + } |
| 110 | + ] |
| 111 | + ```` |
| 112 | +
|
| 113 | +12. To begin generating measurements, the JavaScript file pointed to by the test's **scriptFileUri** must be embedded in your Web application. Specific instructions can be found on the [Embed Internet Analyzer Client](internet-analyzer-embed-client.md) page. |
| 114 | +
|
| 115 | +13. You can monitor the test's progress by keeping track of its "status" value: |
| 116 | + ```azurecli-interactive |
| 117 | + az internet-analyzer test show --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" --name "MyFirstInternetAnalyzerTest" |
| 118 | + ``` |
| 119 | +
|
| 120 | +14. You can inspect the test's collected results by generating timeseries or scorecards for it: |
| 121 | + ```azurecli-interactive |
| 122 | + az internet-analyzer show-scorecard --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" --name "MyFirstInternetAnalyzerTest" --aggregation-interval "Daily" --end-date-time-utc "2019-10-24T00:00:00" |
| 123 | + ``` |
| 124 | +
|
| 125 | + ```azurecli-interactive |
| 126 | + az internet-analyzer show-timeseries --resource-group "MyInternetAnalyzerResourceGroup" --profile-name "MyInternetAnalyzerProfile" --name "MyFirstInternetAnalyzerTest" --aggregation-interval "Hourly" --start-date-time-utc "2019-10-23T00:00:00" --end-date-time-utc "2019-10-24T00:00:00" --timeseries-type MeasurementCounts |
| 127 | + ``` |
| 128 | +
|
| 129 | +
|
| 130 | +## Next steps |
| 131 | +
|
| 132 | +* Read the [Internet Analyzer FAQ](internet-analyzer-faq.md) |
| 133 | +* Learn more about embedding the [Internet Analyzer Client](internet-analyzer-embed-client.md) and creating a [custom endpoint](internet-analyzer-custom-endpoint.md). |
0 commit comments