Updates from: 11/04/2023 02:25:25
Service Microsoft Docs article Related commit history on GitHub Change details
active-directory-b2c Custom Email Mailjet https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/custom-email-mailjet.md
As with the OTP technical profiles, add the following technical profiles to the
<DisplayName>RestfulProvider</DisplayName> <TechnicalProfiles> <TechnicalProfile Id="sendOtp">
- <DisplayName>Use email API to send the code the the user</DisplayName>
+ <DisplayName>Use email API to send the code to the user</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Metadata> <Item Key="ServiceUrl">https://api.mailjet.com/v3.1/send</Item>
active-directory-b2c Custom Email Sendgrid https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/custom-email-sendgrid.md
As with the OTP technical profiles, add the following technical profiles to the
<DisplayName>RestfulProvider</DisplayName> <TechnicalProfiles> <TechnicalProfile Id="SendOtp">
- <DisplayName>Use SendGrid's email API to send the code the the user</DisplayName>
+ <DisplayName>Use SendGrid's email API to send the code to the user</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Metadata> <Item Key="ServiceUrl">https://api.sendgrid.com/v3/mail/send</Item>
active-directory-b2c Custom Policies Series Validate User Input https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/custom-policies-series-validate-user-input.md
Use the following steps to validate password re-enter in your custom policy:
```xml <DisplayClaim ClaimTypeReferenceId="reenterPassword" Required="true"/> ```
-1. In your your `ContosoCustomPolicy.XML` file, locate the `UserInformationCollector` self-asserted technical profile, add *reenterPassword* claim as an output claim by using the following code:
+1. In your `ContosoCustomPolicy.XML` file, locate the `UserInformationCollector` self-asserted technical profile, add *reenterPassword* claim as an output claim by using the following code:
```xml <OutputClaim ClaimTypeReferenceId="reenterPassword"/>
active-directory-b2c Identity Verification Proofing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/identity-verification-proofing.md
With Azure Active Directory B2C (Azure AD B2C) and solutions from software-vendo
The following architecture diagram illustrates the verification and proofing flow.
- ![Diagram of of the identity proofing flow, from registration to access approval.](./media/partner-gallery/third-party-identity-proofing.png)
+ ![Diagram of the identity proofing flow, from registration to access approval.](./media/partner-gallery/third-party-identity-proofing.png)
1. User begins registration with a device. 2. User enters information.
active-directory-b2c Jwt Issuer Technical Profile https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/jwt-issuer-technical-profile.md
The **InputClaims**, **OutputClaims**, and **PersistClaims** elements are empty
| rolling_refresh_token_lifetime_secs | No | Refresh token sliding window lifetime. After this time period elapses the user is forced to reauthenticate, irrespective of the validity period of the most recent refresh token acquired by the application. If you don't want to enforce a sliding window lifetime, set the value of allow_infinite_rolling_refresh_token to `true`. The default is 7,776,000 seconds (90 days). The minimum (inclusive) is 86,400 seconds (24 hours). The maximum (inclusive) is 31,536,000 seconds (365 days). | | allow_infinite_rolling_refresh_token | No | If set to `true`, the refresh token sliding window lifetime never expires. | | IssuanceClaimPattern | No | Controls the Issuer (iss) claim. One of the values:<ul><li>AuthorityAndTenantGuid - The iss claim includes your domain name, such as `login.microsoftonline` or `tenant-name.b2clogin.com`, and your tenant identifier https:\//login.microsoftonline.com/00000000-0000-0000-0000-000000000000/v2.0/</li><li>AuthorityWithTfp - The iss claim includes your domain name, such as `login.microsoftonline` or `tenant-name.b2clogin.com`, your tenant identifier and your relying party policy name. https:\//login.microsoftonline.com/tfp/00000000-0000-0000-0000-000000000000/b2c_1a_tp_sign-up-or-sign-in/v2.0/</li></ul> Default value: AuthorityAndTenantGuid |
-| AuthenticationContextReferenceClaimPattern | No | Controls the `acr` claim value.<ul><li>None - Azure AD B2C doesn't issue the acr claim</li><li>PolicyId - the `acr` claim contains the policy name</li></ul>The options for setting this value are TFP (trust framework policy) and ACR (authentication context reference). It is recommended setting this value to TFP, to set the value, ensure the `<Item>` with the `Key="AuthenticationContextReferenceClaimPattern"` exists and the value is `None`. In your relying party policy, add `<OutputClaims>` item, add this element `<OutputClaim ClaimTypeReferenceId="trustFrameworkPolicy" Required="true" DefaultValue="{policy}" />`. Also make sure your policy contains the claim type `<ClaimType Id="trustFrameworkPolicy"> <DisplayName>trustFrameworkPolicy</DisplayName> <DataType>string</DataType> </ClaimType>` |
+| AuthenticationContextReferenceClaimPattern | No | Controls the `acr` claim value.<ul><li>None - Azure AD B2C doesn't issue the acr claim</li><li>PolicyId - the `acr` claim contains the policy name</li></ul>The options for setting this value are TFP (trust framework policy) and ACR (authentication context reference). It is recommended setting this value to TFP, to set the value, ensure the `<Item>` with the `Key="AuthenticationContextReferenceClaimPattern"` exists and the value is `None`. In your relying party policy, add `<OutputClaims>` item, add this element `<OutputClaim ClaimTypeReferenceId="trustFrameworkPolicy" Required="true" DefaultValue="{policy}" PartnerClaimType="tfp"/>`. Also make sure your policy contains the claim type `<ClaimType Id="trustFrameworkPolicy"> <DisplayName>trustFrameworkPolicy</DisplayName> <DataType>string</DataType> </ClaimType>` |
|RefreshTokenUserJourneyId| No | The identifier of a user journey that should be executed during the [refresh an access token](authorization-code-flow.md#4-refresh-the-token) POST request to the `/token` endpoint. | ## Cryptographic keys
active-directory-b2c Restful Technical Profile https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/restful-technical-profile.md
The following example `TechnicalProfile` sends a verification email by using a t
```xml <TechnicalProfile Id="SendGrid">
- <DisplayName>Use SendGrid's email API to send the code the the user</DisplayName>
+ <DisplayName>Use SendGrid's email API to send the code to the user</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Metadata> <Item Key="ServiceUrl">https://api.sendgrid.com/v3/mail/send</Item>
active-directory-b2c User Profile Attributes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/active-directory-b2c/user-profile-attributes.md
For federated identities, depending on the identity provider, the **issuerAssign
## Password profile property
-For a local identity, the **passwordProfile** attribute is required, and contains the user's password. The `forceChangePasswordNextSignIn` attribute indicates whether a user must reset the password at the next sign-in. To handle a forced password reset, us the the instructions in [set up forced password reset flow](force-password-reset.md).
+For a local identity, the **passwordProfile** attribute is required, and contains the user's password. The `forceChangePasswordNextSignIn` attribute indicates whether a user must reset the password at the next sign-in. To handle a forced password reset, use the instructions in [set up forced password reset flow](force-password-reset.md).
For a federated (social) identity, the **passwordProfile** attribute is not required.
advisor Advisor Reference Cost Recommendations https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/advisor/advisor-reference-cost-recommendations.md
Learn more about [Subscription - SQLDWReservedCapacity (Consider Azure Synapse A
We analyzed your Azure Blob and Data Lake storage usage over last 30 days and calculated a Reserved Instance purchase that would maximize your savings. With reserved instances, you can prepurchase hourly usage and save over your current on-demand costs. Blob storage reserved instances applies only to data stored on Azure Blob (GPv2) and Azure Data Lake Storage (Gen 2). Reserved Instance is a billing benefit and automatically applies to new or existing deployments. Saving estimates are calculated for individual subscriptions and the usage pattern observed over last 30 days. Shared scope recommendations are available in reservation purchase experience and can increase savings further.
-Learn more about [Subscription - BlobReservedCapacity ((Preview) Consider Blob storage reserved instances to save on Blob v2 and and Data Lake storage Gen2 costs)](https://aka.ms/rirecommendations).
+Learn more about [Subscription - BlobReservedCapacity ((Preview) Consider Blob storage reserved instances to save on Blob v2 and Data Lake storage Gen2 costs)](https://aka.ms/rirecommendations).
### Consider Azure Dedicated Host reserved instances to save over your on-demand costs
ai-services Role Based Access Control https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/LUIS/role-based-access-control.md
A user that is responsible for building and modifying LUIS application, as a col
### Cognitive Services LUIS Owner > [!NOTE]
-> * If you are assigned as an *Owner* and *LUIS Owner* you will be be shown as *LUIS Owner* in LUIS portal.
+> * If you are assigned as an *Owner* and *LUIS Owner* you will be shown as *LUIS Owner* in LUIS portal.
These users are the gatekeepers for LUIS applications in a production environment. They should have full access to any of the underlying functions and thus can view everything in the application and have direct access to edit any changes for both authoring and runtime environments.
ai-services Spatial Analysis Logging https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/computer-vision/spatial-analysis-logging.md
Spatial Analysis includes a set of features to monitor the health of the system
To enable a visualization of AI Insight events in a video frame, you need to use the `.debug` version of a [Spatial Analysis operation](spatial-analysis-operations.md) on a desktop machine or Azure VM. The visualization is not possible on Azure Stack Edge devices. There are four debug operations available.
-If your device is a local desktop machine or Azure GPU VM (with remote desktop enabled), then then you can switch to `.debug` version of any operation and visualize the output.
+If your device is a local desktop machine or Azure GPU VM (with remote desktop enabled), then you can switch to `.debug` version of any operation and visualize the output.
1. Open the desktop either locally or by using a remote desktop client on the host computer running Spatial Analysis. 2. In the terminal run `xhost +`
ai-services Limits And Quotas https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/custom-vision-service/limits-and-quotas.md
The number of training images per project and tags per project are expected to i
|Max number of tags per image (classification)|100|100| > [!NOTE]
-> Images smaller than than 256 pixels will be accepted but upscaled.
+> Images smaller than 256 pixels will be accepted but upscaled.
> Image aspect ratio should not be larger than 25:1.
ai-services Build A Custom Model https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/document-intelligence/how-to-guides/build-a-custom-model.md
The Document Intelligence Studio provides and orchestrates all the API calls req
1. On the next step in the workflow, choose or create a Document Intelligence resource before you select continue. > [!IMPORTANT]
- > Custom neural models models are only available in a few regions. If you plan on training a neural model, please select or create a resource in one of [these supported regions](../concept-custom-neural.md#supported-regions).
+ > Custom neural models are only available in a few regions. If you plan on training a neural model, please select or create a resource in one of [these supported regions](../concept-custom-neural.md#supported-regions).
:::image type="content" source="../media/how-to/studio-select-resource.png" alt-text="Screenshot of Select the Document Intelligence resource.":::
ai-services Role Based Access Control https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/language-service/concepts/role-based-access-control.md
A user that is responsible for building and modifying an application, as a colla
### Cognitive Services Language Owner > [!NOTE]
-> If you are assigned as an *Owner* and *Language Owner* you will be be shown as *Cognitive Services Language Owner* in Language studio portal.
+> If you are assigned as an *Owner* and *Language Owner* you will be shown as *Cognitive Services Language Owner* in Language studio portal.
These users are the gatekeepers for the Language applications in production environments. They should have full access to any of the underlying functions and thus can view everything in the application and have direct access to edit any changes for both authoring and runtime environments
ai-services Evaluation Metrics https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/language-service/custom-text-classification/concepts/evaluation-metrics.md
After you trained your model, you will see some guidance and recommendation on h
> [!Important] > Confusion matrix is not available for multi-label classification projects. A Confusion matrix is an N x N matrix used for model performance evaluation, where N is the number of classes.
-The matrix compares the the expected labels with the ones predicted by the model.
+The matrix compares the expected labels with the ones predicted by the model.
This gives a holistic view of how well the model is performing and what kinds of errors it is making. You can use the Confusion matrix to identify classes that are too close to each other and often get mistaken (ambiguity). In this case consider merging these classes together. If that isn't possible, consider labeling more documents with both classes to help the model differentiate between them.
ai-services Content Filter https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/openai/concepts/content-filter.md
The default content filtering configuration is set to filter at the medium sever
| High | If approved<sup>\*</sup>| If approved<sup>\*</sup> | Content detected at severity levels low and medium isn't filtered. Only content at severity level high is filtered. Requires approval<sup>\*</sup>.| | No filters | If approved<sup>\*</sup>| If approved<sup>\*</sup>| No content is filtered regardless of severity level detected. Requires approval<sup>\*</sup>.|
-<sup>\*</sup> Only customers who have been approved for modified content filtering have full content filtering control, including configuring content filters at severity level high only or turning content filters off. Apply for modified content filters via this form: [Azure OpenAI Limited Access Review: Modified Content Filters and Abuse Monitoring (microsoft.com)](https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xURE01NDY1OUhBRzQ3MkQxMUhZSE1ZUlJKTiQlQCN0PWcu)
+<sup>\*</sup> Only customers who have been approved for modified content filtering have full content filtering control, including configuring content filters at severity level high only or turning content filters off. Apply for modified content filters via this form: [Azure OpenAI Limited Access Review:ΓÇ» Modified Content Filtering (microsoft.com)](https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xUMlBQNkZMR0lFRldORTdVQzQ0TEI5Q1ExOSQlQCN0PWcu)
Content filtering configurations are created within a Resource in Azure AI Studio, and can be associated with Deployments. [Learn more about configurability here](../how-to/content-filters.md).
As part of your application design, consider the following best practices to del
## Next steps - Learn more about the [underlying models that power Azure OpenAI](../concepts/models.md).-- Apply for modified content filters via [this form](https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xURE01NDY1OUhBRzQ3MkQxMUhZSE1ZUlJKTiQlQCN0PWcu).
+- Apply for modified content filters via [this form](https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xUMlBQNkZMR0lFRldORTdVQzQ0TEI5Q1ExOSQlQCN0PWcu).
- Azure OpenAI content filtering is powered by [Azure AI Content Safety](https://azure.microsoft.com/products/cognitive-services/ai-content-safety). - Learn more about understanding and mitigating risks associated with your application: [Overview of Responsible AI practices for Azure OpenAI models](/legal/cognitive-services/openai/overview?context=/azure/ai-services/openai/context/context). - Learn more about how data is processed in connection with content filtering and abuse monitoring: [Data, privacy, and security for Azure OpenAI Service](/legal/cognitive-services/openai/data-privacy?context=/azure/ai-services/openai/context/context#preventing-abuse-and-harmful-content-generation).++
ai-services Embeddings https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/openai/how-to/embeddings.md
Previously updated : 9/12/2023-- Last updated : 11/02/2023++ recommendations: false keywords:
foreach (float item in returnValue.Value.Data[0].Embedding)
### Verify inputs don't exceed the maximum length
-The maximum length of input text for our embedding models is 2048 tokens (equivalent to around 2-3 pages of text). You should verify that your inputs don't exceed this limit before making a request.
-
-### Choose the best model for your task
-
-For the search models, you can obtain embeddings in two ways. The `<search_model>-doc` model is used for longer pieces of text (to be searched over) and the `<search_model>-query` model is used for shorter pieces of text, typically queries or class labels in zero shot classification. You can read more about all of the Embeddings models in our [Models](../concepts/models.md) guide.
-
-### Replace newlines with a single space
-
-Unless you're embedding code, we suggest replacing newlines (\n) in your input with a single space, as we have observed inferior results when newlines are present.
+The maximum length of input text for our latest embedding models is 8192 tokens. You should verify that your inputs don't exceed this limit before making a request.
## Limitations & risks
ai-services Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/policy-reference.md
Title: Built-in policy definitions for Azure AI services description: Lists Azure Policy built-in policy definitions for Azure AI services. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
ai-services Export Knowledge Base https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/qnamaker/Tutorials/export-knowledge-base.md
You may want to create a copy of your knowledge base for several reasons:
## Import a knowledge base 1. Select **Create a knowledge base** from the top menu of the qnamaker.ai portal and then create an _empty_ knowledge base by not adding any URLs or files. Set the name of your choice for the new knowledge base and then ClickΓÇ»**Create your KB**.
-1. In this new knowledge base, open the **Settings** tab and and under _Import knowledge base_ select one of the following options: **QnAs**, **Synonyms**, or **Knowledge Base Replica**.
+1. In this new knowledge base, open the **Settings** tab and under _Import knowledge base_ select one of the following options: **QnAs**, **Synonyms**, or **Knowledge Base Replica**.
1. **QnAs**: This option imports all QnA pairs. **The QnA pairs created in the new knowledge base shall have the same QnA ID as present in the exported file**. You can refer [SampleQnAs.xlsx](https://aka.ms/qnamaker-sampleqnas), [SampleQnAs.tsv](https://aka.ms/qnamaker-sampleqnastsv) to import QnAs. 2. **Synonyms**: This option can be used to import synonyms to the knowledge base. You can refer [SampleSynonyms.xlsx](https://aka.ms/qnamaker-samplesynonyms), [SampleSynonyms.tsv](https://aka.ms/qnamaker-samplesynonymstsv) to import synonyms.
ai-services Logging Audio Transcription https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ai-services/speech-service/logging-audio-transcription.md
Here's a sample output of [Endpoints_ListLogs](https://eastus.dev.cognitive.micr
}, "createdDateTime": "2023-03-13T16:37:15Z", "links": {
- "contentUrl": "<Link to to download log file>"
+ "contentUrl": "<Link to download log file>"
} } ]
aks Aks Migration https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/aks-migration.md
Title: Migrate to Azure Kubernetes Service (AKS)
-description: This article shows you how to to Azure Kubernetes Service (AKS).
+description: This article shows you how to migrate to Azure Kubernetes Service (AKS).
Last updated 05/30/2023
aks App Routing Configuration https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/app-routing-configuration.md
+
+ Title: Customize the application routing add-on for Azure Kubernetes Service (AKS)
+description: Understand what advanced configuration options are supported with the application routing add-on for Azure Kubernetes Service.
+++ Last updated : 11/03/2023++
+# Advanced Ingress configurations with the application routing add-on
+
+An Ingress is an API object that defines rules, which allow external access to services in an Azure Kubernetes Service (AKS) cluster. When you create an Ingress object that uses the application routing add-on nginx Ingress classes, the add-on creates, configures, and manages one or more Ingress controllers in your AKS cluster.
+
+This article shows you how to set up an advanced Ingress configuration to encrypt the traffic and use Azure DNS to manage DNS zones.
+
+## Application routing add-on with nginx features
+
+The application routing add-on with nginx delivers the following:
+
+* Easy configuration of managed nginx Ingress controllers based on [Kubernetes nginx Ingress controller][kubernetes-nginx-ingress].
+* Integration with an external DNS such as [Azure DNS][azure-dns-overview] for public and private zone management
+* SSL termination with certificates stored in a key vault, such as [Azure Key Vault][azure-key-vault-overview].
+
+## Prerequisites
+
+- An AKS cluster with the [application routing add-on][app-routing-add-on-basic-configuration].
+- Azure Key Vault if you want to configure SSL termination and store certificates in the vault hosted in Azure.
+- Azure DNS if you want to configure public and private zone management and host them in Azure.
+
+## Connect to your AKS cluster
+
+To connect to the Kubernetes cluster from your local computer, you use `kubectl`, the Kubernetes command-line client. You can install it locally using the [az aks install-cli][az-aks-install-cli] command. If you use the Azure Cloud Shell, `kubectl` is already installed.
+
+Configure kubectl to connect to your Kubernetes cluster using the [`az aks get-credentials`][az-aks-get-credentials] command.
+
+```bash
+az aks get-credentials -g <ResourceGroupName> -n <ClusterName>
+```
+
+## Terminate HTTPS traffic
+
+To enable support for HTTPS traffic, see the following prerequisites:
+
+* **azure-keyvault-secrets-provider**: The [Secret Store CSI provider][secret-store-csi-provider] for Azure Key Vault is required to retrieve the certificates from Azure Key Vault.
+
+ > [!IMPORTANT]
+ > To enable the add-on to reload certificates from Azure Key Vault when they change, you should to enable the [secret autorotation feature][csi-secrets-store-autorotation] of the Secret Store CSI driver with the `--enable-secret-rotation` argument. When autorotation is enabled, the driver updates the pod mount and the Kubernetes secret by polling for changes periodically, based on the rotation poll interval you define. The default rotation poll interval is two minutes.
+
+* An SSL certificate. If you don't have one, you can [create a certificate][create-and-export-a-self-signed-ssl-certificate].
+
+### Enable key vault secrets provider
+
+To enable application routing on your cluster, use the [`az aks enable-addons`][az-aks-enable-addons] command specifying `azure-keyvault-secrets-provider` with the `--addons` argument and the `--enable-secret-rotation` argument.
+
+```azurecli-interactive
+az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons azure-keyvault-secrets-provider --enable-secret-rotation
+```
+
+### Create an Azure Key Vault to store the certificate
+
+> [!NOTE]
+> If you already have an Azure Key Vault, you can skip this step.
+
+Create an Azure Key Vault using the [`az keyvault create`][az-keyvault-create] command.
+
+```azurecli-interactive
+az keyvault create -g <ResourceGroupName> -l <Location> -n <KeyVaultName>
+```
+
+### Create and export a self-signed SSL certificate
+
+1. Create a self-signed SSL certificate to use with the Ingress using the `openssl req` command. Make sure you replace *`<Hostname>`* with the DNS name you're using.
+
+ ```bash
+ openssl req -new -x509 -nodes -out aks-ingress-tls.crt -keyout aks-ingress-tls.key -subj "/CN=<Hostname>" -addext "subjectAltName=DNS:<Hostname>"
+ ```
+
+2. Export the SSL certificate and skip the password prompt using the `openssl pkcs12 -export` command.
+
+ ```bash
+ openssl pkcs12 -export -in aks-ingress-tls.crt -inkey aks-ingress-tls.key -out aks-ingress-tls.pfx
+ ```
+
+### Import certificate into Azure Key Vault
+
+Import the SSL certificate into Azure Key Vault using the [`az keyvault certificate import`][az-keyvault-certificate-import] command. If your certificate is password protected, you can pass the password through the `--password` flag.
+
+```azurecli-interactive
+az keyvault certificate import --vault-name <KeyVaultName> -n <KeyVaultCertificateName> -f aks-ingress-tls.pfx [--password <certificate password if specified>]
+```
+
+### Retrieve the add-on's managed identity object ID
+
+You use the managed identity in the next steps to grant permissions to manage the Azure DNS zone and retrieve secrets and certificates from the Azure Key Vault.
+
+Get the add-on's managed identity object ID using the [`az aks show`][az-aks-show] command and setting the output to a variable named `MANAGEDIDENTITY_OBJECTID`.
+
+```bash
+# Provide values for your environment
+RGNAME=<ResourceGroupName>
+CLUSTERNAME=<ClusterName>
+MANAGEDIDENTITY_OBJECTID=$(az aks show -g ${RGNAME} -n ${CLUSTERNAME} --query ingressProfile.webAppRouting.identity.objectId -o tsv)
+```
+
+### Grant the add-on permissions to retrieve certificates from Azure Key Vault
+
+The application routing add-on creates a user-created managed identity in the cluster resource group. You need to grant permissions to the managed identity so it can retrieve SSL certificates from the Azure Key Vault.
+
+Azure Key Vault offers [two authorization systems][authorization-systems]: **Azure role-based access control (Azure RBAC)**, which operates on the management plane, and the **access policy model**, which operates on both the management plane and the data plane. To find out which system your key vault is using, you can query the `enableRbacAuthorization` property.
+
+```azurecli-interactive
+az keyvault show --name <KeyVaultName> --query properties.enableRbacAuthorization
+```
+
+If Azure RBAC authorization is enabled for your key vault, you should configure permissions using Azure RBAC. Add the `Key Vault Secrets User` role assignment to the key vault by running the following commands.
+
+```azurecli-interactive
+KEYVAULTID=$(az keyvault show --name <KeyVaultName> --query "id" --output tsv)
+az role assignment create --role "Key Vault Secrets User" --assignee $MANAGEDIDENTITY_OBJECTID --scope $KEYVAULTID
+```
+
+If Azure RBAC authorization isn't enabled for your key vault, you should configure permissions using the access policy model. Grant `GET` permissions for the application routing add-on to retrieve certificates from Azure Key Vault using the [`az keyvault set-policy`][az-keyvault-set-policy] command.
+
+```azurecli-interactive
+az keyvault set-policy --name <KeyVaultName> --object-id $MANAGEDIDENTITY_OBJECTID --secret-permissions get --certificate-permissions get
+```
+
+## Configure the add-on to use Azure DNS to manage DNS zones
+
+To enable support for DNS zones, see the following prerequisites:
+
+* The app routing add-on can be configured to automatically create records on one or more Azure public and private DNS zones for hosts defined on Ingress resources. All global Azure DNS zones need to be in the same resource group, and all private Azure DNS zones need to be in the same resource group. If you don't have an Azure DNS zone, you can [create one][create-an-azure-dns-zone].
+
+ > [!NOTE]
+ > If you plan to use Azure DNS, you need to update the add-on to include the `--dns-zone-resource-ids` argument. You can pass a comma separated list of multiple public or private Azure DNS zone resource IDs.
+
+### Create a global Azure DNS zone
+
+1. Create an Azure DNS zone using the [`az network dns zone create`][az-network-dns-zone-create] command.
+
+ ```azurecli-interactive
+ az network dns zone create -g <ResourceGroupName> -n <ZoneName>
+ ```
+
+1. Retrieve the resource ID for the DNS zone using the [`az network dns zone show`][az-network-dns-zone-show] command and set the output to a variable named *ZONEID*.
+
+ ```azurecli-interactive
+ ZONEID=$(az network dns zone show -g <ResourceGroupName> -n <ZoneName> --query "id" --output tsv)
+ ```
+
+1. Grant **DNS Zone Contributor** permissions on the DNS zone using the [`az role assignment create`][az-role-assignment-create] command.
+
+ ```azurecli-interactive
+ az role assignment create --role "DNS Zone Contributor" --assignee $MANAGEDIDENTITY_OBJECTID --scope $ZONEID
+ ```
+
+1. Update the add-on to enable the integration with Azure DNS and install the **external-dns** controller using the [`az aks addon update`][az-aks-addon-update] command.
+
+ ```azurecli-interactive
+ az aks addon update -g <ResourceGroupName> -n <ClusterName> --addon web_application_routing --dns-zone-resource-ids=$ZONEID
+ ```
+
+## Create the Ingress
+
+The application routing add-on creates an Ingress class on the cluster named *webapprouting.kubernetes.azure.com*. When you create an Ingress object with this class, it activates the add-on.
+
+1. Get the certificate URI to use in the Ingress from Azure Key Vault using the [`az keyvault certificate show`][az-keyvault-certificate-show] command.
+
+ ```azurecli-interactive
+ az keyvault certificate show --vault-name <KeyVaultName> -n <KeyVaultCertificateName> --query "id" --output tsv
+ ```
+
+2. Copy the following YAML manifest into a new file named **ingress.yaml** and save the file to your local computer.
+
+ > [!NOTE]
+ > Update *`<Hostname>`* with your DNS host name and *`<KeyVaultCertificateUri>`* with the ID returned from Azure Key Vault.
+ > The *`secretName`* key in the `tls` section defines the name of the secret that contains the certificate for this Ingress resource. This certificate will be presented in the browser when a client browses to the URL defined in the `<Hostname>` key. Make sure that the value of `secretName` is equal to `keyvault-` followed by the value of the Ingress resource name (from `metadata.name`). In the example YAML, secretName will need to be equal to `keyvault-<your Ingress name>`.
+
+ ```yml
+ apiVersion: networking.k8s.io/v1
+ kind: Ingress
+ metadata:
+ annotations:
+ kubernetes.azure.com/tls-cert-keyvault-uri: <KeyVaultCertificateUri>
+ name: aks-helloworld
+ namespace: hello-web-app-routing
+ spec:
+ ingressClassName: webapprouting.kubernetes.azure.com
+ rules:
+ - host: <Hostname>
+ http:
+ paths:
+ - backend:
+ service:
+ name: aks-helloworld
+ port:
+ number: 80
+ path: /
+ pathType: Prefix
+ tls:
+ - hosts:
+ - <Hostname>
+ secretName: keyvault-<your ingress name>
+ ```
+
+3. Create the cluster resources using the [`kubectl apply`][kubectl-apply] command.
+
+ ```bash
+ kubectl apply -f ingress.yaml -n hello-web-app-routing
+ ```
+
+ The following example output shows the created resource:
+
+ ```output
+ Ingress.networking.k8s.io/aks-helloworld created
+ ```
+
+## Verify the managed Ingress was created
+
+You can verify the managed Ingress was created using the [`kubectl get ingress`][kubectl-get] command.
+
+```bash
+kubectl get ingress -n hello-web-app-routing
+```
+
+The following example output shows the created managed Ingress:
+
+```output
+NAME CLASS HOSTS ADDRESS PORTS AGE
+aks-helloworld webapprouting.kubernetes.azure.com myapp.contoso.com 20.51.92.19 80, 443 4m
+```
+
+## Next steps
+
+Learn about monitoring the Ingress-nginx controller metrics included with the application routing add-on with [with Prometheus in Grafana][prometheus-in-grafana] (preview) as part of analyzing the performance and usage of your application.
+
+<!-- LINKS - external -->
+[kubectl-apply]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply
+[kubectl-get]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get
+
+<!-- LINKS - internal -->
+[app-routing-add-on-basic-configuration]: app-routing.md
+[secret-store-csi-provider]: csi-secrets-store-driver.md
+[csi-secrets-store-autorotation]: csi-secrets-store-configuration-options.md#enable-and-disable-auto-rotation
+[az-keyvault-set-policy]: /cli/azure/keyvault#az-keyvault-set-policy
+[azure-key-vault-overview]: ../key-vault/general/overview.md
+[az-aks-addon-update]: /cli/azure/aks/addon#az-aks-addon-update
+[az-network-dns-zone-show]: /cli/azure/network/dns/zone#az-network-dns-zone-show
+[az-role-assignment-create]: /cli/azure/role/assignment#az-role-assignment-create
+[az-network-dns-zone-create]: /cli/azure/network/dns/zone#az-network-dns-zone-create
+[az-keyvault-certificate-import]: /cli/azure/keyvault/certificate#az-keyvault-certificate-import
+[az-keyvault-create]: /cli/azure/keyvault#az-keyvault-create
+[authorization-systems]: ../key-vault/general/rbac-access-policy.md
+[az-aks-install-cli]: /cli/azure/aks#az-aks-install-cli
+[az-aks-get-credentials]: /cli/azure/aks#az-aks-get-credentials
+[create-and-export-a-self-signed-ssl-certificate]: #create-and-export-a-self-signed-ssl-certificate
+[create-an-azure-dns-zone]: #create-a-global-azure-dns-zone
+[azure-dns-overview]: ../dns/dns-overview.md
+[az-keyvault-certificate-show]: /cli/azure/keyvault/certificate#az-keyvault-certificate-show
+[az-aks-enable-addons]: /cli/azure/aks/addon#az-aks-enable-addon
+[az-aks-show]: /cli/azure/aks/addon#az-aks-show
+[prometheus-in-grafana]: app-routing-nginx-prometheus.md
aks App Routing Migration https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/app-routing-migration.md
Previously updated : 08/18/2023 Last updated : 11/03/2023 # Migrate from HTTP application routing to the application routing add-on
-In this article, you'll learn how to migrate your Azure Kubernetes Service (AKS) cluster from HTTP application routing feature to the [application routing add-on](./app-routing.md). The HTTP application routing add-on has been retired and won't work on any cluster Kubernetes version currently in support, so we recommend migrating as soon as possible to maintain a supported configuration.
+In this article, you learn how to migrate your Azure Kubernetes Service (AKS) cluster from HTTP application routing feature to the [application routing add-on](./app-routing.md). The HTTP application routing add-on has been retired and doesn't work on any cluster Kubernetes version currently in support. We recommend migrating as soon as possible to maintain a supported configuration.
## Prerequisites
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
> [!NOTE] > These steps detail migrating from an unsupported configuration. As such, AKS cannot offer support for issues that arise during the migration process.
-## Update your cluster's add-ons, ingresses, and IP usage
+## Update your cluster's add-ons, Ingresses, and IP usage
1. Enable the application routing add-on.
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons web_application_routing ```
-2. Update your ingresses, setting `ingressClassName` to `webapprouting.kubernetes.azure.com`. Remove the `kubernetes.io/ingress.class` annotation. You'll also need to update the host to one that you own, as the application routing add-on doesn't have a managed cluster DNS zone. If you don't have a DNS zone, follow instructions to [create][app-routing-dns-create] and [configure][app-routing-dns-configure] one.
+2. Update your Ingresses, setting `ingressClassName` to `webapprouting.kubernetes.azure.com`. Remove the `kubernetes.io/ingress.class` annotation. You also need to update the host to one that you own, as the application routing add-on doesn't have a managed cluster DNS zone. If you don't have a DNS zone, follow instructions to [create][app-routing-dns-create] and [configure][app-routing-dns-configure] one.
Initially, your ingress configuration will look something like this:
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
number: 80 ```
- After you've properly updated, the same configuration will look like the following:
+ After you've properly updated, the same configuration looks like the following:
```yaml apiVersion: networking.k8s.io/v1
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
number: 80 ```
-3. Update the ingress controller's IP (such as in DNS records) with the new IP address. You can find the new IP by using `kubectl get`. For example:
+3. Update the Ingress controller's IP (such as in DNS records) with the new IP address. You can find the new IP by using `kubectl get`. For example:
```bash kubectl get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
## Remove and delete all HTTP application routing resources
-1. After the HTTP application routing add-on is disabled, some related Kubernetes resources may remain in your cluster. These resources include *configmaps* and *secrets* that are created in the *kube-system* namespace. To maintain a clean cluster, you may want to remove these resources. Look for *addon-http-application-routing* resources using the following [`kubectl get`][kubectl-get] commands:
+1. After the HTTP application routing add-on is disabled, some related Kubernetes resources might remain in your cluster. These resources include *configmaps* and *secrets* that are created in the *kube-system* namespace. To maintain a clean cluster, you can remove these resources. Look for *addon-http-application-routing* resources using the following [`kubectl get`][kubectl-get] commands:
```bash kubectl get deployments --namespace kube-system
Azure CLI version `2.49.0` or later. If you haven't yet, follow the instructions
## Next steps
-After migrating to the application routing add-on, learn how to [monitor ingress controller metrics with Prometheus and Grafana](./app-routing-nginx-prometheus.md).
+After migrating to the application routing add-on, learn how to [monitor Ingress controller metrics with Prometheus and Grafana](./app-routing-nginx-prometheus.md).
<!-- INTERNAL LINKS --> [install-azure-cli]: /cli/azure/install-azure-cli
-[ingress-https]: ./ingress-tls.md
-[app-routing-dns-create]: ./app-routing.md?tabs=without-osm#create-an-azure-dns-zone
-[app-routing-dns-configure]: ./app-routing.md?tabs=without-osm#configure-the-add-on-to-use-azure-dns-to-manage-dns-zones
+[app-routing-dns-create]: ./app-routing-configuration.md#create-a-global-azure-dns-zone
+[app-routing-dns-configure]: ./app-routing-configuration.md#configure-the-add-on-to-use-azure-dns-to-manage-dns-zones
<!-- EXTERNAL LINKS -->
-[dns-pricing]: https://azure.microsoft.com/pricing/details/dns/
[kubectl-get]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get [kubectl-delete]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#delete
aks App Routing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/app-routing.md
Title: Azure Kubernetes Service (AKS) managed nginx ingress with the application routing add-on (preview)
+ Title: Azure Kubernetes Service (AKS) managed nginx Ingress with the application routing add-on
description: Use the application routing add-on to securely access applications deployed on Azure Kubernetes Service (AKS). Previously updated : 08/07/2023 Last updated : 11/03/2023
-# Managed nginx ingress with the application routing add-on (preview)
+# Managed nginx Ingress with the application routing add-on
-The application routing add-on configures an [ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/) in your Azure Kubernetes Service (AKS) cluster with SSL termination through certificates stored in Azure Key Vault. When you deploy ingresses, the add-on creates publicly accessible DNS names for endpoints on an Azure DNS zone.
+One way to route Hypertext Transfer Protocol (HTTP) and secure (HTTPS) traffic to applications running on an Azure Kubernetes Service (AKS) cluster is to use the [Kubernetes Ingress object][kubernetes-ingress-object-overview]. When you create an Ingress object that uses the application routing add-on nginx Ingress classes, the add-on creates, configures, and manages one or more Ingress controllers in your AKS cluster.
+This article shows you how to deploy and configure a basic Ingress controller in your AKS cluster.
-## Application routing add-on with nginx overview
+## Application routing add-on with nginx features
-The application routing add-on deploys the following components:
+The application routing add-on with nginx delivers the following:
-- **[nginx ingress controller][nginx]**: This ingress controller is exposed to the internet.-- **[external-dns controller][external-dns]**: This controller watches for Kubernetes ingress resources and creates DNS `A` records in the cluster-specific DNS zone. This is only deployed when you pass in the `--dns-zone-resource-id` argument.
+* Easy configuration of managed nginx Ingress controllers based on [Kubernetes nginx Ingress controller][kubernetes-nginx-ingress].
+* Integration with [Azure DNS][azure-dns-overview] for public and private zone management
+* SSL termination with certificates stored in Azure Key Vault.
+
+For additional configuration information related to SSL encryption and DNS integration, review the [application routing add-on configuration][custom-ingress-configurations].
+
+With the retirement of [Open Service Mesh][open-service-mesh-docs] (OSM) by the Cloud Native Computing Foundation (CNCF), using the application routing add-on is the default method for all AKS clusters.
## Prerequisites - An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free). - Azure CLI version 2.47.0 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].-- An Azure Key Vault to store certificates.-- The `aks-preview` Azure CLI extension version 0.5.137 or later installed. If you need to install or update, see [Install or update the `aks-preview` extension](#install-or-update-the-aks-preview-azure-cli-extension).-- Optionally, a DNS solution, such as [Azure DNS](../dns/dns-getstarted-portal.md).-
-### Install or update the `aks-preview` Azure CLI extension
--- Install the `aks-preview` Azure CLI extension using the [`az extension add`][az-extension-add] command.-
- ```azurecli-interactive
- az extension add --name aks-preview
- ```
--- If you need to update the extension version, you can do this using the [`az extension update`][az-extension-update] command.-
- ```azurecli-interactive
- az extension update --name aks-preview
- ```
-
-### Create and export a self-signed SSL certificate
-
-> [!NOTE]
-> If you already have an SSL certificate, you can skip this step.
-
-1. Create a self-signed SSL certificate to use with the ingress using the `openssl req` command. Make sure you replace *`<Hostname>`* with the DNS name you're using.
-
- ```bash
- openssl req -new -x509 -nodes -out aks-ingress-tls.crt -keyout aks-ingress-tls.key -subj "/CN=<Hostname>" -addext "subjectAltName=DNS:<Hostname>"
- ```
-
-2. Export the SSL certificate and skip the password prompt using the `openssl pkcs12 -export` command.
-
- ```bash
- openssl pkcs12 -export -in aks-ingress-tls.crt -inkey aks-ingress-tls.key -out aks-ingress-tls.pfx
- ```
-
-### Create an Azure Key Vault to store the certificate
-
-> [!NOTE]
-> If you already have an Azure Key Vault, you can skip this step.
-- Create an Azure Key Vault using the [`az keyvault create`][az-keyvault-create] command.
+## Limitations
- ```azurecli-interactive
- az keyvault create -g <ResourceGroupName> -l <Location> -n <KeyVaultName>
- ```
-
-### Import certificate into Azure Key Vault
--- Import the SSL certificate into Azure Key Vault using the [`az keyvault certificate import`][az-keyvault-certificate-import] command. If your certificate is password protected, you can pass the password through the `--password` flag.-
- ```azurecli-interactive
- az keyvault certificate import --vault-name <KeyVaultName> -n <KeyVaultCertificateName> -f aks-ingress-tls.pfx [--password <certificate password if specified>]
- ```
-
-### Create an Azure DNS zone
-
-> [!NOTE]
-> If you want the add-on to automatically manage creating host names via Azure DNS, you need to [create an Azure DNS zone](../dns/dns-getstarted-cli.md) if you don't have one already.
--- Create an Azure DNS zone using the [`az network dns zone create`][az-network-dns-zone-create] command.-
- ```azurecli-interactive
- az network dns zone create -g <ResourceGroupName> -n <ZoneName>
- ```
+- The application routing add-on supports up to five Azure DNS zones.
+- All public Azure DNS zones integrated with the add-on have to be in the same resource group.
+- All private Azure DNS zones integrated with the add-on have to be in the same resource group.
+- Editing any resources in the `app-routing-system` namespace, including the Ingress-nginx ConfigMap isn't supported.
+- Snippet annotations on the Ingress resources through `nginx.ingress.kubernetes.io/configuration-snippet` aren't supported.
## Enable application routing using Azure CLI
-# [Without Open Service Mesh (OSM)](#tab/without-osm)
-
-The following extra add-on is required:
-
-- **azure-keyvault-secrets-provider**: The Secret Store CSI provider for Azure Key Vault is required to retrieve the certificates from Azure Key Vault.
+# [Default](#tab/default)
-> [!IMPORTANT]
-> To enable the add-on to reload certificates from Azure Key Vault when they change, you should enable the [secret autorotation feature](./csi-secrets-store-configuration-options.md#enable-and-disable-auto-rotation) of the Secret Store CSI driver with the `--enable-secret-rotation` argument. When the autorotation is enabled, the driver updates the pod mount and the Kubernetes secret by polling for changes periodically, based on the rotation poll interval you can define. The default rotation poll interval is two minutes.
+### Enable on a new cluster
-### Enable application routing on a new cluster
+To enable application routing on a new cluster, use the [`az aks create`][az-aks-create] command, specifying `web_application_routing` with the `enable-addons` argument.
-- Enable application routing on a new AKS cluster using the [`az aks create`][az-aks-create] command and the `--enable-addons` parameter with the following add-ons:-
- ```azurecli-interactive
- az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons azure-keyvault-secrets-provider,web_application_routing --generate-ssh-keys --enable-secret-rotation
- ```
+```azurecli-interactive
+az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons web_application_routing --generate-ssh-keys
+```
-### Enable application routing on an existing cluster
+### Enable on an existing cluster
-- Enable application routing on an existing cluster using the [`az aks enable-addons`][az-aks-enable-addons] command and the `--addons` parameter with the following add-ons:
+To enable application routing on an existing cluster, use the [`az aks enable-addons`][az-aks-enable-addons] command specifying `web_application_routing` with the `--addons` argument.
- ```azurecli-interactive
- az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons azure-keyvault-secrets-provider,web_application_routing --enable-secret-rotation
- ```
+```azurecli-interactive
+az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons web_application_routing
+```
-# [With Open Service Mesh (OSM)](#tab/with-osm)
+# [Open Service Mesh (OSM)](#tab/with-osm)
-The following extra add-ons are required:
+>[!NOTE]
+>Open Service Mesh (OSM) has been retired by the CNCF. Creating Ingresses using the application routing add-on with OSM integration is not recommended and will be retired.
-- **azure-keyvault-secrets-provider**: The Secret Store CSI provider for Azure Key Vault is required to retrieve the certificates from Azure Key Vault.-- **open-service-mesh**: If you require encrypted intra cluster traffic (recommended) between the nginx ingress and your services, the Open Service Mesh add-on is required which provides mutual TLS (mTLS).
+The following add-ons are required to support this configuration:
-> [!IMPORTANT]
-> To enable the add-on to reload certificates from Azure Key Vault when they change, you should enable the [secret autorotation feature](./csi-secrets-store-configuration-options.md#enable-and-disable-auto-rotation) of the Secret Store CSI driver with the `--enable-secret-rotation` argument. When the autorotation is enabled, the driver updates the pod mount and the Kubernetes secret by polling for changes periodically, based on the rotation poll interval you can define. The default rotation poll interval is two minutes.
+* **open-service-mesh**: If you require encrypted intra cluster traffic (recommended) between the nginx Ingress and your services, the Open Service Mesh add-on is required which provides mutual TLS (mTLS).
-### Enable application routing on a new cluster
+### Enable on a new cluster
-- Enable application routing on a new AKS cluster using the [`az aks create`][az-aks-create] command and the `--enable-addons` parameter with the following add-ons:
+Enable application routing on a new AKS cluster using the [`az aks create`][az-aks-create] command and the `--enable-addons` parameter with the following add-ons:
- ```azurecli-interactive
- az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons azure-keyvault-secrets-provider,open-service-mesh,web_application_routing --generate-ssh-keys --enable-secret-rotation
- ```
+```azurecli-interactive
+az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons open-service-mesh,web_application_routing --generate-ssh-keys
+```
-### Enable application routing on an existing cluster
+### Enable on an existing cluster
-- Enable application routing on an existing cluster using the [`az aks enable-addons`][az-aks-enable-addons] command and the `--addons` parameter with the following add-ons:
+Enable application routing on an existing cluster using the [`az aks enable-addons`][az-aks-enable-addons] command and the `--addons` parameter with the following add-ons:
- ```azurecli-interactive
- az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons azure-keyvault-secrets-provider,open-service-mesh,web_application_routing --enable-secret-rotation
- ```
+```azurecli-interactive
+az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons open-service-mesh,web_application_routing
+```
> [!NOTE] > To use the add-on with Open Service Mesh, you should install the `osm` command-line tool. This command-line tool contains everything needed to configure and manage Open Service Mesh. The latest binaries are available on the [OSM GitHub releases page][osm-release].
-# [With service annotations (retired)](#tab/service-annotations)
+# [Service annotations (retired)](#tab/service-annotations)
> [!WARNING]
-> Configuring ingresses by adding annotations on the Service object is retired. Please consider [configuring via an Ingress object](?tabs=without-osm).
-
-The following extra add-on is required:
--- **azure-keyvault-secrets-provider**: The Secret Store CSI provider for Azure Key Vault is required to retrieve the certificates from Azure Key Vault.-
-> [!IMPORTANT]
-> To enable the add-on to reload certificates from Azure Key Vault when they change, you should enable the [secret autorotation feature](./csi-secrets-store-configuration-options.md#enable-and-disable-auto-rotation) of the Secret Store CSI driver with the `--enable-secret-rotation` argument. When the autorotation is enabled, the driver updates the pod mount and the Kubernetes secret by polling for changes periodically, based on the rotation poll interval you can define. The default rotation poll interval is two minutes.
-
-### Enable application routing on a new cluster
+> Configuring Ingresses by adding annotations on the Service object is retired. Please consider [configuring using an Ingress object](?tabs=default).
-- Enable application routing on a new AKS cluster using the [`az aks create`][az-aks-create] command and the `--enable-addons` parameter with the following add-ons:
+### Enable on a new cluster
- ```azurecli-interactive
- az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons azure-keyvault-secrets-provider,web_application_routing --generate-ssh-keys --enable-secret-rotation
- ```
-
-### Enable application routing on an existing cluster
--- Enable application routing on an existing cluster using the [`az aks enable-addons`][az-aks-enable-addons] command and the `--addons` parameter with the following add-ons:-
- ```azurecli-interactive
- az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons azure-keyvault-secrets-provider,web_application_routing --enable-secret-rotation
- ```
---
-## Retrieve the add-on's managed identity object ID
-
-You use the managed identity in the next steps to grant permissions to manage the Azure DNS zone and retrieve secrets and certificates from the Azure Key Vault.
--- Get the add-on's managed identity object ID using the [`az aks show`][az-aks-show] command and setting the output to a variable named *MANAGEDIDENTITY_OBJECTID*.-
- ```azurecli-interactive
- # Provide values for your environment
- RGNAME=<ResourceGroupName>
- CLUSTERNAME=<ClusterName>
- MANAGEDIDENTITY_OBJECTID=$(az aks show -g ${RGNAME} -n ${CLUSTERNAME} --query ingressProfile.webAppRouting.identity.objectId -o tsv)
- ```
-
-## Configure the add-on to use Azure DNS to manage DNS zones
-
-> [!NOTE]
-> If you plan to use Azure DNS, you need to update the add-on to pass in the `--dns-zone-resource-id`.
-
-1. Retrieve the resource ID for the DNS zone using the [`az network dns zone show`][az-network-dns-zone-show] command and setting the output to a variable named *ZONEID*.
-
- ```azurecli-interactive
- ZONEID=$(az network dns zone show -g <ResourceGroupName> -n <ZoneName> --query "id" --output tsv)
- ```
-
-2. Grant **DNS Zone Contributor** permissions on the DNS zone using the [`az role assignment create`][az-role-assignment-create] command.
-
- ```azurecli-interactive
- az role assignment create --role "DNS Zone Contributor" --assignee $MANAGEDIDENTITY_OBJECTID --scope $ZONEID
- ```
-
-3. Update the add-on to enable the integration with Azure DNS and install the **external-dns** controller using the [`az aks addon update`][az-aks-addon-update] command.
-
- ```azurecli-interactive
- az aks addon update -g <ResourceGroupName> -n <ClusterName> --addon web_application_routing --dns-zone-resource-id=$ZONEID
- ```
-
-## Grant the add-on permissions to retrieve certificates from Azure Key Vault
-
-The application routing add-on creates a user-created managed identity in the cluster resource group. You need to grant permissions to the managed identity so it can retrieve SSL certificates from the Azure Key Vault.
-
-Azure Key Vault offers [two authorization systems](../key-vault/general/rbac-access-policy.md): **Azure role-based access control (Azure RBAC)**, which operates on the management plane, and the **access policy model**, which operates on both the management plane and the data plane. To find out which system your key vault is using, you can query the `enableRbacAuthorization` property.
+Enable application routing on a new AKS cluster using the [`az aks create`][az-aks-create] command and the `--enable-addons` parameter with the following add-ons:
```azurecli-interactive
-az keyvault show --name <KeyVaultName> --query properties.enableRbacAuthorization
+az aks create -g <ResourceGroupName> -n <ClusterName> -l <Location> --enable-addons web_application_routing --generate-ssh-keys
```
-If Azure RBAC authorization is enabled for your key vault, you should configure permissions using Azure RBAC. Add the `Key Vault Secrets User` role assignment to the key vault.
-
-```azurecli-interactive
-KEYVAULTID=$(az keyvault show --name <KeyVaultName> --query "id" --output tsv)
-az role assignment create --role "Key Vault Secrets User" --assignee $MANAGEDIDENTITY_OBJECTID --scope $KEYVAULTID
-```
+### Enable on an existing cluster
-If Azure RBAC authorization is not enabled for your key vault, you should configure permissions using the access policy model. Grant `GET` permissions for the application routing add-on to retrieve certificates from Azure Key Vault using the [`az keyvault set-policy`][az-keyvault-set-policy] command.
+Enable application routing on an existing cluster using the [`az aks enable-addons`][az-aks-enable-addons] command and the `--addons` parameter with the following add-ons:
```azurecli-interactive
-az keyvault set-policy --name <KeyVaultName> --object-id $MANAGEDIDENTITY_OBJECTID --secret-permissions get --certificate-permissions get
+az aks enable-addons -g <ResourceGroupName> -n <ClusterName> --addons web_application_routing --enable-secret-rotation
``` ++ ## Connect to your AKS cluster To connect to the Kubernetes cluster from your local computer, you use [kubectl][kubectl], the Kubernetes command-line client. You can install it locally using the [`az aks install-cli`][az-aks-install-cli] command. If you use the Azure Cloud Shell, `kubectl` is already installed. -- Configure `kubectl` to connect to your Kubernetes cluster using the [az aks get-credentials][az-aks-get-credentials] command.
+Configure `kubectl` to connect to your Kubernetes cluster using the [az aks get-credentials][az-aks-get-credentials] command.
- ```azurecli-interactive
- az aks get-credentials -g <ResourceGroupName> -n <ClusterName>
- ```
+```azurecli-interactive
+az aks get-credentials -g <ResourceGroupName> -n <ClusterName>
+```
## Deploy an application
-Application routing uses annotations on Kubernetes ingress objects to create the appropriate resources, create records on Azure DNS, and retrieve the SSL certificates from Azure Key Vault.
-
-# [Without Open Service Mesh (OSM)](#tab/without-osm)
+The application routing add-on uses annotations on Kubernetes Ingress objects to create the appropriate resources.
-### Create the application namespace
+# [Application routing add-on](#tab/deploy-app-default)
-- Create a namespace called `hello-web-app-routing` to run the example pods using the `kubectl create namespace` command.
+1. Create the application namespace called `hello-web-app-routing` to run the example pods using the `kubectl create namespace` command.
```bash kubectl create namespace hello-web-app-routing ```
-### Create the deployment
--- Copy the following YAML into a new file named **deployment.yaml** and save the file to your local computer.
+2. Create the deployment by copying the following YAML manifest into a new file named **deployment.yaml** and save the file to your local computer.
```yaml apiVersion: apps/v1
Application routing uses annotations on Kubernetes ingress objects to create the
value: "Welcome to Azure Kubernetes Service (AKS)" ```
-### Create the service
--- Copy the following YAML into a new file named **service.yaml** and save the file to your local computer.
+3. Create the service by copying the following YAML manifest into a new file named **service.yaml** and save the file to your local computer.
```yaml apiVersion: v1
Application routing uses annotations on Kubernetes ingress objects to create the
app: aks-helloworld ```
-### Create the ingress
+### Create the Ingress
-The application routing add-on creates an ingress class on the cluster called *webapprouting.kubernetes.azure.com*. When you create an ingress object with this class, it activates the add-on.
+The application routing add-on creates an Ingress class on the cluster named *webapprouting.kubernetes.azure.com*. When you create an Ingress object with this class, it activates the add-on.
-1. Get the certificate URI to use in the ingress from Azure Key Vault using the [`az keyvault certificate show`][az-keyvault-certificate-show] command.
-
- ```azurecli-interactive
- az keyvault certificate show --vault-name <KeyVaultName> -n <KeyVaultCertificateName> --query "id" --output tsv
- ```
-
-2. Copy the following YAML into a new file named **ingress.yaml** and save the file to your local computer.
-
- > [!NOTE]
- > Update *`<Hostname>`* with your DNS host name and *`<KeyVaultCertificateUri>`* with the ID returned from Azure Key Vault.
- > The *`secretName`* key in the `tls` section defines the name of the secret that contains the certificate for this Ingress resource. This certificate will be presented in the browser when a client browses to the URL defined in the `<Hostname>` key. Make sure that the value of `secretName` is equal to `keyvault-` followed by the value of the Ingress resource name (from `metadata.name`). In the example YAML, secretName will need to be equal to `keyvault-aks-helloworld`.
+1. Copy the following YAML manifest into a new file named **ingress.yaml** and save the file to your local computer.
```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata:
- annotations:
- kubernetes.azure.com/tls-cert-keyvault-uri: <KeyVaultCertificateUri>
name: aks-helloworld namespace: hello-web-app-routing spec:
The application routing add-on creates an ingress class on the cluster called *w
number: 80 path: / pathType: Prefix
- tls:
- - hosts:
- - <Hostname>
- secretName: keyvault-<Ingress resource name>
```
-### Create the resources on the cluster
--- Create the resources on the cluster using the [`kubectl apply`][kubectl-apply] command.
+2. Create the cluster resources using the [`kubectl apply`][kubectl-apply] command.
```bash kubectl apply -f deployment.yaml -n hello-web-app-routing
- kubectl apply -f service.yaml -n hello-web-app-routing
- kubectl apply -f ingress.yaml -n hello-web-app-routing
```
- The following example output shows the created resources:
+ The following example output shows the created resource:
```output deployment.apps/aks-helloworld created
+ ```
+
+ ```bash
+ kubectl apply -f service.yaml -n hello-web-app-routing
+ ```
+
+ The following example output shows the created resource:
+
+ ```output
service/aks-helloworld created
- ingress.networking.k8s.io/aks-helloworld created
```
-# [With Open Service Mesh (OSM)](#tab/with-osm)
+ ```bash
+ kubectl apply -f ingress.yaml -n hello-web-app-routing
+ ```
+
+ The following example output shows the created resource:
+
+ ```output
+ ingress.networking.k8s.io/aks-helloworld created
+ ```
-### Create the application namespace
+# [Open Service Mesh (retired)](#tab/deploy-app-osm)
-1. Create a namespace called `hello-web-app-routing` to run the example pods using the `kubectl create namespace` command.
+1. Create a namespace called `hello-web-app-routing` to run the exmaple pods using the `kubectl create namespace` command.
```bash kubectl create namespace hello-web-app-routing
The application routing add-on creates an ingress class on the cluster called *w
osm namespace add hello-web-app-routing ```
-### Create the deployment
+3. Create the deployment by copying the following YAML manifest into a new file named **deployment.yaml** and save the file to your local computer.
-- Copy the following YAML into a new file named **deployment.yaml** and save the file to your local computer.-
- ```yaml
+ ```yml
apiVersion: apps/v1 kind: Deployment metadata:
The application routing add-on creates an ingress class on the cluster called *w
value: "Welcome to Azure Kubernetes Service (AKS)" ```
-### Create the service
--- Copy the following YAML into a new file named **service.yaml** and save the file to your local computer.
+4. Create the service by copying the following YAML manifest into a new file named **service.yaml** and save the file to your local computer.
- ```yaml
+ ```yml
apiVersion: v1 kind: Service metadata:
The application routing add-on creates an ingress class on the cluster called *w
app: aks-helloworld ```
-### Create the ingress
-
-The application routing add-on creates an ingress class on the cluster called *webapprouting.kubernetes.azure.com*. When you create an ingress object with this class, it activates the add-on. The `kubernetes.azure.com/use-osm-mtls: "true"` annotation on the ingress object creates an Open Service Mesh (OSM) [IngressBackend](https://release-v1-2.docs.openservicemesh.io/docs/guides/traffic_management/ingress/#ingressbackend-api) to configure a backend service to accept ingress traffic from trusted sources.
+### Create the Ingress
-OSM issues a certificate that Nginx uses as the client certificate to proxy HTTPS connections to TLS backends. The client certificate and CA certificate are stored in a Kubernetes secret that Nginx uses to authenticate service mesh back ends. For more information, see [Open Service Mesh: Ingress with Kubernetes Nginx Ingress Controller](https://release-v1-2.docs.openservicemesh.io/docs/demos/ingress_k8s_nginx/).
+The application routing add-on creates an Ingress class on the cluster called *webapprouting.kubernetes.azure.com*. When you create an Ingress object with this class, it activates the add-on. The `kubernetes.azure.com/use-osm-mtls: "true"` annotation on the Ingress object creates an Open Service Mesh (OSM) [IngressBackend][ingress-backend] to configure a backend service to accept Ingress traffic from trusted sources.
-1. Get the certificate URI to use in the ingress from Azure Key Vault using the [`az keyvault certificate show`][az-keyvault-certificate-show] command.
+1. Copy the following YAML manifest into a new file named **ingress.yaml** and save the file to your local computer.
- ```azurecli-interactive
- az keyvault certificate show --vault-name <KeyVaultName> -n <KeyVaultCertificateName> --query "id" --output tsv
- ```
-
-2. Copy the following YAML into a new file named **ingress.yaml** and save the file to your local computer.
-
- > [!NOTE]
- > Update *`<Hostname>`* with your DNS host name and *`<KeyVaultCertificateUri>`* with the ID returned from Azure Key Vault.
- > The *`secretName`* key in the `tls` section defines the name of the secret that contains the certificate for this Ingress resource. This certificate will be presented in the browser when a client browses to the URL defined in the `<Hostname>` key. Make sure that the value of `secretName` is equal to `keyvault-` followed by the value of the Ingress resource name (from `metadata.name`). In the example YAML, secretName will need to be equal to `keyvault-aks-helloworld`.
-
- ```yaml
+ ```yml
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations:
- kubernetes.azure.com/tls-cert-keyvault-uri: <KeyVaultCertificateUri>
kubernetes.azure.com/use-osm-mtls: "true" nginx.ingress.kubernetes.io/backend-protocol: HTTPS nginx.ingress.kubernetes.io/configuration-snippet: |2-- proxy_ssl_name "default.hello-web-app-routing.cluster.local"; nginx.ingress.kubernetes.io/proxy-ssl-secret: kube-system/osm-ingress-client-cert nginx.ingress.kubernetes.io/proxy-ssl-verify: "on"
OSM issues a certificate that Nginx uses as the client certificate to proxy HTTP
number: 80 path: / pathType: Prefix
- tls:
- - hosts:
- - <Hostname>
- secretName: keyvault-<Ingress resource name>
```
-### Create the resources on the cluster
--- Create the resources on the cluster using the [`kubectl apply`][kubectl-apply] command.
+1. Create the cluster resources using the [`kubectl apply`][kubectl-apply] command.
```bash kubectl apply -f deployment.yaml -n hello-web-app-routing
- kubectl apply -f service.yaml -n hello-web-app-routing
- kubectl apply -f ingress.yaml -n hello-web-app-routing
```
- The following example output shows the created resources:
+ The following example output shows the created resource:
```output deployment.apps/aks-helloworld created
+ ```
+
+ ```bash
+ kubectl apply -f service.yaml -n hello-web-app-routing
+ ```
+
+ The following example output shows the created resource:
+
+ ```output
service/aks-helloworld created
+ ```
+
+ ```bash
+ kubectl apply -f ingress.yaml -n hello-web-app-routing
+ ```
+
+ The following example output shows the created resource:
+
+ ```output
ingress.networking.k8s.io/aks-helloworld created ```
-# [With service annotations (retired)](#tab/service-annotations)
+# [Service annotations (retired)](#tab/deploy-app-service-annotations)
> [!WARNING]
-> Configuring ingresses by adding annotations on the Service object is retired. Please consider [configuring via an Ingress object](?tabs=without-osm).
+> Configuring Ingresses by adding annotations on the Service object is retired. Please consider [configuring using an Ingress object](?tabs=default).
-### Create the application namespace
+### Create application namespace
-- Create a namespace called `hello-web-app-routing` to run the example pods using the `kubectl create namespace` command.
+1. Create a namespace called `hello-web-app-routing` to run the exmaple pods using the `kubectl create namespace` command.
```bash kubectl create namespace hello-web-app-routing ```
-### Create the deployment
+2. Add the application namespace to the OSM control plane using the `osm namespace add` command.
-- Copy the following YAML into a new file named **deployment.yaml** and save the file to your local computer.
+ ```bash
+ osm namespace add hello-web-app-routing
+ ```
- ```yaml
+3. Create the deployment by copying the following YAML manifest into a new file named **deployment.yaml** and save the file to your local computer.
+
+ ```yml
apiVersion: apps/v1 kind: Deployment metadata:
OSM issues a certificate that Nginx uses as the client certificate to proxy HTTP
value: "Welcome to Azure Kubernetes Service (AKS)" ```
-### Create the service with the annotations (retired)
--- Copy the following YAML into a new file named **service.yaml** and save the file to your local computer.-
- > [!NOTE]
- > Update *`<Hostname>`* with your DNS host name and *`<KeyVaultCertificateUri>`* with the ID returned from Azure Key Vault. This certificate will be presented in the browser.
+4. Create the service by copying the following YAML manifest into a new file named **service.yaml** and save the file to your local computer.
- ```yaml
+ ```yml
apiVersion: v1 kind: Service metadata: name: aks-helloworld namespace: hello-web-app-routing
- annotations:
- kubernetes.azure.com/ingress-host: <Hostname>
- kubernetes.azure.com/tls-cert-keyvault-uri: <KeyVaultCertificateUri>
spec: type: ClusterIP ports:
OSM issues a certificate that Nginx uses as the client certificate to proxy HTTP
app: aks-helloworld ```
-### Create the resources on the cluster
--- Create the resources on the cluster using the [`kubectl apply`][kubectl-apply] command.
+5. Create the cluster resources using the [`kubectl apply`][kubectl-apply] command.
```bash kubectl apply -f deployment.yaml -n hello-web-app-routing
- kubectl apply -f service.yaml -n hello-web-app-routing
```
- The following example output shows the created resources:
+ The following example output shows the created resource:
```output deployment.apps/aks-helloworld created
- service/aks-helloworld created
``` --
-## Verify the managed ingress was created
--- Verify the managed ingress was created using the `kubectl get ingress` command.-
- ```bash
- kubectl get ingress -n hello-web-app-routing
+ ```bash
+ kubectl apply -f service.yaml -n hello-web-app-routing
```
- The following example output shows the created managed ingress:
+ The following example output shows the created resource:
```output
- NAME CLASS HOSTS ADDRESS PORTS AGE
- aks-helloworld webapprouting.kubernetes.azure.com myapp.contoso.com 20.51.92.19 80, 443 4m
+ service/aks-helloworld created
```
-## Access the endpoint over a DNS hostname
++
+## Verify the managed Ingress was created
-If you haven't configured Azure DNS integration, you need to configure your own DNS provider with an `A` record pointing to the ingress IP address and the host name you configured for the ingress, for example *myapp.contoso.com*.
+You can verify the managed Ingress was created using the `kubectl get ingress` command.
+
+```bash
+kubectl get ingress -n hello-web-app-routing
+```
+
+The following example output shows the created managed Ingress:
+
+```output
+NAME CLASS HOSTS ADDRESS PORTS AGE
+aks-helloworld webapprouting.kubernetes.azure.com myapp.contoso.com 20.51.92.19 80, 443 4m
+```
## Remove the application routing add-on
-1. Remove the associated namespace using the `kubectl delete namespace` command.
+To remove the associated namespace, use the `kubectl delete namespace` command.
- ```bash
- kubectl delete namespace hello-web-app-routing
- ```
+```bash
+kubectl delete namespace hello-web-app-routing
+```
-2. Remove the application routing add-on from your cluster using the [`az aks disable-addons`][az-aks-disable-addons] command.
+To remove the application routing add-on from your cluster, use the [`az aks disable-addons`][az-aks-disable-addons] command.
- ```azurecli-interactive
- az aks disable-addons --addons web_application_routing --name myAKSCluster --resource-group myResourceGroup
- ```
+```azurecli-interactive
+az aks disable-addons --addons web_application_routing --name myAKSCluster --resource-group myResourceGroup
+```
When the application routing add-on is disabled, some Kubernetes resources might remain in the cluster. These resources include *configMaps* and *secrets* and are created in the *app-routing-system* namespace. You can remove these resources if you want.
+## Next steps
+
+* [Configure custom ingress configurations][custom-ingress-configurations] shows how to create Ingresses with a private load balancer, configure SSL certificate integration with Azure Key Vault, and DNS management with Azure DNS.
+
+* Learn about monitoring the ingress-nginx controller metrics included with the application routing add-on with [with Prometheus in Grafana][prometheus-in-grafana] (preview) as part of analyzing the performance and usage of your application.
+ <!-- LINKS - internal -->
-[az-aks-create]: /cli/azure/aks#az-aks-create
-[az-aks-show]: /cli/azure/aks#az-aks-show
+[azure-dns-overview]: ../dns/dns-overview.md
[az-aks-enable-addons]: /cli/azure/aks#az-aks-enable-addons [az-aks-disable-addons]: /cli/azure/aks#az-aks-disable-addons [az-aks-install-cli]: /cli/azure/aks#az-aks-install-cli [az-aks-get-credentials]: /cli/azure/aks#az-aks-get-credentials
-[az-extension-add]: /cli/azure/extension#az-extension-add
-[az-extension-update]: /cli/azure/extension#az-extension-update
[install-azure-cli]: /cli/azure/install-azure-cli
-[az-keyvault-create]: /cli/azure/keyvault#az_keyvault_create
-[az-keyvault-certificate-import]: /cli/azure/keyvault/certificate#az_keyvault_certificate_import
-[az-keyvault-certificate-show]: /cli/azure/keyvault/certificate#az_keyvault_certificate_show
-[az-network-dns-zone-create]: /cli/azure/network/dns/zone#az_network_dns_zone_create
-[az-network-dns-zone-show]: /cli/azure/network/dns/zone#az_network_dns_zone_show
-[az-role-assignment-create]: /cli/azure/role/assignment#az_role_assignment_create
-[az-aks-addon-update]: /cli/azure/aks/addon#az_aks_addon_update
-[az-keyvault-set-policy]: /cli/azure/keyvault#az_keyvault_set_policy
+[custom-ingress-configurations]: app-routing-configuration.md
+[az-aks-create]: /cli/azure/aks#az-aks-create
+[prometheus-in-grafana]: app-routing-nginx-prometheus.md
<!-- LINKS - external -->
-[osm-release]: https://github.com/openservicemesh/osm/releases/
-[nginx]: https://kubernetes.github.io/ingress-nginx/
-[external-dns]: https://github.com/kubernetes-incubator/external-dns
+[kubernetes-ingress-object-overview]: https://kubernetes.io/docs/concepts/services-networking/ingress/
+[osm-release]: https://github.com/openservicemesh/osm
+[open-service-mesh-docs]: https://release-v1-2.docs.openservicemesh.io/
+[kubernetes-nginx-ingress]: https://kubernetes.github.io/ingress-nginx/
[kubectl]: https://kubernetes.io/docs/reference/kubectl/ [kubectl-apply]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply
+[ingress-backend]: https://release-v1-2.docs.openservicemesh.io/docs/guides/traffic_management/ingress/#ingressbackend-api
aks Open Ai Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/open-ai-quickstart.md
The [AKS Store application][aks-store-demo] manifest includes the following Kube
- **Rabbit MQ**: Message queue for an order queue. > [!NOTE]
-> We don't recommend running stateful containers, such as MongoDB and Rabbit MQ, without persistent storage for production. We use them here here for simplicity, but we recommend using managed services, such as Azure CosmosDB or Azure Service Bus.
+> We don't recommend running stateful containers, such as MongoDB and Rabbit MQ, without persistent storage for production. We use them here for simplicity, but we recommend using managed services, such as Azure CosmosDB or Azure Service Bus.
1. Review the [YAML manifest](https://github.com/Azure-Samples/aks-store-demo/blob/main/aks-store-all-in-one.yaml) for the application. 2. Deploy the application using the [`kubectl apply`][kubectl-apply] command and specify the name of your YAML manifest.
aks Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/aks/policy-reference.md
Title: Built-in policy definitions for Azure Kubernetes Service description: Lists Azure Policy built-in policy definitions for Azure Kubernetes Service. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
analysis-services Move Between Regions https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/analysis-services/move-between-regions.md
Before moving a server to a different region, it's recommended you create a deta
> Azure regions use different IP address ranges. If you have firewall exceptions configured for the region your server and/or storage account is in, it may be necessary to configure a different IP address range. To learn more, see [Frequently asked questions about Analysis Services network connectivity](analysis-services-network-faq.yml). > [!NOTE]
-> This article describes restoring a database backup to a target server from a storage container in the source server's region. In some cases, restoring backups from a different region can have poor performance, especially for large databases. For the best performance during database restore, migrate or create a a new storage container in the target server region. Copy the .abf backup files from the source region storage container to the target region storage container prior to restoring the database to the target server. While out of scope for this article, in some cases, particularly with very large databases, scripting out a database from your source server, recreating, and then processing on the target server to load database data may be more cost effective than using backup/restore.
+> This article describes restoring a database backup to a target server from a storage container in the source server's region. In some cases, restoring backups from a different region can have poor performance, especially for large databases. For the best performance during database restore, migrate or create a new storage container in the target server region. Copy the .abf backup files from the source region storage container to the target region storage container prior to restoring the database to the target server. While out of scope for this article, in some cases, particularly with very large databases, scripting out a database from your source server, recreating, and then processing on the target server to load database data may be more cost effective than using backup/restore.
> [!NOTE] > If using an On-premises data gateway to connect to data sources, you must also move the gateway resource to the target server region. To learn more, see [Install and configure an on-premises data gateway](analysis-services-gateway-install.md).
api-management Api Management Howto Cache https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/api-management-howto-cache.md
APIs and operations in API Management can be configured with response caching. Response caching can significantly reduce latency for API callers and backend load for API providers. > [!IMPORTANT]
-> Built-in cache is volatile and is shared by all units in the same region in the same API Management service. Regardless of the cache type being used (internal or external), if the cache-related operations fail to connect to the cache due to the volatility of the cache or any other reason, the API call that uses the cache related operation doesn't raise an error, and the cache operation completes successfully. In the case of a read operation, a null value is returned to the calling policy expression. Your policy code should be designed to ensure that that there's a "fallback" mechanism to retrieve data not found in the cache.
+> Built-in cache is volatile and is shared by all units in the same region in the same API Management service. Regardless of the cache type being used (internal or external), if the cache-related operations fail to connect to the cache due to the volatility of the cache or any other reason, the API call that uses the cache related operation doesn't raise an error, and the cache operation completes successfully. In the case of a read operation, a null value is returned to the calling policy expression. Your policy code should be designed to ensure that there's a "fallback" mechanism to retrieve data not found in the cache.
For more detailed information about caching, see [API Management caching policies](api-management-caching-policies.md) and [Custom caching in Azure API Management](api-management-sample-cache-by-key.md). ![cache policies](media/api-management-howto-cache/cache-policies.png)
api-management Api Management Howto Ip Addresses https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/api-management-howto-ip-addresses.md
GET https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/
### IP addresses for outbound traffic
-API Management uses a public IP address for a connection outside the VNet or a peered VNet and a private IP address for a connection in the VNet or a peered VNet.
+API Management uses a public IP address for a connection outside the VNet or a peered VNet, and it uses a private IP address for a connection in the VNet or a peered VNet.
* When API management is deployed in an external or internal virtual network and API management connects to private (intranet-facing) backends, internal IP addresses (dynamic IP, or DIP addresses) from the subnet are used for the runtime API traffic. When a request is sent from API Management to a private backend, a private IP address will be visible as the origin of the request.
api-management Api Management Howto Oauth2 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/api-management-howto-oauth2.md
Optionally:
1. [Republish](api-management-howto-developer-portal-customize.md#publish) the developer portal. > [!IMPORTANT]
- > When making OAuth 2.0-related changes, be sure to to republish the developer portal after every modification as relevant changes (for example, scope change) otherwise cannot propagate into the portal and subsequently be used in trying out the APIs.
+ > When making OAuth 2.0-related changes, be sure to republish the developer portal after every modification as relevant changes (for example, scope change) otherwise cannot propagate into the portal and subsequently be used in trying out the APIs.
## Configure an API to use OAuth 2.0 user authorization
api-management Configure Graphql Resolver https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/configure-graphql-resolver.md
The `context` variable that is passed through the request and response pipeline
### context.GraphQL.parent
-The `context.ParentResult` is set to the parent object for the current resolver execution. Consider the following partial schema:
+The `context.GraphQL.parent` is set to the parent object for the current resolver execution. Consider the following partial schema:
``` graphql type Comment {
api-management Migrate Stv1 To Stv2 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/migrate-stv1-to-stv2.md
Run the following Azure CLI commands, setting variables where indicated with the
```azurecli
+#!/bin/bash
# Verify currently selected subscription az account show
api-management Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/api-management/policy-reference.md
Title: Built-in policy definitions for Azure API Management description: Lists Azure Policy built-in policy definitions for Azure API Management. These built-in policy definitions provide approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
app-service Configure Authentication Api Version https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/configure-authentication-api-version.md
If your existing configuration contains a Microsoft Account provider and doesn't
1. Add a new URI that matches the one you just copied, except instead have it end in `/.auth/login/aad/callback`. This will allow the registration to be used by the App Service Authentication / Authorization configuration. 1. Navigate to the App Service Authentication / Authorization configuration for your app. 1. Collect the configuration for the Microsoft Account provider.
-1. Configure the Microsoft Entra provider using the "Advanced" management mode, supplying the client ID and client secret values you collected in the previous step. For the Issuer URL, use Use `<authentication-endpoint>/<tenant-id>/v2.0`, and replace *\<authentication-endpoint>* with the [authentication endpoint for your cloud environment](../active-directory/develop/authentication-national-cloud.md#azure-ad-authentication-endpoints) (e.g., "https://login.microsoftonline.com" for global Azure), also replacing *\<tenant-id>* with your **Directory (tenant) ID**.
+1. Configure the Microsoft Entra provider using the "Advanced" management mode, supplying the client ID and client secret values you collected in the previous step. For the Issuer URL, use `<authentication-endpoint>/<tenant-id>/v2.0`, and replace *\<authentication-endpoint>* with the [authentication endpoint for your cloud environment](../active-directory/develop/authentication-national-cloud.md#azure-ad-authentication-endpoints) (e.g., "https://login.microsoftonline.com" for global Azure), also replacing *\<tenant-id>* with your **Directory (tenant) ID**.
1. Once you've saved the configuration, test the login flow by navigating in your browser to the `/.auth/login/aad` endpoint on your site and complete the sign-in flow. 1. At this point, you've successfully copied the configuration over, but the existing Microsoft Account provider configuration remains. Before you remove it, make sure that all parts of your app reference the Microsoft Entra provider through login links, etc. Verify that all parts of your app work as expected. 1. Once you've validated that things work against the Microsoft Entra provider, you may remove the Microsoft Account provider configuration.
app-service Configure Basic Auth Disable https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/configure-basic-auth-disable.md
To confirm that the logs are shipped to your selected service(s), try logging in
<pre> {
- "time": "2020-07-16T17:42:32.9322528Z",
- "ResourceId": "/SUBSCRIPTIONS/EF90E930-9D7F-4A60-8A99-748E0EEA69DE/RESOURCEGROUPS/FREEBERGDEMO/PROVIDERS/MICROSOFT.WEB/SITES/FREEBERG-WINDOWS",
+ "time": "2023-10-16T17:42:32.9322528Z",
+ "ResourceId": "/SUBSCRIPTIONS/EF90E930-9D7F-4A60-8A99-748E0EEA69DE/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.WEB/SITES/MY-DEMO-APP",
"Category": "AppServiceAuditLogs", "OperationName": "Authorization", "Properties": {
- "User": "$freeberg-windows",
- "UserDisplayName": "$freeberg-windows",
+ "User": "$my-demo-app",
+ "UserDisplayName": "$my-demo-app",
"UserAddress": "24.19.191.170", "Protocol": "FTP" }
app-service Configure Connect To Azure Storage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/configure-connect-to-azure-storage.md
Previously updated : 8/24/2023 Last updated : 11/02/2023 zone_pivot_groups: app-service-containers-code
app-service Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/policy-reference.md
Title: Built-in policy definitions for Azure App Service description: Lists Azure Policy built-in policy definitions for Azure App Service. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
app-service Tutorial Dotnetcore Sqldb App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/tutorial-dotnetcore-sqldb-app.md
In this step, you'll configure GitHub deployment using GitHub Actions. It's just
## 4. Generate database schema
-With the SQL Database protected by the virtual network, the easiest way to run Run [dotnet database migrations](/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli) is in an SSH session with the App Service container.
+With the SQL Database protected by the virtual network, the easiest way to run [dotnet database migrations](/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli) is in an SSH session with the App Service container.
:::row::: :::column span="2":::
app-service Tutorial Send Email https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/app-service/tutorial-send-email.md
Deploy an app with the language framework of your choice to App Service. To foll
1. In the search box, search for **response**, then select the **Response** action.
- ![Screenshot that shows the the search bar and Response action highlighted.](./media/tutorial-send-email/choose-response-action.png)
+ ![Screenshot that shows the search bar and Response action highlighted.](./media/tutorial-send-email/choose-response-action.png)
By default, the response action sends an HTTP 200. That's good enough for this tutorial. For more information, see the [HTTP request/response reference](../connectors/connectors-native-reqres.md).
application-gateway Application Gateway Autoscaling Zone Redundant https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/application-gateway/application-gateway-autoscaling-zone-redundant.md
Previously updated : 03/01/2022 Last updated : 11/02/2023
Application Gateway and WAF can be configured to scale in two modes: -- **Autoscaling** - With autoscaling enabled, the Application Gateway and WAF v2 SKUs scale out or in based on application traffic requirements. This mode offers better elasticity to your application and eliminates the need to guess the application gateway size or instance count. This mode also allows you to save cost by not requiring the gateway to run at peak-provisioned capacity for expected maximum traffic load. You must specify a minimum and optionally maximum instance count. Minimum capacity ensures that Application Gateway and WAF v2 don't fall below the minimum instance count specified, even without traffic. Each instance is roughly equivalent to 10 more reserved Capacity Units. Zero signifies no reserved capacity and is purely autoscaling in nature. You can also optionally specify a maximum instance count, which ensures that the Application Gateway doesn't scale beyond the specified number of instances. You'll only be billed for the amount of traffic served by the Gateway. The instance counts can range from 0 to 125. The default value for maximum instance count is 10 if not specified.-- **Manual** - You can also choose Manual mode where the gateway won't autoscale. In this mode, if there's more traffic than what Application Gateway or WAF can handle, it could result in traffic loss. With manual mode, specifying instance count is mandatory. Instance count can vary from 1 to 125 instances.
+- **Autoscaling** - With autoscaling enabled, the Application Gateway and WAF v2 SKUs scale out or in based on application traffic requirements. This mode offers better elasticity to your application and eliminates the need to guess the application gateway size or instance count. This mode also allows you to save cost by not requiring the gateway to run at peak-provisioned capacity for expected maximum traffic load. You must specify a minimum and optionally maximum instance count. Minimum capacity ensures that Application Gateway and WAF v2 don't fall below the minimum instance count specified, even without traffic. Each instance is roughly equivalent to 10 more reserved Capacity Units. Zero signifies no reserved capacity and is purely autoscaling in nature. You can also optionally specify a maximum instance count, which ensures that the Application Gateway doesn't scale beyond the specified number of instances. You are only billed for the amount of traffic served by the Gateway. The instance counts can range from 0 to 125. The default value for maximum instance count is 10 if not specified.
+- **Manual** - You can also choose Manual mode where the gateway doesn't autoscale. In this mode, if there's more traffic than what Application Gateway or WAF can handle, it could result in traffic loss. With manual mode, specifying instance count is mandatory. Instance count can vary from 1 to 125 instances.
## Autoscaling and High Availability
-Azure Application Gateways are always deployed in a highly available fashion. The service is made out of multiple instances that are created as configured (if autoscaling is disabled) or required by the application load (if autoscaling is enabled). Note that from the user's perspective you don't necessarily have visibility into the individual instances, but just into the Application Gateway service as a whole. If a certain instance has a problem and stops being functional, Azure Application Gateway will transparently create a new instance.
+Azure Application Gateways are always deployed in a highly available fashion. The service is made up of multiple instances that are created as configured if autoscaling is disabled, or required by the application load if autoscaling is enabled. From the user's perspective, you don't necessarily have visibility into the individual instances, but just into the Application Gateway service as a whole. If a certain instance has a problem and stops being functional, Azure Application Gateway transparently creates a new instance.
-Even if you configure autoscaling with zero minimum instances the service will still be highly available, which is always included with the fixed price.
+Even if you configure autoscaling with zero minimum instances the service is still highly available, which is always included with the fixed price.
-However, creating a new instance can take some time (around six or seven minutes). If you don't want to have this downtime, you can configure a minimum instance count of two, ideally with Availability Zone support. This way you'll have at least two instances in your Azure Application Gateway under normal circumstances. So if one of them had a problem the other will try to handle the traffic while a new instance is being created. An Azure Application Gateway instance can support around 10 Capacity Units, so depending on how much traffic you typically have you might want to configure your minimum instance autoscaling setting to a value higher than two.
+However, creating a new instance can take around six or seven minutes. If you don't want to have this downtime, you can configure a minimum instance count of two, ideally with Availability Zone support. This way you have at least two instances in your Azure Application Gateway under normal circumstances. So if one of them had a problem the other tries to handle the traffic while a new instance is being created. An Azure Application Gateway instance can support around 10 Capacity Units. Depending on how much traffic you typically have, you might want to configure your minimum instance autoscaling setting to a value higher than two.
-For scale-in events, Application Gateway will drain existing connections for 5 minutes on the instance that is subject for removal. After 5 minutes, existing connections will be closed and the instance removed. Any new connections during or after the 5 minute scale-in time will be established to other existing instances on the same gateway.
+For scale-in events, Application Gateway drains existing connections for 5 minutes on the instance that is subject for removal. After 5 minutes, existing connections are closed and the instance removed. Any new connections during or after the 5 minute scale-in time is established to other existing instances on the same gateway.
## Next steps
+- Learn how to [Schedule autoscaling for Application Gateway](application-gateway-externally-managed-scheduled-autoscaling.md)
- Learn more about [Application Gateway v2](overview-v2.md) - [Create an autoscaling, zone redundant application gateway with a reserved virtual IP address using Azure PowerShell](tutorial-autoscale-ps.md)
application-gateway Application Gateway Externally Managed Scheduled Autoscaling https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/application-gateway/application-gateway-externally-managed-scheduled-autoscaling.md
++
+ Title: Externally managed scheduled autoscaling for Application Gateway v2
+description: This article introduces the Azure Application Standard_v2 and WAF_v2 SKU scheduled autoscaling feature.
++++ Last updated : 10/30/2023+++
+# Schedule autoscaling for Application Gateway v2
+
+## Overview
+
+For those experiencing predictable daily traffic patterns and who have a reliable estimate of the required capacity for Application Gateway, the option to preschedule the minimum capacity to better align with traffic demands might be of interest.
+
+While autoscaling is commonly utilized, itΓÇÖs important to note that Application Gateway doesn't currently support prescheduled capacity adjustments natively.
+
+The goal is to use Azure Automation to create a schedule for running runbooks that adjust the minimum autoscaling capacity of Application Gateway to meet traffic demands.
+
+## Set up scheduled autoscaling
+
+To implement scheduled autoscaling:
+1. Create an Azure Automation account resource in the same tenant as the Application Gateway.
+2. Note the system assigned managed identity of the Azure Automation account.
+3. Create PowerShell runbooks for increasing and decreasing min autoscaling capacity for the Application Gateway resource.
+4. Create the schedules during which the runbooks need to be implemented.
+5. Associate the runbooks with their respective schedules.
+6. Associate the system assigned managed identity noted in step 2 with the Application Gateway resource.
+
+## Configure automation
+
+Suppose the requirement is to increase the min count to 4 during business hours and to decrease the min count to 2 during non business hours.
+
+Two runbooks are created:
+- IncreaseMin - Sets the min count of the autoscaling configuration to 4
+- DecreaseMin - Sets the min count of the autoscaling configuration to 2
+
+Use the following PowerShell runbook to adjust capacity:
+
+ ```Azure PowerShell
+# Get the context of the managed identity
+$context = (Connect-AzAccount -Identity).Context
+# Import the Az module
+Import-Module Az
+# Adjust the min count of your Application Gateway
+$gw = Get-AzApplicationGateway -Name ΓÇ£<AppGwName>ΓÇ¥ -ResourceGroupName ΓÇ£<ResourceGroupName>ΓÇ¥
+$gw = Set-AzApplicationGatewayAutoscaleConfiguration -ApplicationGateway $gw -MinCapacity <NumberOfRequiredInstances>
+$gw = Set-AzApplicationGateway -ApplicationGateway $gw
+```
+
+Next, create the following two schedules:
+
+- WeekdayMorning ΓÇô Run the IncreaseMin runbook from Mon-Fri at 5:00AM PST
+- WeekdayEvening ΓÇô Run the DecreaseMin runbook from Mon-Fri at 9:00PM PST
+
+## FAQs
+
+- What is the SLA for timely job executions?
+
+ Azure Automation has a SLA of 99.9% for a timely start of jobs.
+
+- What happens if jobs are interrupted during execution?
+
+ - If the job already sends the request to AppGW before getting interrupted, then the request goes through.
+ - If the job gets interrupted before sending the request to Application Gateway, then it will be one of the scenarios described in next section.
+
+- What happens if job tasks donΓÇÖt occur?
+
+ | Absent job | Impact |
+ | | |
+ |IncreaseMin | Falls back on native autoscaling. Next run of DecreaseMin should be no-op as the count doesnΓÇÖt need to be adjusted. |
+ |DecreaseMin | Additional cost to the customer for the (unintended) capacity that is provisioned for those hours. Next run of IncreaseMin should be no-op because the count doesnΓÇÖt need to be adjusted. |
+
+> [!NOTE]
+> Send email to agschedule-autoscale@microsoft.com if you have questions or need help to set up managed and scheduled autoscale for your deployments.
+
+## Next steps
+
+* Learn more about [Scaling Application Gateway v2 and WAF v2](application-gateway-autoscaling-zone-redundant.md)
+* Learn more about [Monitoring Azure Automation runbooks with metric alerts](../automation/automation-alert-metric.md)
+* Learn more about [Azure Automation](../automation/overview.md)
application-gateway Http Response Codes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/application-gateway/http-response-codes.md
An HTTP 404 response can be returned if a request is sent to an application gate
#### 408 ΓÇô Request Timeout
-An HTTP 408 response can be observed when client requests to the frontend listener of application gateway don't respond back within 60 seconds. This error can be observed due to traffic congestion between on-premises networks and Azure, when virtual appliance inspects the traffic traffic, or the client itself becomes overwhelmed.
+An HTTP 408 response can be observed when client requests to the frontend listener of application gateway don't respond back within 60 seconds. This error can be observed due to traffic congestion between on-premises networks and Azure, when virtual appliance inspects the traffic, or the client itself becomes overwhelmed.
#### 413 ΓÇô Request Entity Too Large
attestation Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/attestation/policy-reference.md
Title: Built-in policy definitions for Azure Attestation description: Lists Azure Policy built-in policy definitions for Azure Attestation. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
automation Automation Solution Vm Management https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/automation/automation-solution-vm-management.md
Use one of the following mechanisms to access the enabled feature:
* From your Automation account, select **Start/Stop VM** under **Related Resources**. On the Start/Stop VM page, select **Manage the solution** under **Manage Start/Stop VM Solutions**.
-* Navigate to the Log Analytics workspace linked to your Automation account. After after selecting the workspace, choose **Solutions** from the left pane. On the Solutions page, select **Start-Stop-VM[workspace]** from the list.
+* Navigate to the Log Analytics workspace linked to your Automation account. After selecting the workspace, choose **Solutions** from the left pane. On the Solutions page, select **Start-Stop-VM[workspace]** from the list.
Selecting the feature displays the **Start-Stop-VM[workspace]** page. Here you can review important details, such as the information in the **StartStopVM** tile. As in your Log Analytics workspace, this tile displays a count and a graphical representation of the runbook jobs for the feature that have started and have finished successfully.
automation Guidance Migration Log Analytics Monitoring Agent https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/automation/change-tracking/guidance-migration-log-analytics-monitoring-agent.md
Previously updated : 09/14/2023 Last updated : 11/03/2023
Follow these steps to migrate using scripts.
#### Migration guidance
-1. Install the script to run to conduct migrations.
+1. Install the script and run it to conduct migrations.
1. Ensure that the new workspace resource ID is different to the one with which it's associated to in the Change Tracking and Inventory using the LA version. 1. Migrate settings for the following data types: - Windows Services
To obtain the Log Analytics Workspace resource ID, follow these steps:
### [Using PowerShell script](#tab/limit-policy) 1. For File Content changes-based settings, you have to migrate manually from LA version to AMA version of Change Tracking & Inventory. Follow the guidance listed in [Track file contents](manage-change-tracking.md#track-file-contents).
+1. Any VM with > 100 file/registry settings for migration via portal isn't supported now.
1. Alerts that you configure using the Log Analytics Workspace must be [manually configured](configure-alerts.md).
automation Dsc Linux Powershell https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/automation/dsc-linux-powershell.md
Register the Azure Linux VM as a Desired State Configuration (DSC) node for the
These commands obtain the Automation account's primary access key and URL and concatenates it to the registration command. Ensure you remove any carriage returns from the output. This command will be used in a later step.
-1. Connect to your Azure Linux VM. If you used a password, you can use the syntax below. If you used a public-private key pair, see [SSH on Linux](./../virtual-machines/linux/mac-create-ssh-keys.md) for detailed steps. The other commands retrieve information about what packages can be installed, including what updates to currently installed packages packages are available, and installs Python.
+1. Connect to your Azure Linux VM. If you used a password, you can use the syntax below. If you used a public-private key pair, see [SSH on Linux](./../virtual-machines/linux/mac-create-ssh-keys.md) for detailed steps. The other commands retrieve information about what packages can be installed, including what updates to currently installed packages are available, and installs Python.
```cmd ssh user@IP
The output should look similar as shown below:
:::image type="content" source="media/dsc-linux-powershell/get-azautomationdscnodereport-output.png" alt-text="Output from Get-AzAutomationDscNodeReport command.":::
-The first report may not be available immediately and may take up to 30 minutes after you enable a node. For more information about report data, see see [Using a DSC report server](/powershell/dsc/pull-server/reportserver).
+The first report may not be available immediately and may take up to 30 minutes after you enable a node. For more information about report data, see [Using a DSC report server](/powershell/dsc/pull-server/reportserver).
## Clean up resources
automation Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/automation/policy-reference.md
Title: Built-in policy definitions for Azure Automation description: Lists Azure Policy built-in policy definitions for Azure Automation. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
automation Whats New https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/automation/whats-new.md
description: Significant updates to Azure Automation updated each month.
Previously updated : 10/03/2023 Last updated : 10/27/2023
This page is updated monthly, so revisit it regularly. If you're looking for ite
## October 2023
+## General Availability: Automation extension for Visual Studio Code
+
+ Azure Automation now provides an advanced editing experience for PowerShell and Python scripts along with [runbook management operations](how-to/runbook-authoring-extension-for-vscode.md). For more information, see the [Key features and limitations](automation-runbook-authoring.md).
++ ### General Availability: Change Tracking using Azure Monitoring Agent Azure Automation announces General Availability of Change Tracking using Azure Monitoring Agent. [Learn more](change-tracking/guidance-migration-log-analytics-monitoring-agent.md). + ### Retirement of Run As accounts **Type: Retirement**
azure-app-configuration Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-app-configuration/policy-reference.md
Title: Built-in policy definitions for Azure App Configuration description: Lists Azure Policy built-in policy definitions for Azure App Configuration. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-arc Automated Integration Testing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/data/automated-integration-testing.md
There are two files that need to be generated to localize the launcher to run in
* `patch.json`: fill out from `patch.json.tmpl` > [!TIP]
-> The `.test.env` is a single set of of environment variables that drives the launcher's behavior. Generating it with care for a given environment will ensure reproducibility of the launcher's behavior.
+> The `.test.env` is a single set of environment variables that drives the launcher's behavior. Generating it with care for a given environment will ensure reproducibility of the launcher's behavior.
### Config 1: `.test.env`
azure-arc Connectivity https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/data/connectivity.md
Azure Arc-enabled data services provide you the option to connect to Azure in tw
- Directly connected - Indirectly connected
-The connectivity mode provides you the flexibility to choose how much data is sent to Azure and how users interact with the Arc Data Controller. Depending on the connectivity mode that is chosen, some functionality of Azure Arc-enabled data services may or may not be available.
+The connectivity mode provides you the flexibility to choose how much data is sent to Azure and how users interact with the Arc Data Controller. Depending on the connectivity mode that is chosen, some functionality of Azure Arc-enabled data services might or might not be available.
-Importantly, if the Azure Arc-enabled data services are directly connected to Azure, then users can use [Azure Resource Manager APIs](/rest/api/resources/), the Azure CLI, and the Azure portal to operate the Azure Arc data services. The experience in directly connected mode is much like how you would use any other Azure service with provisioning/de-provisioning, scaling, configuring, and so on all in the Azure portal. If the Azure Arc-enabled data services are indirectly connected to Azure, then the Azure portal is a read-only view. You can see the inventory of SQL managed instances and PostgreSQL servers that you have deployed and the details about them, but you cannot take action on them in the Azure portal. In the indirectly connected mode, all actions must be taken locally using Azure Data Studio, the appropriate CLI, or Kubernetes native tools like kubectl.
+Importantly, if the Azure Arc-enabled data services are directly connected to Azure, then users can use [Azure Resource Manager APIs](/rest/api/resources/), the Azure CLI, and the Azure portal to operate the Azure Arc data services. The experience in directly connected mode is much like how you would use any other Azure service with provisioning/de-provisioning, scaling, configuring, and so on, all in the Azure portal. If the Azure Arc-enabled data services are indirectly connected to Azure, then the Azure portal is a read-only view. You can see the inventory of SQL managed instances and PostgreSQL servers that you have deployed and the details about them, but you can't take action on them in the Azure portal. In the indirectly connected mode, all actions must be taken locally using Azure Data Studio, the appropriate CLI, or Kubernetes native tools like kubectl.
-Additionally, Microsoft Entra ID and Azure Role-Based Access Control can be used in the directly connected mode only because there is a dependency on a continuous and direct connection to Azure to provide this functionality.
+Additionally, Microsoft Entra ID and Azure Role-Based Access Control can be used in the directly connected mode only because there's a dependency on a continuous and direct connection to Azure to provide this functionality.
Some Azure-attached services are only available when they can be directly reached such as Container Insights, and backup to blob storage. ||**Indirectly connected**|**Directly connected**|**Never connected**| |||||
-|**Description**|Indirectly connected mode offers most of the management services locally in your environment with no direct connection to Azure. A minimal amount of data must be sent to Azure for inventory and billing purposes _only_. It is exported to a file and uploaded to Azure at least once per month. No direct or continuous connection to Azure is required. Some features and services which require a connection to Azure will not be available.|Directly connected mode offers all of the available services when a direct connection can be established with Azure. Connections are always initiated _from_ your environment to Azure and use standard ports and protocols such as HTTPS/443.|No data can be sent to or from Azure in any way.|
+|**Description**|Indirectly connected mode offers most of the management services locally in your environment with no direct connection to Azure. A minimal amount of data must be sent to Azure for inventory and billing purposes _only_. It's exported to a file and uploaded to Azure at least once per month. No direct or continuous connection to Azure is required. Some features and services that require a connection to Azure won't be available.|Directly connected mode offers all of the available services when a direct connection can be established with Azure. Connections are always initiated _from_ your environment to Azure and use standard ports and protocols such as HTTPS/443.|No data can be sent to or from Azure in any way.|
|**Current availability**| Available |Available|Not currently supported.|
-|**Typical use cases**|On-premises data centers that donΓÇÖt allow connectivity in or out of the data region of the data center due to business or regulatory compliance policies or out of concerns of external attacks or data exfiltration. Typical examples: Financial institutions, health care, government. <br/><br/>Edge site locations where the edge site doesnΓÇÖt typically have connectivity to the Internet. Typical examples: oil/gas or military field applications. <br/><br/>Edge site locations that have intermittent connectivity with long periods of outages. Typical examples: stadiums, cruise ships. | Organizations who are using public clouds. Typical examples: Azure, AWS or Google Cloud.<br/><br/>Edge site locations where Internet connectivity is typically present and allowed. Typical examples: retail stores, manufacturing.<br/><br/>Corporate data centers with more permissive policies for connectivity to/from their data region of the datacenter to the Internet. Typical examples: Non-regulated businesses, small/medium sized businesses|Truly "air-gapped" environments where no data under any circumstances can come or go from the data environment. Typical examples: top secret government facilities.|
-|**How data is sent to Azure**|There are three options for how the billing and inventory data can be sent to Azure:<br><br> 1) Data is exported out of the data region by an automated process that has connectivity to both the secure data region and Azure.<br><br>2) Data is exported out of the data region by an automated process within the data region, automatically copied to a less secure region, and an automated process in the less secure region uploads the data to Azure.<br><br>3) Data is manually exported by a user within the secure region, manually brought out of the secure region, and manually uploaded to Azure. <br><br>The first two options are an automated continuous process that can be scheduled to run frequently so there is minimal delay in the transfer of data to Azure subject only to the available connectivity to Azure.|Data is automatically and continuously sent to Azure.|Data is never sent to Azure.|
+|**Typical use cases**|On-premises data centers that donΓÇÖt allow connectivity in or out of the data region of the data center due to business or regulatory compliance policies or out of concerns of external attacks or data exfiltration. Typical examples: Financial institutions, health care, government. <br/><br/>Edge site locations where the edge site doesnΓÇÖt typically have connectivity to the Internet. Typical examples: oil/gas or military field applications. <br/><br/>Edge site locations that have intermittent connectivity with long periods of outages. Typical examples: stadiums, cruise ships. | Organizations who are using public clouds. Typical examples: Azure, AWS or Google Cloud.<br/><br/>Edge site locations where Internet connectivity is typically present and allowed. Typical examples: retail stores, manufacturing.<br/><br/>Corporate data centers with more permissive policies for connectivity to/from their data region of the datacenter to the Internet. Typical examples: Nonregulated businesses, small/medium sized businesses|Truly "air-gapped" environments where no data under any circumstances can come or go from the data environment. Typical examples: top secret government facilities.|
+|**How data is sent to Azure**|There are three options for how the billing and inventory data can be sent to Azure:<br><br> 1) Data is exported out of the data region by an automated process that has connectivity to both the secure data region and Azure.<br><br>2) Data is exported out of the data region by an automated process within the data region, automatically copied to a less secure region, and an automated process in the less secure region uploads the data to Azure.<br><br>3) Data is manually exported by a user within the secure region, manually brought out of the secure region, and manually uploaded to Azure. <br><br>The first two options are an automated continuous process that can be scheduled to run frequently so there's minimal delay in the transfer of data to Azure subject only to the available connectivity to Azure.|Data is automatically and continuously sent to Azure.|Data is never sent to Azure.|
## Feature availability by connectivity mode
Some Azure-attached services are only available when they can be directly reache
|**Automatic upgrades and patching**|Supported<br/>The data controller must either have direct access to the Microsoft Container Registry (MCR) or the container images need to be pulled from MCR and pushed to a local, private container registry that the data controller has access to.|Supported| |**Automatic backup and restore**|Supported<br/>Automatic local backup and restore.|Supported<br/>In addition to automated local backup and restore, you can _optionally_ send backups to Azure blob storage for long-term, off-site retention.| |**Monitoring**|Supported<br/>Local monitoring using Grafana and Kibana dashboards.|Supported<br/>In addition to local monitoring dashboards, you can _optionally_ send monitoring data and logs to Azure Monitor for at-scale monitoring of multiple sites in one place. |
-|**Authentication**|Use local username/password for data controller and dashboard authentication. Use SQL and Postgres logins or Active Directory (AD is not currently supported) for connectivity to database instances. Use Kubernetes authentication providers for authentication to the Kubernetes API.|In addition to or instead of the authentication methods for the indirectly connected mode, you can _optionally_ use Microsoft Entra ID.|
+|**Authentication**|Use local username/password for data controller and dashboard authentication. Use SQL and Postgres logins or Active Directory (AD isn't currently supported) for connectivity to database instances. Use Kubernetes authentication providers for authentication to the Kubernetes API.|In addition to or instead of the authentication methods for the indirectly connected mode, you can _optionally_ use Microsoft Entra ID.|
|**Role-based access control (RBAC)**|Use Kubernetes RBAC on Kubernetes API. Use SQL and Postgres RBAC for database instances.|You can use Microsoft Entra ID and Azure RBAC.| ## Connectivity requirements **Some functionality requires a connection to Azure.**
-**All communication with Azure is always initiated from your environment.** This is true even for operations which are initiated by a user in the Azure portal. In that case, there is effectively a task, which is queued up in Azure. An agent in your environment initiates the communication with Azure to see what tasks are in the queue, runs the tasks, and reports back the status/completion/fail to Azure.
+**All communication with Azure is always initiated from your environment.** This is true even for operations that are initiated by a user in the Azure portal. In that case, there is effectively a task, which is queued up in Azure. An agent in your environment initiates the communication with Azure to see what tasks are in the queue, runs the tasks, and reports back the status/completion/fail to Azure.
|**Type of Data**|**Direction**|**Required/Optional**|**Additional Costs**|**Mode Required**|**Notes**| |||||||
-|**Container images**|Microsoft Container Registry -> Customer|Required|No|Indirect or direct|Container images are the method for distributing the software. In an environment which can connect to the Microsoft Container Registry (MCR) over the Internet, the container images can be pulled directly from MCR. In the event that the deployment environment doesnΓÇÖt have direct connectivity, you can pull the images from MCR and push them to a private container registry in the deployment environment. At creation time, you can configure the creation process to pull from the private container registry instead of MCR. This will also apply to automated updates.|
+|**Container images**|Microsoft Container Registry -> Customer|Required|No|Indirect or direct|Container images are the method for distributing the software. In an environment which can connect to the Microsoft Container Registry (MCR) over the Internet, the container images can be pulled directly from MCR. If the deployment environment doesnΓÇÖt have direct connectivity, you can pull the images from MCR and push them to a private container registry in the deployment environment. At creation time, you can configure the creation process to pull from the private container registry instead of MCR. This also applies to automated updates.|
|**Resource inventory**|Customer environment -> Azure|Required|No|Indirect or direct|An inventory of data controllers, database instances (PostgreSQL and SQL) is kept in Azure for billing purposes and also for purposes of creating an inventory of all data controllers and database instances in one place which is especially useful if you have more than one environment with Azure Arc data services. As instances are provisioned, deprovisioned, scaled out/in, scaled up/down the inventory is updated in Azure.| |**Billing telemetry data**|Customer environment -> Azure|Required|No|Indirect or direct|Utilization of database instances must be sent to Azure for billing purposes. |
-|**Monitoring data and logs**|Customer environment -> Azure|Optional|Maybe depending on data volume (see [Azure Monitor pricing](https://azure.microsoft.com/pricing/details/monitor/))|Indirect or direct|You may want to send the locally collected monitoring data and logs to Azure Monitor for aggregating data across multiple environments into one place and also to use Azure Monitor services like alerts, using the data in Azure Machine Learning, etc.|
-|**Azure Role-based Access Control (Azure RBAC)**|Customer environment -> Azure -> Customer Environment|Optional|No|Direct only|If you want to use Azure RBAC, then connectivity must be established with Azure at all times. If you donΓÇÖt want to use Azure RBAC then local Kubernetes RBAC can be used.|
-|**Microsoft Entra ID (Future)**|Customer environment -> Azure -> Customer environment|Optional|Maybe, but you may already be paying for Microsoft Entra ID|Direct only|If you want to use Microsoft Entra ID for authentication, then connectivity must be established with Azure at all times. If you donΓÇÖt want to use Microsoft Entra ID for authentication, you can use Active Directory Federation Services (ADFS) over Active Directory. **Pending availability in directly connected mode**|
+|**Monitoring data and logs**|Customer environment -> Azure|Optional|Maybe depending on data volume (see [Azure Monitor pricing](https://azure.microsoft.com/pricing/details/monitor/))|Indirect or direct|You might want to send the locally collected monitoring data and logs to Azure Monitor for aggregating data across multiple environments into one place and also to use Azure Monitor services like alerts, using the data in Azure Machine Learning, etc.|
+|**Azure Role-based Access Control (Azure RBAC)**|Customer environment -> Azure -> Customer Environment|Optional|No|Direct only|If you want to use Azure RBAC, then connectivity must be established with Azure at all times. If you donΓÇÖt want to use Azure RBAC, then local Kubernetes RBAC can be used.|
+|**Microsoft Entra ID (Future)**|Customer environment -> Azure -> Customer environment|Optional|Maybe, but you might already be paying for Microsoft Entra ID|Direct only|If you want to use Microsoft Entra ID for authentication, then connectivity must be established with Azure at all times. If you donΓÇÖt want to use Microsoft Entra ID for authentication, you can use Active Directory Federation Services (ADFS) over Active Directory. **Pending availability in directly connected mode**|
|**Backup and restore**|Customer environment -> Customer environment|Required|No|Direct or indirect|The backup and restore service can be configured to point to local storage classes. |
-|**Azure backup - long term retention (Future)**| Customer environment -> Azure | Optional| Yes for Azure storage | Direct only |You may want to send backups that are taken locally to Azure Backup for long-term, off-site retention of backups and bring them back to the local environment for restore. |
-|**Provisioning and configuration changes from Azure portal**|Customer environment -> Azure -> Customer environment|Optional|No|Direct only|Provisioning and configuration changes can be done locally using Azure Data Studio or the appropriate CLI. In directly connected mode, you will also be able to provision and make configuration changes from the Azure portal.|
+|**Azure backup - long term retention (Future)**| Customer environment -> Azure | Optional| Yes for Azure storage | Direct only |You might want to send backups that are taken locally to Azure Backup for long-term, off-site retention of backups and bring them back to the local environment for restore. |
+|**Provisioning and configuration changes from Azure portal**|Customer environment -> Azure -> Customer environment|Optional|No|Direct only|Provisioning and configuration changes can be done locally using Azure Data Studio or the appropriate CLI. In directly connected mode, you can also provision and make configuration changes from the Azure portal.|
## Details on internet addresses, ports, encryption, and proxy server support
Some Azure-attached services are only available when they can be directly reache
## Additional network requirements
-In addition, resource bridge (preview) requires [Arc-enabled Kubernetes endpoints](../network-requirements-consolidated.md#azure-arc-enabled-kubernetes-endpoints).
+In addition, resource bridge requires [Arc-enabled Kubernetes endpoints](../network-requirements-consolidated.md#azure-arc-enabled-kubernetes-endpoints).
azure-arc Migrate Postgresql Data https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/data/migrate-postgresql-data.md
This document describes the steps to get your existing PostgreSQL database (one
## Considerations
-Azure Arc-enabled PostgreSQL server is the community version of PostgreSQL. So any tool that that works on PostgreSQL outside of Azure Arc should work with Azure Arc-enabled PostgreSQL server.
+Azure Arc-enabled PostgreSQL server is the community version of PostgreSQL. So any tool that works on PostgreSQL outside of Azure Arc should work with Azure Arc-enabled PostgreSQL server.
As such, with the set of tools you use today for Postgres, you should be able to:
azure-arc Release Notes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/data/release-notes.md
As a preview feature, the technology presented in this article is subject to [Su
### Breaking change -- Kubernetes native deployment templates have been modified. Update update your .yml templates.
+- Kubernetes native deployment templates have been modified. Update your .yml templates.
- Updated templates for data controller, bootstrapper, & SQL Managed instance: [GitHub microsoft/azure-arc pr 574](https://github.com/microsoft/azure_arc/pull/574) - Updated templates for PostgreSQL server: [GitHub microsoft/azure-arc pr 574](https://github.com/microsoft/azure_arc/pull/574)
azure-arc Service Tiers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/data/service-tiers.md
# Azure Arc-enabled SQL Managed Instance service tiers
-As part of of the family of Azure SQL products, Azure Arc-enabled SQL Managed Instance is available in two [vCore](/azure/azure-sql/database/service-tiers-vcore) service tiers.
+As part of the family of Azure SQL products, Azure Arc-enabled SQL Managed Instance is available in two [vCore](/azure/azure-sql/database/service-tiers-vcore) service tiers.
- **General Purpose** is a budget-friendly tier designed for most workloads with common performance and availability features. - **Business Critical** tier is designed for performance-sensitive workloads with higher availability features.
azure-arc Extensions Release https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/kubernetes/extensions-release.md
Title: "Available extensions for Azure Arc-enabled Kubernetes clusters" Previously updated : 10/20/2023 Last updated : 11/03/2023 description: "See which extensions are currently available for Azure Arc-enabled Kubernetes clusters and view release notes."
For more information, see [Deploy an Azure API Management gateway on Azure Arc (
- **Supported distributions**: All Cloud Native Computing Foundation (CNCF) certified Kubernetes clusters. Not currently supported for ARM 64.
-The AzureML extension lets you deploy and run Azure Machine Learning on Azure Arc-enabled Kubernetes clusters.
+The Azure Machine Learning extension lets you deploy and run Azure Machine Learning on Azure Arc-enabled Kubernetes clusters.
-For more information, see [Introduction to Kubernetes compute target in AzureML](../../machine-learning/how-to-attach-kubernetes-anywhere.md) and [Deploy AzureML extension on AKS or Arc Kubernetes cluster](../../machine-learning/how-to-deploy-kubernetes-extension.md).
+For more information, see [Introduction to Kubernetes compute target in Azure Machine Learning](../../machine-learning/how-to-attach-kubernetes-anywhere.md) and [Deploy Azure Machine Learning extension on AKS or Arc Kubernetes cluster](../../machine-learning/how-to-deploy-kubernetes-extension.md).
## Flux (GitOps)
For more information, see [Introduction to Kubernetes compute target in AzureML]
For more information, see [Tutorial: Deploy applications using GitOps with Flux v2](tutorial-use-gitops-flux2.md).
-The currently supported versions of the `microsoft.flux` extension are described below. The most recent version of the Flux v2 extension and the two previous versions (N-2) are supported. We generally recommend that you use the most recent version of the extension.
+The most recent version of the Flux v2 extension and the two previous versions (N-2) are supported. We generally recommend that you use the most recent version of the extension.
> [!IMPORTANT] > Eventually, a major version update (v2.x.x) for the `microsoft.flux` extension will be released. When this happens, clusters won't be auto-upgraded to this version, since [auto-upgrade is only supported for minor version releases](extensions.md#upgrade-extension-instance). If you're still using an older API version when the next major version is released, you'll need to update your manifests to the latest API versions, perform any necessary testing, then upgrade your extension manually. For more information about the new API versions (breaking changes) and how to update your manifests, see the [Flux v2 release notes](https://github.com/fluxcd/flux2/releases/tag/v2.0.0).
+> [!NOTE]
+> When a new version of the `microsoft.flux` extension is released, it may take several days for the new version to become available in all regions.
+
+### 1.8.1 (November 2023)
+
+Flux version: [Release v2.1.2](https://github.com/fluxcd/flux2/releases/tag/v2.1.2)
+
+- source-controller: v1.1.2
+- kustomize-controller: v1.1.1
+- helm-controller: v0.36.2
+- notification-controller: v1.1.0
+- image-automation-controller: v0.36.1
+- image-reflector-controller: v0.30.0
+
+Changes made for this version:
+
+- Upgrades Flux to [v2.1.2](https://github.com/fluxcd/flux2/releases/tag/v2.1.2)
+- Updates to each `fluxConfiguration` status are now relayed back to Azure once every minute, provided there are any changes to report
+ ### 1.8.0 (October 2023) Flux version: [Release v2.1.1](https://github.com/fluxcd/flux2/releases/tag/v2.1.1)
Flux version: [Release v2.0.1](https://github.com/fluxcd/flux2/releases/tag/v2.0
Changes made for this version: - Upgrades Flux to [v2.0.1](https://github.com/fluxcd/flux2/releases/tag/v2.0.1)-- Promotes some APIs to v1. This change should not affect any existing Flux configurations that have already been deployed. Previous API versions will still be supported in all `microsoft.flux` v.1.x.x releases. However, we recommend that you update the API versions in your manifests as soon as possible. For more information about the new API versions (breaking changes) and how to update your manifests, see the [Flux v2 release notes](https://github.com/fluxcd/flux2/releases/tag/v2.0.0).
+- Promotes some APIs to v1. This change shouldn't affect any existing Flux configurations that have already been deployed. Previous API versions will still be supported in all `microsoft.flux` v.1.x.x releases. However, we recommend that you update the API versions in your manifests as soon as possible. For more information about the new API versions (breaking changes) and how to update your manifests, see the [Flux v2 release notes](https://github.com/fluxcd/flux2/releases/tag/v2.0.0).
- Adds support for [Helm drift detection](tutorial-use-gitops-flux2.md#helm-drift-detection) and [OOM watch](tutorial-use-gitops-flux2.md#helm-oom-watch). ### 1.7.4 (June 2023)
Flux version: [Release v0.41.2](https://github.com/fluxcd/flux2/releases/tag/v0.
Changes made for this version: -- Adds support for [`wait`](https://fluxcd.io/flux/components/kustomize/kustomization/#wait) and [`postBuild`](https://fluxcd.io/flux/components/kustomize/kustomization/#post-build-variable-substitution) properties as optional parameters for kustomization. By default, `wait` will be set to `true` for all Flux configurations, and `postBuild` will be null. ([Example](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json#L55))
+- Adds support for [`wait`](https://fluxcd.io/flux/components/kustomize/kustomization/#wait) and [`postBuild`](https://fluxcd.io/flux/components/kustomize/kustomization/#post-build-variable-substitution) properties as optional parameters for kustomization. By default, `wait` is set to `true` for all Flux configurations, and `postBuild` is null. ([Example](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json#L55))
- Adds support for optional properties [`waitForReconciliation`](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/fluxconfiguration.json#L1299C14-L1299C35) and [`reconciliationWaitDuration`](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/fluxconfiguration.json#L1304).
- By default, `waitForReconciliation` is set to false, so when creating a flux configuration, the `provisioningState` returns `Succeeded` once the configuration reaches the cluster and the ARM template or Azure CLI command successfully exits. However, the actual state of the objects being deployed as part of the configuration is tracked by `complianceState`, which can be viewed in the portal or by using Azure CLI. Setting `waitForReconciliation` to true and specifying a `reconciliationWaitDuration` means that the template or CLI deployment will wait for `complianceState` to reach a terminal state (success or failure) before exiting. ([Example](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json#L72))
+ By default, `waitForReconciliation` is set to false, so when creating a flux configuration, the `provisioningState` returns `Succeeded` once the configuration reaches the cluster and the ARM template or Azure CLI command successfully exits. However, the actual state of the objects being deployed as part of the configuration is tracked by `complianceState`, which can be viewed in the portal or by using Azure CLI. Setting `waitForReconciliation` to true and specifying a `reconciliationWaitDuration` means that the template or CLI deployment waits for `complianceState` to reach a terminal state (success or failure) before exiting. ([Example](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json#L72))
## Dapr extension for Azure Kubernetes Service (AKS) and Arc-enabled Kubernetes
azure-arc Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/kubernetes/policy-reference.md
Title: Built-in policy definitions for Azure Arc-enabled Kubernetes description: Lists Azure Policy built-in policy definitions for Azure Arc-enabled Kubernetes. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023 #
azure-arc Network Requirements Consolidated https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/network-requirements-consolidated.md
Title: Azure Arc network requirements description: A consolidated list of network requirements for Azure Arc features and Azure Arc-enabled services. Lists endpoints, ports, and protocols. Previously updated : 11/01/2023 Last updated : 11/03/2023
Connectivity to Arc-enabled server endpoints is required for:
For more information, see [Connected Machine agent network requirements](servers/network-requirements.md).
-## Azure Arc resource bridge (preview)
+## Azure Arc resource bridge
-This section describes additional networking requirements specific to deploying Azure Arc resource bridge (preview) in your enterprise. These requirements also apply to Azure Arc-enabled VMware vSphere (preview) and Azure Arc-enabled System Center Virtual Machine Manager (preview).
+This section describes additional networking requirements specific to deploying Azure Arc resource bridge in your enterprise. These requirements also apply to Azure Arc-enabled VMware vSphere (preview) and Azure Arc-enabled System Center Virtual Machine Manager (preview).
[!INCLUDE [network-requirements](resource-bridge/includes/network-requirements.md)]
-For more information, see [Azure Arc resource bridge (preview) network requirements](resource-bridge/network-requirements.md).
+For more information, see [Azure Arc resource bridge network requirements](resource-bridge/network-requirements.md).
## Azure Arc-enabled System Center Virtual Machine Manager (preview)
Azure Arc-enabled System Center Virtual Machine Manager (SCVMM) also requires:
For more information, see [Overview of Arc-enabled System Center Virtual Machine Manager (preview)](system-center-virtual-machine-manager/overview.md).
-## Azure Arc-enabled VMware vSphere (preview)
+## Azure Arc-enabled VMware vSphere
Azure Arc-enabled VMware vSphere also requires:
Azure Arc-enabled VMware vSphere also requires:
| | | | | | | vCenter Server | 443 | URL of the vCenter server | Appliance VM IP and control plane endpoint need outbound connection. | Used to by the vCenter server to communicate with the Appliance VM and the control plane.|
-For more information, see [Support matrix for Azure Arc-enabled VMware vSphere (preview)](vmware-vsphere/support-matrix-for-arc-enabled-vmware-vsphere.md).
+For more information, see [Support matrix for Azure Arc-enabled VMware vSphere](vmware-vsphere/support-matrix-for-arc-enabled-vmware-vsphere.md).
## Additional endpoints
azure-arc Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/overview.md
Title: Azure Arc overview description: Learn about what Azure Arc is and how it helps customers enable management and governance of their hybrid resources with other Azure services and features. Previously updated : 10/24/2023 Last updated : 11/03/2023
Currently, Azure Arc allows you to manage the following resource types hosted ou
* [Azure data services](dat): Run Azure data services on-premises, at the edge, and in public clouds using Kubernetes and the infrastructure of your choice. SQL Managed Instance and PostgreSQL (preview) services are currently available. * [SQL Server](/sql/sql-server/azure-arc/overview): Extend Azure services to SQL Server instances hosted outside of Azure.
-* Virtual machines (preview): Provision, resize, delete and manage virtual machines based on [VMware vSphere](./vmware-vsphere/overview.md) or [Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview) and enable VM self-service through role-based access.
+* Virtual machines: Provision, resize, delete and manage virtual machines based on [VMware vSphere](./vmware-vsphere/overview.md) or [Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview) and enable VM self-service through role-based access.
## Key features and benefits
azure-arc Deploy Cli https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/deploy-cli.md
Title: Azure Arc resource bridge (preview) deployment command overview
-description: Learn about the Azure CLI commands that can be used to manage your Azure Arc resource bridge (preview) deployment.
Previously updated : 02/06/2023
+ Title: Azure Arc resource bridge deployment command overview
+description: Learn about the Azure CLI commands that can be used to manage your Azure Arc resource bridge deployment.
Last updated : 11/03/2023
-# Azure Arc resource bridge (preview) deployment command overview
+# Azure Arc resource bridge deployment command overview
[Azure CLI](/cli/azure/install-azure-cli) is required to deploy the Azure Arc resource bridge. When deploying Arc resource bridge with a corresponding partner product, the Azure CLI commands may be combined into an automation script, along with additional provider-specific commands. To learn about installing Arc resource bridge with a corresponding partner product, see:
- [Azure Stack HCI VM Management through Arc resource bridge](/azure-stack/hci/manage/azure-arc-vm-management-prerequisites) - [AKS on HCI (AKS hybrid) - Arc resource bridge deployment](/azure/aks/hybrid/deploy-arc-resource-bridge-windows-server)
-This topic provides an overview of the [Azure CLI commands](/cli/azure/arcappliance) that are used to manage Arc resource bridge (preview) deployment, in the order in which they are typically used for deployment.
+This topic provides an overview of the [Azure CLI commands](/cli/azure/arcappliance) that are used to manage Arc resource bridge deployment, in the order in which they are typically used for deployment.
## `az arcappliance createconfig`
azure-arc Maintenance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/maintenance.md
Title: Azure Arc resource bridge (preview) maintenance operations
-description: Learn how to manage Azure Arc resource bridge (preview) so that it remains online and operational.
+ Title: Azure Arc resource bridge maintenance operations
+description: Learn how to manage Azure Arc resource bridge so that it remains online and operational.
Previously updated : 03/08/2023 Last updated : 11/03/2023
-# Azure Arc resource bridge (preview) maintenance operations
+# Azure Arc resource bridge maintenance operations
-To keep your Azure Arc resource bridge (preview) deployment online and operational, you may need to perform maintenance operations such as updating credentials or monitoring upgrades.
+To keep your Azure Arc resource bridge deployment online and operational, you might need to perform maintenance operations such as updating credentials or monitoring upgrades.
-To maintain the on-premises appliance VM, the [appliance configuration files generated during deployment](deploy-cli.md#az-arcappliance-createconfig) need to be saved in a secure location and made available on the management machine. The management machine used to perform maintenance operations must meet all of [the Arc resource bridge (preview) requirements](system-requirements.md).
+To maintain the on-premises appliance VM, the [appliance configuration files generated during deployment](deploy-cli.md#az-arcappliance-createconfig) need to be saved in a secure location and made available on the management machine. The management machine used to perform maintenance operations must meet all of [the Arc resource bridge requirements](system-requirements.md).
-The following sections describe some of the most common maintenance tasks for Arc resource bridge (preview).
+The following sections describe some of the most common maintenance tasks for Arc resource bridge.
## Update credentials in the appliance VM
If the credentials change, the credentials stored in the Arc resource bridge nee
## Troubleshoot Arc resource bridge
-If you experience problems with the appliance VM, the appliance configuration files may help with troubleshooting. You can include these files when you [open an Azure support request](../../azure-portal/supportability/how-to-create-azure-support-request.md).
+If you experience problems with the appliance VM, the appliance configuration files can help with troubleshooting. You can include these files when you [open an Azure support request](../../azure-portal/supportability/how-to-create-azure-support-request.md).
-You may also want to [collect logs](/cli/azure/arcappliance/logs#az-arcappliance-logs-vmware), which requires you to pass credentials to the on-premises control center:
+You might want to [collect logs](/cli/azure/arcappliance/logs#az-arcappliance-logs-vmware), which requires you to pass credentials to the on-premises control center:
- For VMWare vSphere, use the username and password provided to Arc resource bridge at deployment. - For Azure Stack HCI, use the cloud service IP and HCI login configuration file path. ## Delete Arc resource bridge
-You may need to delete Arc resource bridge due to deployment failures or when no longer needed. To do so, you'll need the appliance configuration files. The [delete command](deploy-cli.md#az-arcappliance-delete) is the recommended way to delete the bridge. This command deletes the on-premises appliance VM as well as the Azure resource and underlying components across the two environments.
+You might need to delete Arc resource bridge due to deployment failures or when no longer needed. To do so, you need the appliance configuration files. The [delete command](deploy-cli.md#az-arcappliance-delete) is the recommended way to delete the bridge. This command deletes the on-premises appliance VM along with the Azure resource and underlying components across the two environments.
## Next steps -- Review the [Azure Arc resource bridge (preview) overview](overview.md) to understand more about requirements and technical details.-- Learn about [system requirements for Azure Arc resource bridge (preview)](system-requirements.md).
+- Learn about [upgrading Arc resource bridge](upgrade.md).
+- Review the [Azure Arc resource bridge overview](overview.md) to understand more about requirements and technical details.
+- Learn about [system requirements for Azure Arc resource bridge](system-requirements.md).
azure-arc Network Requirements https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/network-requirements.md
Title: Azure Arc resource bridge (preview) network requirements
-description: Learn about network requirements for Azure Arc resource bridge (preview) including URLs that must be allowlisted.
+ Title: Azure Arc resource bridge network requirements
+description: Learn about network requirements for Azure Arc resource bridge including URLs that must be allowlisted.
Previously updated : 08/24/2023 Last updated : 11/03/2023
-# Azure Arc resource bridge (preview) network requirements
+# Azure Arc resource bridge network requirements
-This article describes the networking requirements for deploying Azure Arc resource bridge (preview) in your enterprise.
+This article describes the networking requirements for deploying Azure Arc resource bridge in your enterprise.
## General network requirements
-Arc resource bridge communicates outbound securely to Azure Arc over TCP port 443. If the appliance needs to connect through a firewall or proxy server to communicate over the internet, it communicates outbound using the HTTPS protocol.
+Arc resource bridge communicates outbound securely to Azure Arc over TCP port 443. If the appliance needs to connect through a firewall or proxy server to communicate over the internet, it communicates outbound using the HTTPS protocol.
[!INCLUDE [network-requirement-principles](../includes/network-requirement-principles.md)]
Arc resource bridge communicates outbound securely to Azure Arc over TCP port 44
## Additional network requirements
-In addition, Arc resource bridge (preview) requires connectivity to the [Arc-enabled Kubernetes endpoints](../network-requirements-consolidated.md?tabs=azure-cloud).
+In addition, Arc resource bridge requires connectivity to the [Arc-enabled Kubernetes endpoints](../network-requirements-consolidated.md?tabs=azure-cloud).
> [!NOTE] > The URLs listed here are required for Arc resource bridge only. Other Arc products (such as Arc-enabled VMware vSphere) may have additional required URLs. For details, see [Azure Arc network requirements](../network-requirements-consolidated.md).
The default value for `noProxy` is `localhost,127.0.0.1,.svc,10.0.0.0/8,172.16.0
## Next steps -- Review the [Azure Arc resource bridge (preview) overview](overview.md) to understand more about requirements and technical details.-- Learn about [security configuration and considerations for Azure Arc resource bridge (preview)](security-overview.md).
+- Review the [Azure Arc resource bridge overview](overview.md) to understand more about requirements and technical details.
+- Learn about [security configuration and considerations for Azure Arc resource bridge](security-overview.md).
- View [troubleshooting tips for networking issues](troubleshoot-resource-bridge.md#networking-issues).
azure-arc Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/overview.md
Title: Azure Arc resource bridge (preview) overview
-description: Learn how to use Azure Arc resource bridge (preview) to support VM self-servicing on Azure Stack HCI, VMware, and System Center Virtual Machine Manager.
Previously updated : 10/31/2023
+ Title: Azure Arc resource bridge overview
+description: Learn how to use Azure Arc resource bridge to support VM self-servicing on Azure Stack HCI, VMware, and System Center Virtual Machine Manager.
Last updated : 11/3/2023
-# What is Azure Arc resource bridge (preview)?
+# What is Azure Arc resource bridge?
-Azure Arc resource bridge (preview) is a Microsoft managed product that is part of the core Azure Arc platform. It is designed to host other Azure Arc services. In this release, the resource bridge supports VM self-servicing and management from Azure, for virtualized Windows and Linux virtual machines hosted in an on-premises environment on [Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview), VMware ([Arc-enabled VMware vSphere](../vmware-vsphere/index.yml) preview), and System Center Virtual Machine Manager (SCVMM) ([Arc-enabled SCVMM](../system-center-virtual-machine-manager/index.yml) preview).
+Azure Arc resource bridge is a Microsoft managed product that is part of the core Azure Arc platform. It is designed to host other Azure Arc services. In this release, the resource bridge supports VM self-servicing and management from Azure, for virtualized Windows and Linux virtual machines hosted in an on-premises environment on [Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview), VMware ([Arc-enabled VMware vSphere](../vmware-vsphere/index.yml)), and System Center Virtual Machine Manager (SCVMM) ([Arc-enabled SCVMM](../system-center-virtual-machine-manager/index.yml) preview).
Azure Arc resource bridge is a Kubernetes management cluster installed on the customerΓÇÖs on-premises infrastructure. The resource bridge is provided credentials to the infrastructure control plane that allows it to apply guest management services on the on-premises resources. Arc resource bridge enables projection of on-premises resources as ARM resources and management from ARM as ΓÇ£arc-enabledΓÇ¥ Azure resources.
Arc resource bridge delivers the following benefits:
## Overview
-Azure Arc resource bridge (preview) hosts other components such as [custom locations](..\platform\conceptual-custom-locations.md), cluster extensions, and other Azure Arc agents in order to deliver the level of functionality with the private cloud infrastructures it supports. This complex system is composed of three layers:
+Azure Arc resource bridge hosts other components such as [custom locations](..\platform\conceptual-custom-locations.md), cluster extensions, and other Azure Arc agents in order to deliver the level of functionality with the private cloud infrastructures it supports. This complex system is composed of three layers:
* The base layer that represents the resource bridge and the Arc agents. * The platform layer that includes the custom location and cluster extension.
Azure Arc resource bridge (preview) hosts other components such as [custom locat
:::image type="content" source="media/overview/architecture-overview.png" alt-text="Azure Arc resource bridge architecture diagram." border="false" lightbox="media/overview/architecture-overview.png":::
-Azure Arc resource bridge (preview) can host other Azure services or solutions running on-premises. For this preview, there are two objects hosted on the Arc resource bridge (preview):
+Azure Arc resource bridge can host other Azure services or solutions running on-premises. For this preview, there are two objects hosted on the Arc resource bridge:
* Cluster extension: The Azure service deployed to run on-premises. For the preview release, it supports three
Azure Arc resource bridge (preview) can host other Azure services or solutions r
* Custom locations: A deployment target where you can create Azure resources. It maps to different resource for different Azure services. For example, for Arc-enabled VMware, the custom locations resource maps to an instance of vCenter, and for Azure Arc VM management on Azure Stack HCI, it maps to an HCI cluster instance.
-Custom locations and cluster extension are both Azure resources, which are linked to the Azure Arc resource bridge (preview) resource in Azure Resource Manager. When you create an on-premises VM from Azure, you can select the custom location, and that routes that *create action* to the mapped vCenter, Azure Stack HCI cluster, or SCVMM.
+Custom locations and cluster extension are both Azure resources, which are linked to the Azure Arc resource bridge resource in Azure Resource Manager. When you create an on-premises VM from Azure, you can select the custom location, and that routes that *create action* to the mapped vCenter, Azure Stack HCI cluster, or SCVMM.
Some resources are unique to the infrastructure. For example, vCenter has a resource pool, network, and template resources. During VM creation, these resources need to be specified. With Azure Stack HCI, you just need to select the custom location, network and template to create a VM. To summarize, the Azure resources are projections of the resources running in your on-premises private cloud. If the on-premises resource is not healthy, it can impact the health of the related resources that are projected in Azure. For example, if the resource bridge is deleted by accident, all the resources projected in Azure by the resource bridge are impacted. The on-premises VMs in your on-premises private cloud are not impacted, as they are running on vCenter but you won't be able to start or stop the VMs from Azure. It is not recommended to directly manage or modify the resource bridge using any on-premises applications.
-## Benefits of Azure Arc resource bridge (preview)
+## Benefits of Azure Arc resource bridge
-Through Azure Arc resource bridge (preview), you can accomplish the following for each private cloud infrastructure from Azure:
+Through Azure Arc resource bridge, you can accomplish the following for each private cloud infrastructure from Azure:
### Azure Stack HCI
By registering resource pools, networks, and VM templates, you can represent a s
### System Center Virtual Machine Manager (SCVMM)
-You can connect an SCVMM management server to Azure by deploying Azure Arc resource bridgeΓÇ»(preview) in the VMM environment. Azure Arc resource bridge (preview) enables you to represent the SCVMM resources (clouds, VMs, templates etc.) in Azure and perform various operations on them:
+You can connect an SCVMM management server to Azure by deploying Azure Arc resource bridgeΓÇ»(preview) in the VMM environment. Azure Arc resource bridge enables you to represent the SCVMM resources (clouds, VMs, templates etc.) in Azure and perform various operations on them:
* Start, stop, and restart a virtual machine * Control access and add Azure tags
azure-arc Security Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/security-overview.md
Title: Azure Arc resource bridge (preview) security overview
-description: Security information about Azure resource bridge (preview).
+ Title: Azure Arc resource bridge security overview
+description: Understand security configuration and considerations for Azure Arc resource bridge.
Previously updated : 03/23/2023 Last updated : 11/03/2023
-# Azure Arc resource bridge (preview) security overview
+# Azure Arc resource bridge security overview
-This article describes the security configuration and considerations you should evaluate before deploying Azure Arc resource bridge (preview) in your enterprise.
+This article describes the security configuration and considerations you should evaluate before deploying Azure Arc resource bridge in your enterprise.
## Using a managed identity
-By default, a Microsoft Entra system-assigned [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) is created and assigned to the Azure Arc resource bridge (preview). Azure Arc resource bridge currently supports only a system-assigned identity. The `clusteridentityoperator` identity initiates the first outbound communication and fetches the Managed Service Identity (MSI) certificate used by other agents for communication with Azure.
+By default, a Microsoft Entra system-assigned [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) is created and assigned to the Azure Arc resource bridge. Azure Arc resource bridge currently supports only a system-assigned identity. The `clusteridentityoperator` identity initiates the first outbound communication and fetches the Managed Service Identity (MSI) certificate used by other agents for communication with Azure.
## Identity and access control
-Azure Arc resource bridge (preview) is represented as a resource in a resource group inside an Azure subscription. Access to this resource is controlled by standard [Azure role-based access control](../../role-based-access-control/overview.md). From the [**Access Control (IAM)**](../../role-based-access-control/role-assignments-portal.md) page in the Azure portal, you can verify who has access to your Azure Arc resource bridge (preview).
+Azure Arc resource bridge is represented as a resource in a resource group inside an Azure subscription. Access to this resource is controlled by standard [Azure role-based access control](../../role-based-access-control/overview.md). From the [**Access Control (IAM)**](../../role-based-access-control/role-assignments-portal.md) page in the Azure portal, you can verify who has access to your Azure Arc resource bridge.
Users and applications who are granted the [Contributor](../../role-based-access-control/built-in-roles.md#contributor) or Administrator role to the resource group can make changes to the resource bridge, including deploying or deleting cluster extensions.
The [activity log](../../azure-monitor/essentials/activity-log.md) is an Azure p
## Next steps -- Understand [system requirements](system-requirements.md) and [network requirements](network-requirements.md) for Azure Arc resource bridge (preview).-- Review the [Azure Arc resource bridge (preview) overview](overview.md) to understand more about features and benefits.
+- Understand [system requirements](system-requirements.md) and [network requirements](network-requirements.md) for Azure Arc resource bridge.
+- Review the [Azure Arc resource bridge overview](overview.md) to understand more about features and benefits.
- Learn more about [Azure Arc](../overview.md).
azure-arc System Requirements https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/system-requirements.md
Title: Azure Arc resource bridge (preview) system requirements
-description: Learn about system requirements for Azure Arc resource bridge (preview).
+ Title: Azure Arc resource bridge system requirements
+description: Learn about system requirements for Azure Arc resource bridge.
Previously updated : 06/15/2023 Last updated : 11/03/2023
-# Azure Arc resource bridge (preview) system requirements
+# Azure Arc resource bridge system requirements
-This article describes the system requirements for deploying Azure Arc resource bridge (preview).
+This article describes the system requirements for deploying Azure Arc resource bridge.
Arc resource bridge is used with other partner products, such as [Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview), [Arc-enabled VMware vSphere](../vmware-vsphere/index.yml), and [Arc-enabled System Center Virtual Machine Manager (SCVMM)](../system-center-virtual-machine-manager/index.yml). These products may have additional requirements.
Appliance VM IP address requirements:
- Open communication with the management machine and management endpoint (such as vCenter for VMware or MOC cloud agent service endpoint for Azure Stack HCI). - Internet connectivity to [required URLs](network-requirements.md#outbound-connectivity) enabled in proxy/firewall. - Static IP assigned (strongly recommended)
- - If using DHCP, then the address must be reserved and outside of the assignable DHCP range of IPs. No other machine on the network will use or receive this IP from DHCP. DHCP is generally not recommended because a change in IP address (ex: due to an outage) impacts the resource bridge availability.
+
+ - If using DHCP, then the address must be reserved and outside of the assignable DHCP range of IPs. No other machine on the network will use or receive this IP from DHCP. DHCP is generally not recommended because a change in IP address (ex: due to an outage) impacts the resource bridge availability.
- Must be from within the IP address prefix. - Internal and external DNS resolution.
Reserved appliance VM IP requirements:
- Static IP assigned (strongly recommended)
- - If using DHCP, then the address must be reserved and outside of the assignable DHCP range of IPs. No other machine on the network will use or receive this IP from DHCP. DHCP is generally not recommended because a change in IP address (ex: due to an outage) impacts the resource bridge availability.
+ - If using DHCP, then the address must be reserved and outside of the assignable DHCP range of IPs. No other machine on the network will use or receive this IP from DHCP. DHCP is generally not recommended because a change in IP address (ex: due to an outage) impacts the resource bridge availability.
- - Must be from within the IP address prefix.
+ - Must be from within the IP address prefix.
- - Internal and external DNS resolution.
+ - Internal and external DNS resolution.
- - If using a proxy, the proxy server has to be reachable from this IP and all IPs within the VM IP pool.
+ - If using a proxy, the proxy server has to be reachable from this IP and all IPs within the VM IP pool.
## Control plane IP requirements
For instructions to deploy Arc resource bridge on AKS Hybrid, see [How to instal
## Next steps -- Understand [network requirements for Azure Arc resource bridge (preview)](network-requirements.md).
+- Understand [network requirements for Azure Arc resource bridge](network-requirements.md).
-- Review the [Azure Arc resource bridge (preview) overview](overview.md) to understand more about features and benefits.
+- Review the [Azure Arc resource bridge overview](overview.md) to understand more about features and benefits.
-- Learn about [security configuration and considerations for Azure Arc resource bridge (preview)](security-overview.md).
+- Learn about [security configuration and considerations for Azure Arc resource bridge](security-overview.md).
azure-arc Troubleshoot Resource Bridge https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/troubleshoot-resource-bridge.md
Title: Troubleshoot Azure Arc resource bridge (preview) issues
-description: This article tells how to troubleshoot and resolve issues with the Azure Arc resource bridge (preview) when trying to deploy or connect to the service.
Previously updated : 03/15/2023
+ Title: Troubleshoot Azure Arc resource bridge issues
+description: This article tells how to troubleshoot and resolve issues with the Azure Arc resource bridge when trying to deploy or connect to the service.
Last updated : 11/03/2023
-# Troubleshoot Azure Arc resource bridge (preview) issues
+# Troubleshoot Azure Arc resource bridge issues
-This article provides information on troubleshooting and resolving issues that may occur while attempting to deploy, use, or remove the Azure Arc resource bridge (preview). The resource bridge is a packaged virtual machine, which hosts a *management* Kubernetes cluster. For general information, see [Azure Arc resource bridge (preview) overview](./overview.md).
+This article provides information on troubleshooting and resolving issues that could occur while attempting to deploy, use, or remove the Azure Arc resource bridge. The resource bridge is a packaged virtual machine, which hosts a *management* Kubernetes cluster. For general information, see [Azure Arc resource bridge overview](./overview.md).
## General issues
$HOME\.KVA\.ssh\logkey.pub
$HOME\.KVA\.ssh\logkey ```
-### Remote PowerShell is not supported
+### Remote PowerShell isn't supported
-If you run `az arcappliance` CLI commands for Arc Resource Bridge via remote PowerShell, you may experience various problems. For instance, you might see an [authentication handshake failure error when trying to install the resource bridge on an Azure Stack HCI cluster](#authentication-handshake-failure) or another type of error.
+If you run `az arcappliance` CLI commands for Arc Resource Bridge via remote PowerShell, you might experience various problems. For instance, you might see an [authentication handshake failure error when trying to install the resource bridge on an Azure Stack HCI cluster](#authentication-handshake-failure) or another type of error.
-Using `az arcappliance` commands from remote PowerShell is not currently supported. Instead, sign in to the node through Remote Desktop Protocol (RDP) or use a console session.
+Using `az arcappliance` commands from remote PowerShell isn't currently supported. Instead, sign in to the node through Remote Desktop Protocol (RDP) or use a console session.
### Resource bridge cannot be updated
To resolve this issue, delete the appliance and update the appliance YAML file.
### Connection closed before server preface received
-When there are multiple attempts to deploy Arc resource bridge, expired credentials left on the management machine may cause future deployments to fail. The error will contain the message `Unavailable desc = connection closed before server preface received`. This error will surface in various `az arcappliance` commands including `validate`, `prepare` and `delete`.
+When there are multiple attempts to deploy Arc resource bridge, expired credentials left on the management machine might cause future deployments to fail. The error will contain the message `Unavailable desc = connection closed before server preface received`. This error will surface in various `az arcappliance` commands including `validate`, `prepare` and `delete`.
-To resolve this error, the .wssd\python and .wssd\kva folders in the user profile directory need to be manually deleted from the management machine. Depending on where the deployment errored, there may not be a kva folder to delete. You can delete these folders manually by navigating to the user profile directory (typically `C:\Users\<username>`), then deleting the `.wssd\python` and `.wssd\kva` folders. After they are deleted, retry the command that failed.
+To resolve this error, the .wssd\python and .wssd\kva folders in the user profile directory need to be manually deleted from the management machine. Depending on where the deployment errored, there might not be a kva folder to delete. You can delete these folders manually by navigating to the user profile directory (typically `C:\Users\<username>`), then deleting the `.wssd\python` and `.wssd\kva` folders. After they are deleted, retry the command that failed.
### Token refresh error
-When you run the Azure CLI commands, the following error may be returned: *The refresh token has expired or is invalid due to sign-in frequency checks by conditional access.* The error occurs because when you sign in to Azure, the token has a maximum lifetime. When that lifetime is exceeded, you need to sign in to Azure again by using the `az login` command.
+When you run the Azure CLI commands, the following error might be returned: *The refresh token has expired or is invalid due to sign-in frequency checks by conditional access.* The error occurs because when you sign in to Azure, the token has a maximum lifetime. When that lifetime is exceeded, you need to sign in to Azure again by using the `az login` command.
### Default host resource pools are unavailable for deployment
When the appliance is deployed to a host resource pool, there is no high availab
### Resource bridge status "Offline" and `provisioningState` "Failed"
-When deploying Arc resource bridge, the bridge may appear to be successfully deployed, because no errors were encountered when running `az arcappliance deploy` or `az arcappliance create`. However, when viewing the bridge in Azure portal, you may see status shows as **Offline**, and `az arcappliance show` may show the `provisioningState` as **Failed**. This happens when required providers are not registered before the bridge is deployed.
+When deploying Arc resource bridge, the bridge might appear to be successfully deployed, because no errors were encountered when running `az arcappliance deploy` or `az arcappliance create`. However, when viewing the bridge in Azure portal, you might see status shows as **Offline**, and `az arcappliance show` might show the `provisioningState` as **Failed**. This happens when required providers aren't registered before the bridge is deployed.
To resolve this problem, delete the resource bridge, register the providers, then redeploy the resource bridge.
To resolve this problem, delete the resource bridge, register the providers, the
1. Redeploy the resource bridge. > [!NOTE]
-> Partner products (such as Arc-enabled VMware vSphere) may have their own required providers to register. To see additional providers that must be registered, see the product's documentation.
+> Partner products (such as Arc-enabled VMware vSphere) might have their own required providers to register. To see additional providers that must be registered, see the product's documentation.
### Expired credentials in the appliance VM
-Arc resource bridge consists of an appliance VM that is deployed to the on-premises infrastructure. The appliance VM maintains a connection to the management endpoint of the on-premises infrastructure using locally stored credentials. If these credentials are not updated, the resource bridge is no longer able to communicate with the management endpoint. This may cause problems when trying to upgrade the resource bridge or manage VMs through Azure.
+Arc resource bridge consists of an appliance VM that is deployed to the on-premises infrastructure. The appliance VM maintains a connection to the management endpoint of the on-premises infrastructure using locally stored credentials. If these credentials aren't updated, the resource bridge is no longer able to communicate with the management endpoint. This can cause problems when trying to upgrade the resource bridge or manage VMs through Azure.
To fix this, the credentials in the appliance VM need to be updated. For more information, see [Update credentials in the appliance VM](maintenance.md#update-credentials-in-the-appliance-vm). ---------- ## Networking issues ### Back-off pulling image error
-When trying to deploy Arc resource bridge, you may see an error that contains `back-off pulling image \\\"url"\\\: FailFastPodCondition`. This error is caused when the appliance VM can't reach the URL specified in the error. To resolve this issue, make sure the appliance VM meets system requirements, including internet access connectivity to [required allowlist URLs](network-requirements.md).
+When trying to deploy Arc resource bridge, you might see an error that contains `back-off pulling image \\\"url"\\\: FailFastPodCondition`. This error is caused when the appliance VM can't reach the URL specified in the error. To resolve this issue, make sure the appliance VM meets system requirements, including internet access connectivity to [required allowlist URLs](network-requirements.md).
### Not able to connect to URL
-If you receive an error that contains `Not able to connect to https://example.url.com`, check with your network administrator to ensure your network allows all of the required firewall and proxy URLs to deploy Arc resource bridge. For more information, see [Azure Arc resource bridge (preview) network requirements](network-requirements.md).
+If you receive an error that contains `Not able to connect to https://example.url.com`, check with your network administrator to ensure your network allows all of the required firewall and proxy URLs to deploy Arc resource bridge. For more information, see [Azure Arc resource bridge network requirements](network-requirements.md).
### .local not supported
-When trying to set the configuration for Arc resource bridge, you may receive an error message similar to:
+When trying to set the configuration for Arc resource bridge, you might receive an error message similar to:
`"message": "Post \"https://esx.lab.local/52b-bcbc707ce02c/disk-0.vmdk\": dial tcp: lookup esx.lab.local: no such host"`
This occurs when a `.local` path is provided for a configuration setting, such a
### Azure Arc resource bridge is unreachable
-Azure Arc resource bridge (preview) runs a Kubernetes cluster, and its control plane requires a static IP address. The IP address is specified in the `infra.yaml` file. If the IP address is assigned from a DHCP server, the address can change if not reserved. Rebooting the Azure Arc resource bridge (preview) or VM can trigger an IP address change, resulting in failing services.
+Azure Arc resource bridge runs a Kubernetes cluster, and its control plane requires a static IP address. The IP address is specified in the `infra.yaml` file. If the IP address is assigned from a DHCP server, the address can change if it's not reserved. Rebooting the Azure Arc resource bridge or VM can trigger an IP address change, resulting in failing services.
-Intermittently, the resource bridge (preview) can lose the reserved IP configuration. This is due to the behavior described in [loss of VIPs when systemd-networkd is restarted](https://github.com/acassen/keepalived/issues/1385). When the IP address isn't assigned to the Azure Arc resource bridge (preview) VM, any call to the resource bridge API server will fail. As a result, you can't create any new resource through the resource bridge (preview), ranging from connecting to Azure Arc private cloud, create a custom location, create a VM, etc.
+Intermittently, the resource bridge can lose the reserved IP configuration. This is due to the behavior described in [loss of VIPs when systemd-networkd is restarted](https://github.com/acassen/keepalived/issues/1385). When the IP address isn't assigned to the Azure Arc resource bridge VM, any call to the resource bridge API server will fail. As a result, you can't create any new resource through the resource bridge, ranging from connecting to Azure Arc private cloud, create a custom location, create a VM, etc.
Another possible cause is slow disk access. Azure Arc resource bridge uses etcd which requires 10 ms latency or less per [recommendation](https://docs.openshift.com/container-platform/4.6/scalability_and_performance/recommended-host-practices.html#recommended-etcd-practices_). If the underlying disk has low performance, it can impact the operations, and causing failures.
-To resolve this issue, reboot the resource bridge (preview) VM, and it should recover its IP address. If the address is assigned from a DHCP server, reserve the IP address associated with the resource bridge (preview).
+To resolve this issue, reboot the resource bridge VM, and it should recover its IP address. If the address is assigned from a DHCP server, reserve the IP address associated with the resource bridge.
### SSL proxy configuration issues
For more information, see [SSL proxy configuration](network-requirements.md#ssl-
### KVA timeout error
-While trying to deploy Arc Resource Bridge, a "KVA timeout error" may appear. The "KVA timeout error" is a generic error that can be the result of a variety of network misconfigurations that involve the management machine, Appliance VM, or Control Plane IP not having communication with each other, to the internet, or required URLs. This communication failure is often due to issues with DNS resolution, proxy settings, network configuration, or internet access.
+While trying to deploy Arc Resource Bridge, a "KVA timeout error" might appear. The "KVA timeout error" is a generic error that can be the result of a variety of network misconfigurations that involve the management machine, Appliance VM, or Control Plane IP not having communication with each other, to the internet, or required URLs. This communication failure is often due to issues with DNS resolution, proxy settings, network configuration, or internet access.
For clarity, "management machine" refers to the machine where deployment CLI commands are being run. "Appliance VM" is the VM that hosts Arc resource bridge. "Control Plane IP" is the IP of the control plane for the Kubernetes management cluster in the Appliance VM.
For clarity, "management machine" refers to the machine where deployment CLI com
- Management machine is unable to communicate with Control Plane IP and Appliance VM IP. - Appliance VM is unable to communicate with the management machine, vCenter endpoint (for VMware), or MOC cloud agent endpoint (for Azure Stack HCI).ΓÇ» -- Appliance VM does not have internet access.
+- Appliance VM doesn't have internet access.
- Appliance VM has internet access, but connectivity to one or more required URLs is being blocked, possibly due to a proxy or firewall. - Appliance VM is unable to reach a DNS server that can resolve internal names, such as vCenter endpoint for vSphere or cloud agent endpoint for Azure Stack HCI. The DNS server must also be able to resolve external addresses, such as Azure service addresses and container registry names.  - Proxy server configuration on the management machine or Arc resource bridge configuration files is incorrect. This can impact both the management machine and the Appliance VM. When the `az arcappliance prepare` command is run, the management machine won't be able to connect and download OS images if the host proxy isn't correctly configured. Internet access on the Appliance VM might be broken by incorrect or missing proxy configuration, which impacts the VM’s ability to pull container images.  #### Troubleshoot KVA timeout error
-To resolve the error, one or more network misconfigurations may need to be addressed. Follow the steps below to address the most common reasons for this error.
+To resolve the error, one or more network misconfigurations might need to be addressed. Follow the steps below to address the most common reasons for this error.
-1. When there is a problem with deployment, the first step is to collect logs by Appliance VM IP (not by kubeconfig, as the kubeconfig may be empty if deploy command did not complete). Problems collecting logs are most likely due to the management machine being unable to reach the Appliance VM.
+1. When there is a problem with deployment, the first step is to collect logs by Appliance VM IP (not by kubeconfig, as the kubeconfig could be empty if the deploy command didn't complete). Problems collecting logs are most likely due to the management machine being unable to reach the Appliance VM.
Once logs are collected, extract the folder and open kva.log. Review the kva.log for more information on the failure to help pinpoint the cause of the KVA timeout error. 1. The management machine must be able to communicate with the Appliance VM IP and Control Plane IP. Ping the Control Plane IP and Appliance VM IP from the management machine and verify there is a response from both IPs.
- If a request times out, the management machine is not able to communicate with the IP(s). This could be caused by a closed port, network misconfiguration or a firewall block. Work with your network administrator to allow communication between the management machine to the Control Plane IP and Appliance VM IP.
+ If a request times out, the management machine can't communicate with the IP(s). This could be caused by a closed port, network misconfiguration or a firewall block. Work with your network administrator to allow communication between the management machine to the Control Plane IP and Appliance VM IP.
-1. Appliance VM IP and Control Plane IP must be able to communicate with the management machine and vCenter endpoint (for VMware) or MOC cloud agent endpoint (for HCI). Work with your network administrator to ensure the network is configured to permit this. This may require adding a firewall rule to open port 443 from the Appliance VM IP and Control Plane IP to vCenter or port 65000 and 55000 for Azure Stack HCI MOC cloud agent. Review [network requirements for Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-prerequisites#network-port-requirements) and [VMware](../vmware-vsphere/quick-start-connect-vcenter-to-arc-using-script.md) for Arc resource bridge.
+1. Appliance VM IP and Control Plane IP must be able to communicate with the management machine and vCenter endpoint (for VMware) or MOC cloud agent endpoint (for HCI). Work with your network administrator to ensure the network is configured to permit this. This might require adding a firewall rule to open port 443 from the Appliance VM IP and Control Plane IP to vCenter or port 65000 and 55000 for Azure Stack HCI MOC cloud agent. Review [network requirements for Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-prerequisites#network-port-requirements) and [VMware](../vmware-vsphere/quick-start-connect-vcenter-to-arc-using-script.md) for Arc resource bridge.
1. Appliance VM IP and Control Plane IP need internet access to [these required URLs](#not-able-to-connect-to-url). Azure Stack HCI requires [additional URLs](/azure-stack/hci/manage/azure-arc-vm-management-prerequisites). Work with your network administrator to ensure that the IPs can access the required URLs.
To resolve the error, one or more network misconfigurations may need to be addre
Verify that the DNS server IP used to create the configuration files has internal and external address resolution. If not, [delete the appliance](/cli/azure/arcappliance/delete), recreate the Arc resource bridge configuration files with the correct DNS server settings, and then deploy Arc resource bridge using the new configuration files.
-## Move Arc resource bridge location
+## Move Arc resource bridge location
+ Resource move of Arc resource bridge isn't currently supported. You'll need to delete the Arc resource bridge, then re-deploy it to the desired location. ## Azure Arc-enabled VMs on Azure Stack HCI issues
For general help resolving issues related to Azure Arc-enabled VMs on Azure Stac
### Authentication handshake failure
-When running an `az arcappliance` command, you may see a connection error: `authentication handshake failed: x509: certificate signed by unknown authority`
+When running an `az arcappliance` command, you might see a connection error: `authentication handshake failed: x509: certificate signed by unknown authority`
-This is usually caused when trying to run commands from remote PowerShell, which is not supported by Azure Arc resource bridge.
+This is usually caused when trying to run commands from remote PowerShell, which isn't supported by Azure Arc resource bridge.
To install Azure Arc resource bridge on an Azure Stack HCI cluster, `az arcappliance` commands must be run locally on a node in the cluster. Sign in to the node through Remote Desktop Protocol (RDP) or use a console session to run these commands.
Error: Error in reading OVA file: failed to parse ovf: strconv.ParseInt: parsing
value out of range. ```
-This error occurs when you run the Azure CLI commands in a 32-bit context, which is the default behavior. The vSphere SDK only supports running in a 64-bit context. The specific error returned from the vSphere SDK is `Unable to import ova of size 6GB using govc`. To resolve the error, install and use Azure CLI 64-bit.
+This error occurs when you run the Azure CLI commands in a 32-bit context, which is the default behavior. The vSphere SDK only supports running in a 64-bit context. The specific error returned from the vSphere SDK is `Unable to import ova of size 6GB using govc`. To resolve the error, install and use Azure CLI 64-bit.
### Error during host configuration
-When you deploy the resource bridge on VMware vCenter, if you have been using the same template to deploy and delete the appliance multiple times, you may encounter the following error:
+When you deploy the resource bridge on VMware vCenter, if you have been using the same template to deploy and delete the appliance multiple times, you might encounter the following error:
`Appliance cluster deployment failed with error: Error: An error occurred during host configuration`
When deploying the resource bridge on VMware vCenter, you specify the folder in
### Insufficient permissions
-When deploying the resource bridge on VMware vCenter, you may get an error saying that you have insufficient permission. To resolve this issue, make sure that the user account being used to deploy the resource bridge has all of the following privileges in VMware vCenter and then try again.
-
+When deploying the resource bridge on VMware vCenter, you might get an error saying that you have insufficient permission. To resolve this issue, make sure that the user account being used to deploy the resource bridge has all of the following privileges in VMware vCenter and then try again.
**Datastore**  -- Allocate space 
+- Allocate space
-- Browse datastore 
+- Browse datastore
-- Low level file operations 
+- Low level file operations
**Folder**  -- Create folder
+- Create folder
-**vSphere Tagging** 
+**vSphere Tagging**
- Assign or Unassign vSphere Tag **Network**  -- Assign network 
+- Assign network
-**Resource** 
+**Resource**
-- Assign virtual machine to resource pool 
+- Assign virtual machine to resource pool
-- Migrate powered off virtual machine 
+- Migrate powered off virtual machine
-- Migrate powered on virtual machine 
+- Migrate powered on virtual machine
-**Sessions** 
+**Sessions**
-- Validate session 
+- Validate session
-**vApp** 
+**vApp**
-- Assign resource pool 
+- Assign resource pool
- Import 
-**Virtual machine** 
+**Virtual machine**
-- Change Configuration 
+- Change Configuration
- - Acquire disk lease 
+ - Acquire disk lease
- - Add existing disk 
+ - Add existing disk
- - Add new disk 
+ - Add new disk
- - Add or remove device 
+ - Add or remove device
- - Advanced configuration 
+ - Advanced configuration
- - Change CPU count 
+ - Change CPU count
- - Change Memory 
+ - Change Memory
- - Change Settings 
+ - Change Settings
- - Change resource 
+ - Change resource
- - Configure managedBy 
+ - Configure managedBy
- - Display connection settings 
+ - Display connection settings
- - Extend virtual disk 
+ - Extend virtual disk
- - Modify device settings 
+ - Modify device settings
- - Query Fault Tolerance compatibility 
+ - Query Fault Tolerance compatibility
- - Query unowned files 
+ - Query unowned files
- - Reload from path 
+ - Reload from path
- - Remove disk 
+ - Remove disk
- - Rename 
+ - Rename
- - Reset guest information 
+ - Reset guest information
- - Set annotation 
+ - Set annotation
- - Toggle disk change tracking 
+ - Toggle disk change tracking
- - Toggle fork parent 
+ - Toggle fork parent
- - Upgrade virtual machine compatibility 
+ - Upgrade virtual machine compatibility
-- Edit Inventory 
+- Edit Inventory
- - Create from existing 
+ - Create from existing
- - Create new 
+ - Create new
- - Register 
+ - Register
- - Remove 
+ - Remove
- - Unregister 
+ - Unregister
-- Guest operations 
+- Guest operations
- - Guest operation alias modification 
+ - Guest operation alias modification
- - Guest operation modifications 
+ - Guest operation modifications
- - Guest operation program execution 
+ - Guest operation program execution
- - Guest operation queries 
+ - Guest operation queries
-- Interaction 
+- Interaction
- - Connect devices 
+ - Connect devices
- - Console interaction 
+ - Console interaction
- - Guest operating system management by VIX API 
+ - Guest operating system management by VIX API
- - Install VMware Tools 
+ - Install VMware Tools
- - Power off 
+ - Power off
- - Power on 
+ - Power on
- - Reset 
+ - Reset
- - Suspend 
+ - Suspend
-- Provisioning 
+- Provisioning
- - Allow disk access 
+ - Allow disk access
- - Allow file access 
+ - Allow file access
- - Allow read-only disk access 
+ - Allow read-only disk access
- - Allow virtual machine download 
+ - Allow virtual machine download
- - Allow virtual machine files upload 
+ - Allow virtual machine files upload
- - Clone virtual machine 
+ - Clone virtual machine
- - Deploy template 
+ - Deploy template
- - Mark as template 
+ - Mark as template
- - Mark as virtual machine 
+ - Mark as virtual machine
-- Snapshot management 
+- Snapshot management
- - Create snapshot 
+ - Create snapshot
- - Remove snapshot 
+ - Remove snapshot
- - Revert to snapshot 
+ - Revert to snapshot
## Next steps
When deploying the resource bridge on VMware vCenter, you may get an error sayin
If you don't see your problem here or you can't resolve your issue, try one of the following channels for support: - Get answers from Azure experts through [Microsoft Q&A](/answers/topics/azure-arc.html).- - Connect with [@AzureSupport](https://twitter.com/azuresupport), the official Microsoft Azure account for improving customer experience. Azure Support connects the Azure community to answers, support, and experts.- - [Open an Azure support request](../../azure-portal/supportability/how-to-create-azure-support-request.md). -
azure-arc Upgrade https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/resource-bridge/upgrade.md
Title: Upgrade Arc resource bridge (preview)
-description: Learn how to upgrade Arc resource bridge (preview) using either cloud-managed upgrade or manual upgrade.
Previously updated : 10/20/2023
+ Title: Upgrade Arc resource bridge
+description: Learn how to upgrade Arc resource bridge using either cloud-managed upgrade or manual upgrade.
Last updated : 11/03/2023
-# Upgrade Arc resource bridge (preview)
+# Upgrade Arc resource bridge
-This article describes how Arc resource bridge (preview) is upgraded, and the two ways upgrade can be performed: cloud-managed upgrade or manual upgrade. Currently, some private cloud providers differ in how they handle Arc resource bridge upgrades. For more information, see the [Private cloud providers](#private-cloud-providers) section.
+This article describes how Arc resource bridge is upgraded, and the two ways upgrade can be performed: cloud-managed upgrade or manual upgrade. Currently, some private cloud providers differ in how they handle Arc resource bridge upgrades. For more information, see the [Private cloud providers](#private-cloud-providers) section.
## Prerequisites
Or to upgrade a resource bridge on Azure Stack HCI, run: `az arcappliance upgrad
Currently, private cloud providers differ in how they perform Arc resource bridge upgrades. Review the following information to see how to upgrade your Arc resource bridge for a specific provider.
-For Arc-enabled VMware vSphere (preview), manual upgrade is available, and cloud-managed upgrade is supported for appliances on version 1.0.15 and higher. When Arc-enabled VMware vSphere announces General Availability, appliances on version 1.0.15 and higher will receive cloud-managed upgrade as the default experience. Appliances that are below version 1.0.15 must be manually upgraded. A manual upgrade only upgrades the appliance to the next version, not the latest version. If you have multiple versions to upgrade, then another option is to review the steps for [performing a recovery](/azure/azure-arc/vmware-vsphere/recover-from-resource-bridge-deletion), then delete the appliance VM and perform the recovery steps. This will deploy a new Arc resource bridge using the latest version and reconnect pre-existing Azure resources.
+For Arc-enabled VMware vSphere, manual upgrade is available, but appliances on version 1.0.15 and higher will receive cloud-managed upgrade as the default experience. Appliances that are below version 1.0.15 must be manually upgraded. A manual upgrade only upgrades the appliance to the next version, not the latest version. If you have multiple versions to upgrade, then another option is to review the steps for [performing a recovery](/azure/azure-arc/vmware-vsphere/recover-from-resource-bridge-deletion), then delete the appliance VM and perform the recovery steps. This will deploy a new Arc resource bridge using the latest version and reconnect pre-existing Azure resources.
-[Azure Arc VM management (preview) on Azure Stack HCI](/azure-stack/hci/manage/azure-arc-vm-management-overview) supports upgrade of an Arc resource bridge on Azure Stack HCI, version 22H2 up until appliance version 1.0.14 and `az arcappliance` CLI extension version 0.2.33. These upgrades can be done through manual upgrade or a support request for cloud-managed upgrade. For subsequent upgrades, you must transition to Azure Stack HCI, version 23H2 (preview). In version 23H2 (preview), the LCM tool manages upgrades across all components as a "validated recipe" package. For more information, visit the [Arc VM management FAQ page](/azure-stack/hci/manage/azure-arc-vms-faq).
+Azure Arc VM management (preview) on Azure Stack HCI supports upgrade of an Arc resource bridge on Azure Stack HCI, version 22H2 up until appliance version 1.0.14 and `az arcappliance` CLI extension version 0.2.33. These upgrades can be done through manual upgrade. For subsequent upgrades, you must transition to Azure Stack HCI, version 23H2 (preview). In version 23H2 (preview), the LCM tool manages upgrades across all components as a "validated recipe" package. For more information, visit the [Arc VM management FAQ page](/azure-stack/hci/manage/azure-arc-vms-faq).
For Arc-enabled System Center Virtual Machine Manager (SCVMM) (preview), the upgrade feature isn't currently available yet. Review the steps for [performing the recovery operation](/azure/azure-arc/system-center-virtual-machine-manager/disaster-recovery), then delete the appliance VM from SCVMM and perform the recovery steps. This deploys a new resource bridge and reconnects pre-existing Azure resources.-
+
## Version releases The Arc resource bridge version is tied to the versions of underlying components used in the appliance image, such as the Kubernetes version. When there is a change in the appliance image, the Arc resource bridge version gets incremented. This generally happens when a new `az arcappliance` CLI extension version is released. A new extension is typically released on a monthly cadence at the end of the month. For detailed release info, see the [Arc resource bridge release notes](https://github.com/Azure/ArcResourceBridge/releases) on GitHub.
azure-arc Agent Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/servers/agent-overview.md
The Azure Connected Machine agent is designed to manage agent and system resourc
| MDE.Linux | Linux | 60% | | MicrosoftDnsAgent | Windows | 100% | | MicrosoftMonitoringAgent | Windows | 60% |
- | OmsAgentForLinux | Windows | 60%|
+ | OmsAgentForLinux | Linux | 60%|
During normal operations, defined as the Azure Connected Machine agent being connected to Azure and not actively modifying an extension or evaluating a policy, you can expect the agent to consume the following system resources:
azure-arc Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/servers/policy-reference.md
Title: Built-in policy definitions for Azure Arc-enabled servers description: Lists Azure Policy built-in policy definitions for Azure Arc-enabled servers (preview). These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-arc Troubleshoot Agent Onboard https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-arc/servers/troubleshoot-agent-onboard.md
# Troubleshoot Azure Connected Machine agent connection issues
-This article provides information for troubleshooting issues that may occur configuring the Azure Connected Machine agent for Windows or Linux. Both the interactive and at-scale installation methods when configuring connection to the service are included. For general information, see [Azure Arc-enabled servers overview](./overview.md).
+This article provides information for troubleshooting issues that might occur while configuring the Azure Connected Machine agent for Windows or Linux. Both the interactive and at-scale installation methods when configuring connection to the service are included. For general information, see [Azure Arc-enabled servers overview](./overview.md).
## Agent error codes
-Use the following table to identify and resolve issues when configuring the Azure Connected Machine agent. You'll need the `AZCM0000` ("0000" can be any four digit number) error code printed to the console or script output.
+Use the following table to identify and resolve issues when configuring the Azure Connected Machine agent using the `AZCM0000` ("0000" can be any four digit number) error code printed to the console or script output.
| Error code | Probable cause | Suggested remediation | ||-|--|
Use the following table to identify and resolve issues when configuring the Azur
| AZCM0018 | The command was executed without administrative privileges | Retry the command in an elevated user context (administrator/root). | | AZCM0019 | The path to the configuration file is incorrect | Ensure the path to the configuration file is correct and try again. | | AZCM0023 | The value provided for a parameter (argument) is invalid | Review the error message for more specific information. Refer to the syntax of the command (`azcmagent <command> --help`) for valid values or expected format for the arguments. |
-| AZCM0026 | There is an error in network configuration or some critical services are temporarily unavailable | Check if the required endpoints are reachable (for example, hostnames are resolvable, endpoints aren't blocked). If the network is configured for Private Link Scope, a Private Link Scope resource ID must be provided for onboarding using the `--private-link-scope` parameter. |
-| AZCM0041 | The credentials supplied are invalid | For device logins, verify that the user account specified has access to the tenant and subscription where the server resource will be created<sup>[1](#footnote3)</sup>.<br> For service principal logins, check the client ID and secret for correctness, the expiration date of the secret<sup>[2](#footnote4)</sup>, and that the service principal is from the same tenant where the server resource will be created<sup>[1](#footnote3)</sup>.<br> <a name="footnote3"></a><sup>1</sup>See [How to find your Microsoft Entra tenant ID](/azure/active-directory-b2c/tenant-management-read-tenant-name).<br> <a name="footnote4"></a><sup>2</sup>In Azure portal, open Microsoft Entra ID and select the App registration blade. Select the application to be used and the Certificates and secrets within it. Check whether the expiration data has passed. If it has, create new credentials with sufficient roles and try again. See [Connected Machine agent prerequisites-required permissions](prerequisites.md#required-permissions). |
-| AZCM0042 | Creation of the Azure Arc-enabled server resource failed | Review the error message in the output to identify the cause of the failure to create resource and the suggested remediation. For permission issues, see [Connected Machine agent prerequisites-required permissions](prerequisites.md#required-permissions) for more information. |
-| AZCM0043 | Deletion of the Azure Arc-enabled server resource failed | Verify that the user/service principal specified has permissions to delete Azure Arc-enabled server/resources in the specified group ΓÇö see [Connected Machine agent prerequisites-required permissions](prerequisites.md#required-permissions).<br> If the resource no longer exists in Azure, use the `--force-local-only` flag to proceed. |
+| AZCM0026 | There's an error in network configuration or some critical services are temporarily unavailable | Check if the required endpoints are reachable (for example, hostnames are resolvable, endpoints aren't blocked). If the network is configured for Private Link Scope, a Private Link Scope resource ID must be provided for onboarding using the `--private-link-scope` parameter. |
+| AZCM0041 | The credentials supplied are invalid | For device logins, verify that the user account specified has access to the tenant and subscription where the server resource will be created. For service principal logins, check the client ID and secret for correctness, the expiration date of the secret, and that the service principal is from the same tenant where the server resource will be created. |
+| AZCM0042 | Creation of the Azure Arc-enabled server resource failed | Review the error message in the output to identify the cause of the failure to create resource and the suggested remediation. For more information, see [Connected Machine agent prerequisites-required permissions](prerequisites.md#required-permissions) for more information. |
+| AZCM0043 | Deletion of the Azure Arc-enabled server resource failed | Verify that the user/service principal specified has permissions to delete Azure Arc-enabled server/resources in the specified group. For more information, see [Connected Machine agent prerequisites-required permissions](prerequisites.md#required-permissions). If the resource no longer exists in Azure, use the `--force-local-only` flag to proceed. |
| AZCM0044 | A resource with the same name already exists | Specify a different name for the `--resource-name` parameter or delete the existing Azure Arc-enabled server in Azure and try again. | | AZCM0062 | An error occurred while connecting the server | Review the error message in the output for more specific information. If the error occurred after the Azure resource was created, delete this resource before retrying. | | AZCM0063 | An error occurred while disconnecting the server | Review the error message in the output for more specific information. If this error persists, delete the resource in Azure, and then run `azcmagent disconnect --force-local-only` on the server. |
Use the following table to identify and resolve issues when configuring the Azur
| AZCM0105 | An error occurred while downloading the Microsoft Entra ID managed identify certificate | Delete the resource created in Azure and try again. | | AZCM0147-<br>AZCM0152 | An error occurred while installing Azcmagent on Windows | Review the error message in the output for more specific information. | | AZCM0127-<br>AZCM0146 | An error occurred while installing Azcmagent on Linux | Review the error message in the output for more specific information. |
+| AZCM0150 | Generic failure during installation | Submit a support ticket to get assistance. |
+| AZCM0153 | The system platform isn't supported | Review the [prerequisites](prerequisites.md) for supported platforms |
+| AZCM0154 | The version of PowerShell installed on the system is too old | Upgrade to PowerShell 4 or later and try again. |
+| AZCM0155 | The user running the installation script doesn't have administrator permissions | Re-run the script as an administrator. |
+| AZCM0156 | Installation of the agent failed | Confirm that the machine isn't running on Azure. Detailed errors might be found in the installation log at `%TEMP%\installationlog.txt`. |
+| AZCM0157 | Unable to download repo metadata for the Microsoft Linux software repository | Check if a firewall is blocking access to `packages.microsoft.com` and try again. |
## Agent verbose log
The following table lists some of the known errors and suggestions on how to tro
|Message |Error |Probable cause |Solution | |--||||
-|Failed to acquire authorization token device flow |`Error occurred while sending request for Device Authorization Code: Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/devicecode?api-version=1.0: dial tcp 40.126.9.7:443: connect: network is unreachable.` |Cannot reach `login.windows.net` endpoint | Verify connectivity to the endpoint. |
-|Failed to acquire authorization token device flow |`Error occurred while sending request for Device Authorization Code: Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/devicecode?api-version=1.0: dial tcp 40.126.9.7:443: connect: network is Forbidden`. |Proxy or firewall is blocking access to `login.windows.net` endpoint. | Verify connectivity to the endpoint and it is not blocked by a firewall or proxy server. |
+|Failed to acquire authorization token device flow |`Error occurred while sending request for Device Authorization Code: Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/devicecode?api-version=1.0: dial tcp 40.126.9.7:443: connect: network is unreachable.` |Can't reach `login.windows.net` endpoint | Run [azcmagent check](azcmagent-check.md) to see if a firewall is blocking access to Microsoft Entra ID. |
+|Failed to acquire authorization token device flow |`Error occurred while sending request for Device Authorization Code: Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/devicecode?api-version=1.0: dial tcp 40.126.9.7:443: connect: network is Forbidden`. |Proxy or firewall is blocking access to `login.windows.net` endpoint. | Run [azcmagent check](azcmagent-check.md) to see if a firewall is blocking access to Microsoft Entra ID.|
|Failed to acquire authorization token device flow |`Error occurred while sending request for Device Authorization Code: Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/devicecode?api-version=1.0: dial tcp lookup login.windows.net: no such host`. | Group Policy Object *Computer Configuration\ Administrative Templates\ System\ User Profiles\ Delete user profiles older than a specified number of days on system restart* is enabled. | Verify the GPO is enabled and targeting the affected machine. See footnote <sup>[1](#footnote1)</sup> for further details. |
-|Failed to acquire authorization token from SPN |`Failed to execute the refresh request. Error = 'Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/token?api-version=1.0: Forbidden'` |Proxy or firewall is blocking access to `login.windows.net` endpoint. |Verify connectivity to the endpoint and it is not blocked by a firewall or proxy server. |
+|Failed to acquire authorization token from SPN |`Failed to execute the refresh request. Error = 'Post https://login.windows.net/fb84ce97-b875-4d12-b031-ef5e7edf9c8e/oauth2/token?api-version=1.0: Forbidden'` |Proxy or firewall is blocking access to `login.windows.net` endpoint. |Run [azcmagent check](azcmagent-check.md) to see if a firewall is blocking access to Microsoft Entra ID. |
|Failed to acquire authorization token from SPN |`Invalid client secret is provided` |Wrong or invalid service principal secret. |Verify the service principal secret. |
-| Failed to acquire authorization token from SPN |`Application with identifier 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' was not found in the directory 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant` |Incorrect service principal and/or Tenant ID. |Verify the service principal and/or the tenant ID.|
+| Failed to acquire authorization token from SPN |`Application with identifier 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' wasn't found in the directory 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant` |Incorrect service principal and/or Tenant ID. |Verify the service principal and/or the tenant ID.|
|Get ARM Resource Response |`The client 'username@domain.com' with object id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' does not have authorization to perform action 'Microsoft.HybridCompute/machines/read' over scope '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/MSJC01' or the scope is invalid. If access was recently granted, please refresh your credentials."}}" Status Code=403` |Wrong credentials and/or permissions |Verify you or the service principal is a member of the **Azure Connected Machine Onboarding** role. |
-|Failed to AzcmagentConnect ARM resource |`The subscription is not registered to use namespace 'Microsoft.HybridCompute'` |Azure resource providers are not registered. |Register the [resource providers](prerequisites.md#azure-resource-providers). |
-|Failed to AzcmagentConnect ARM resource |`Get https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/MSJC01?api-version=2019-03-18-preview: Forbidden` |Proxy server or firewall is blocking access to `management.azure.com` endpoint. |Verify connectivity to the endpoint and it is not blocked by a firewall or proxy server. |
+|Failed to AzcmagentConnect ARM resource |`The subscription isn't registered to use namespace 'Microsoft.HybridCompute'` |Azure resource providers aren't registered. |Register the [resource providers](prerequisites.md#azure-resource-providers). |
+|Failed to AzcmagentConnect ARM resource |`Get https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/MSJC01?api-version=2019-03-18-preview: Forbidden` |Proxy server or firewall is blocking access to `management.azure.com` endpoint. | Run [azcmagent check](azcmagent-check.md) to see if a firewall is blocking access to Azure Resource Manager. |
<a name="footnote1"></a><sup>1</sup>If this GPO is enabled and applies to machines with the Connected Machine agent, it deletes the user profile associated with the built-in account specified for the *himds* service. As a result, it also deletes the authentication certificate used to communicate with the service that is cached in the local certificate store for 30 days. Before the 30-day limit, an attempt is made to renew the certificate. To resolve this issue, follow the steps to [disconnect the agent](azcmagent-disconnect.md) and then re-register it with the service running `azcmagent connect`. ## Next steps
-If you don't see your problem here or you can't resolve your issue, try one of the following channels for additional support:
+If you don't see your problem here or you can't resolve your issue, try one of the following channels for more support:
* Get answers from Azure experts through [Microsoft Q&A](/answers/topics/azure-arc.html).
azure-cache-for-redis Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-cache-for-redis/policy-reference.md
Title: Built-in policy definitions for Azure Cache for Redis description: Lists Azure Policy built-in policy definitions for Azure Cache for Redis. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-functions Durable Functions Timers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-functions/durable/durable-functions-timers.md
When you create a timer that expires at 4:30 pm UTC, the underlying Durable Task
> [!NOTE] > * For JavaScript, Python, and PowerShell apps, Durable timers are limited to six days. To work around this limitation, you can use the timer APIs in a `while` loop to simulate a longer delay. Up-to-date .NET and Java apps support arbitrarily long timers.
-> * Depending on the version of the SDK and [storage provider](durable-functions-storage-providers.md) being used, long timers of 6 days or more may be internally implemented using a series of shorter timers (e.g., of 3 day durations) until the desired expiration time is reached. This can be observed in the underlying data store but won't impact the the orchestration behavior.
+> * Depending on the version of the SDK and [storage provider](durable-functions-storage-providers.md) being used, long timers of 6 days or more may be internally implemented using a series of shorter timers (e.g., of 3 day durations) until the desired expiration time is reached. This can be observed in the underlying data store but won't impact the orchestration behavior.
> * Don't use built-in date/time APIs for getting the current time. When calculating a future date for a timer to expire, always use the orchestrator function's current time API. For more information, see the [orchestrator function code constraints](durable-functions-code-constraints.md#dates-and-times) article. ## Usage for delay
azure-functions Functions Bindings Event Hubs Output https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-functions/functions-bindings-event-hubs-output.md
public static async Task Run(
string newEventBody = DoSomething(eventData); // Queue the message to be sent in the background by adding it to the collector.
- // If only the event is passed, an Event Hubs partition to be be assigned via
+ // If only the event is passed, an Event Hubs partition to be assigned via
// round-robin for each batch. await outputEvents.AddAsync(new EventData(newEventBody));
azure-functions Functions Run Local https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-functions/functions-run-local.md
In the terminal window or from a command prompt, run the following command to cr
func init MyProjFolder --worker-runtime dotnet-isolated ```
-By default this command creates a project that runs in-process with the Functons host on the current [Long-Term Support (LTS) version of .NET Core]. You can use the `--target-framework` option to target a specific supported version of .NET, including .NET Framework. For for information, see the [`func init`](functions-core-tools-reference.md#func-init) reference.
+By default this command creates a project that runs in-process with the Functons host on the current [Long-Term Support (LTS) version of .NET Core]. You can use the `--target-framework` option to target a specific supported version of .NET, including .NET Framework. For more information, see the [`func init`](functions-core-tools-reference.md#func-init) reference.
### [In-process](#tab/in-process)
azure-government Documentation Government How To Access Enterprise Agreement Billing Account https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-government/documentation-government-how-to-access-enterprise-agreement-billing-account.md
documentationcenter: ''
-+ na Previously updated : 05/08/2023 Last updated : 11/03/2023 # Access your EA billing account in the Azure Government portal
Last updated 05/08/2023
As an Azure Government Enterprise Agreement (EA) customer, you can now manage your EA billing account directly from [Azure Government portal](https://portal.azure.us/). This article helps you to get started with your billing account on the Azure Government portal. > [!NOTE]
-> The Azure Enterprise (EA) portal is getting retired. We recommend that both direct and indirect EA Azure Government customers use Cost Management + Billing in the Azure Government portal to manage their enrollment and billing instead of using the EA portal.
+> On November 15, 2023, the Azure Enterprise portal is retiring for EA enrollments in the Commercial cloud and is becoming read-only for EA enrollments in the Azure Government cloud.
+> Customers and Partners should use Cost Management + Billing in the Azure portal to manage their enrollments. For more information about enrollment management in the Azure portal, see [Get started with EA billing in the Azure portal](../cost-management-billing/manage/ea-direct-portal-get-started.md).
## Access the Azure Government portal
azure-maps Drawing Error Visualizer https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/drawing-error-visualizer.md
This tutorial uses the [Postman] application, but you can choose a different API
1. Follow the steps outlined in the [How to create data registry] article to upload the drawing package into your Azure storage account then register it in your Azure Maps account. > [!IMPORTANT]
- > Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the drawing package you uploaded into your Azure storage account from your source code and HTTP requests.
+ > Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the drawing package you uploaded into your Azure storage account from your source code and HTTP requests.
2. Now that the drawing package is uploaded, use `udid` for the uploaded package to convert the package into map data. For steps on how to convert a package, see [Convert a drawing package].
azure-maps How To Dataset Geojson https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/how-to-dataset-geojson.md
For more information on the GeoJSON package, see the [Geojson zip package requir
Follow the steps outlined in the [How to create data registry] article to upload the GeoJSON package into your Azure storage account then register it in your Azure Maps account. > [!IMPORTANT]
-> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the GeoJSON package you uploaded into your Azure storage account from your source code and HTTP requests.
+> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the GeoJSON package you uploaded into your Azure storage account from your source code and HTTP requests.
### Create a dataset
azure-maps Power Bi Visual Add Bubble Layer https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/power-bi-visual-add-bubble-layer.md
Initially all bubbles have the same fill color. If a field is passed into the **
> > **Bubble size scaling retirement** >
-> The Power BI Visual bubble layer **Bubble size scaling** settings were deprecated starting in the September 2023 release of Power BI. You can no longer create reports using these settings, but existing reports will continue to work. It is recomended that you upgrade existing reports that use these settings to the new **range scaling** property. To upgrade to to the new **range scaling** property, select the desired option in the **Range scaling** drop-down list:
+> The Power BI Visual bubble layer **Bubble size scaling** settings were deprecated starting in the September 2023 release of Power BI. You can no longer create reports using these settings, but existing reports will continue to work. It is recomended that you upgrade existing reports that use these settings to the new **range scaling** property. To upgrade to the new **range scaling** property, select the desired option in the **Range scaling** drop-down list:
> > :::image type="content" source="./media/power-bi-visual/range-scaling-drop-down.png" alt-text="A screenshot of the range scaling drop-down"::: >
azure-maps Release Notes Drawing Tools Module https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/release-notes-drawing-tools-module.md
+
+ Title: Release notes - Drawing Tools Module
+
+description: Release notes for the Azure Maps Drawing Tools Module.
++ Last updated : 10/25/2023+++++
+# Drawing Tools Module release notes
+
+This document contains information about new features and other changes to the Azure Maps Drawing Tools Module.
+
+## [1.0.2]
+
+### Bug fixes (1.0.2)
+
+- Resolved various errors in the type declaration file.
+
+- Fixed typing incompatibility with MapControl v3.
+
+## Next steps
+
+Explore samples showcasing Azure Maps:
+
+> [!div class="nextstepaction"]
+> [Azure Maps Drawing Tools Samples]
+
+Stay up to date on Azure Maps:
+
+> [!div class="nextstepaction"]
+> [Azure Maps Blog]
++
+[1.0.2]: https://www.npmjs.com/package/azure-maps-drawing-tools/v/1.0.2
+[Azure Maps Drawing Tools Samples]: https://samples.azuremaps.com/?search=Drawing
+[Azure Maps Blog]: https://techcommunity.microsoft.com/t5/azure-maps-blog/bg-p/AzureMapsBlog
azure-maps Release Notes Indoor Module https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/release-notes-indoor-module.md
This document contains information about new features and other changes to the Azure Maps Indoor Module.
+## [0.2.3]
+
+### Changes (0.2.3)
+
+- Improve rendering performance by reading facility-level data from the style metadata when available.
+ ## [0.2.2] ### Changes (0.2.2)
Stay up to date on Azure Maps:
> [Azure Maps Blog] [drawing package 2.0]: ./drawing-package-guide.md
+[0.2.3]: https://www.npmjs.com/package/azure-maps-indoor/v/0.2.3
[0.2.2]: https://www.npmjs.com/package/azure-maps-indoor/v/0.2.2 [0.2.1]: https://www.npmjs.com/package/azure-maps-indoor/v/0.2.1 [0.2.0]: https://www.npmjs.com/package/azure-maps-indoor/v/0.2.0
azure-maps Release Notes Map Control https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/release-notes-map-control.md
This document contains information about new features and other changes to the M
## v3 (latest)
+### [3.0.2] (November 1, 2023)
+
+#### Bug fixes (3.0.2)
+
+- Addressed several errors in the type declaration file and added a dependency for `@maplibre/maplibre-gl-style-spec`.
+
+#### Other changes (3.0.2)
+
+- Removed Authorization headers from style, thumbnail, sprite, and glyph requests to enhance CDN caching for static assets.
+
+- Updated the documentation for `map.clear()` and `layers.clear()`.
+ ### [3.0.1] (October 6, 2023) #### Bug fixes (3.0.1)
The preview is available on [npm][3.0.0-preview.10] and CDN.
#### Bug fixes (3.0.0-preview.9) -- Fixed an issue where accessibility-related duplicated DOM elements may result when `map.setServiceOptions` is called
+- Fixed an issue where accessibility-related duplicated DOM elements might result when `map.setServiceOptions` is called
#### Installation (3.0.0-preview.9)- The preview is available on [npm][3.0.0-preview.9] and CDN. - **NPM:** Refer to the instructions at [azure-maps-control@3.0.0-preview.9][3.0.0-preview.9]
The preview is available on [npm][3.0.0-preview.3] and CDN.
#### New features (3.0.0-preview.3) - **\[BREAKING\]** Migrated from [adal-angular] to [@azure/msal-browser] used for authentication with Microsoft Azure Active Directory ([Azure AD]).
- Changes that may be required:
+ Changes that might be required:
- `Platform / Reply URL` Type must be set to `Single-page application` on Azure AD App Registration portal. - Code change is required if a custom `authOptions.authContext` is used. - For more information, see [How to migrate a JavaScript app from ADAL.js to MSAL.js][migration guide].
This update is the first preview of the upcoming 3.0.0 release. The underlying [
## v2
+### [2.3.4] (November 1, 2023)
+
+#### Other changes (2.3.4)
+
+- Removed Authorization headers from style, thumbnail, sprite, and glyph requests to enhance CDN caching for static assets.
+
+- Updated the documentation for `map.clear()` and `layers.clear()`.
+ ### [2.3.3] (October 6, 2023) #### Bug fixes (2.3.3)
This update is the first preview of the upcoming 3.0.0 release. The underlying [
#### Bug fixes (2.3.2) -- Fixed an issue where accessibility-related duplicated DOM elements may result when `map.setServiceOptions` is called.
+- Fixed an issue where accessibility-related duplicated DOM elements might result when `map.setServiceOptions` is called.
- Fixed zoom control to take into account the `maxBounds` [CameraOptions].
This update is the first preview of the upcoming 3.0.0 release. The underlying [
#### Bug fixes (2.3.1) -- Fix `ImageSpriteManager` icon images may get removed during style change
+- Fix `ImageSpriteManager` icon images might get removed during style change
#### Other changes (2.3.1)
Stay up to date on Azure Maps:
> [!div class="nextstepaction"] > [Azure Maps Blog]
+[3.0.2]: https://www.npmjs.com/package/azure-maps-control/v/3.0.2
[3.0.1]: https://www.npmjs.com/package/azure-maps-control/v/3.0.1 [3.0.0]: https://www.npmjs.com/package/azure-maps-control/v/3.0.0 [3.0.0-preview.10]: https://www.npmjs.com/package/azure-maps-control/v/3.0.0-preview.10
Stay up to date on Azure Maps:
[3.0.0-preview.3]: https://www.npmjs.com/package/azure-maps-control/v/3.0.0-preview.3 [3.0.0-preview.2]: https://www.npmjs.com/package/azure-maps-control/v/3.0.0-preview.2 [3.0.0-preview.1]: https://www.npmjs.com/package/azure-maps-control/v/3.0.0-preview.1
+[2.3.4]: https://www.npmjs.com/package/azure-maps-control/v/2.3.4
[2.3.3]: https://www.npmjs.com/package/azure-maps-control/v/2.3.3 [2.3.2]: https://www.npmjs.com/package/azure-maps-control/v/2.3.2 [2.3.1]: https://www.npmjs.com/package/azure-maps-control/v/2.3.1
azure-maps Supported Map Styles https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/supported-map-styles.md
Title: Supported built-in Azure Maps map styles
description: Learn about the built-in map styles that Azure Maps supports, such as road, blank_accessible, satellite, satellite_road_labels, road_shaded_relief, and night. Previously updated : 04/26/2020 Last updated : 11/01/2023
Azure Maps supports several different built-in map styles as described in this a
A **road** map is a standard map that displays roads. It also displays natural and artificial features, and the labels for those features.
-![road map style](./media/supported-map-styles/road.png)
**Applicable APIs:**
The **blank** and **blank_accessible** map styles provide a blank canvas for vis
The **satellite** style is a combination of satellite and aerial imagery.
-![satellite tile map style](./media/supported-map-styles/satellite.png)
**Applicable APIs:**
The **satellite** style is a combination of satellite and aerial imagery.
This map style is a hybrid of roads and labels overlaid on top of satellite and aerial imagery.
-![satellite_road_labels map style](./media/supported-map-styles/satellite-road-labels.png)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**grayscale dark** is a dark version of the road map style.
-![gray_scale map style](./media/supported-map-styles/grayscale-dark.png)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**grayscale light** is a light version of the road map style.
-![grayscale light map style](./media/supported-map-styles/grayscale-light.jpg)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**night** is a dark version of the road map style with colored roads and symbols.
-![night map style](./media/supported-map-styles/night.png)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**road shaded relief** is an Azure Maps main style completed with contours of the Earth.
-![shaded relief map style](./media/supported-map-styles/shaded-relief.png)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**high_contrast_dark** is a dark map style with a higher contrast than the other styles.
-![high contrast dark map style](./media/supported-map-styles/high-contrast-dark.png)
**Applicable APIs:**
This map style is a hybrid of roads and labels overlaid on top of satellite and
**high_contrast_light** is a light map style with a higher contrast than the other styles.
-![high contrast light map style](./media/supported-map-styles/high-contrast-light.jpg)
**Applicable APIs:**
The interactive Azure Maps map controls use vector tiles in the map styles to po
| `road` | Partial | Yes | The main colorful road map style in Azure Maps. Due to the number of different colors and possible overlapping color combinations, it's nearly impossible to make it 100% accessible. That said, this map style goes through regular accessibility testing and is improved as needed to make labels clearer to read. | | `road_shaded_relief` | Partial | Yes | Similar to the main road map style, but has an added tile layer in the background that adds shaded relief of mountains and land cover coloring when zoomed out. | | `satellite` | N/A | Yes | Purely satellite and aerial imagery, no labels, or road lines. The vector tiles are loaded behind the scenes to power the screen reader and to make for a smoother transition when switching to `satellite_with_roads`. |
-| `satellite_with_roads` | No | Yes | Satellite and aerial imagery, with labels and road lines overlaid. On a global scale, there's an unlimited number of color combinations that may occur between the overlaid data and the imagery. A focus on making labels readable in most common scenarios, however, in some places the color contrast with the background imagery may make labels difficult to read. |
+| `satellite_with_roads` | No | Yes | Satellite and aerial imagery, with labels and road lines overlaid. On a global scale, there's an unlimited number of color combinations that might occur between the overlaid data and the imagery. A focus on making labels readable in most common scenarios, however, in some places the color contrast with the background imagery might make labels difficult to read. |
## Next steps
azure-maps Tutorial Create Store Locator https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/tutorial-create-store-locator.md
description: Tutorial on how to use Microsoft Azure Maps to create store locator web applications. Previously updated : 01/03/2022 Last updated : 11/01/2023
This section lists the Azure Maps features that are demonstrated in the Contoso
The following screenshot shows the general layout of the Contoso Coffee store locator application. To view and interact with the live sample, see the [Simple Store Locator] sample application on the **Azure Maps Code Samples** site. To maximize the usefulness of this store locator, we include a responsive layout that adjusts when a user's screen width is smaller than 700 pixels wide. A responsive layout makes it easy to use the store locator on a small screen, like on a mobile device. Here's a screenshot showing a sample of the small-screen layout:
The first time a user selects the My Location button, the browser displays a sec
When you zoom in close enough in an area that has coffee shop locations, the clusters separate into individual locations. Select one of the icons on the map or select an item in the side panel to see a pop-up window. The pop-up shows information for the selected location.
-![Screenshot of the finished store locator](./media/tutorial-create-store-locator/finished-simple-store-locator.png)
If you resize the browser window to fewer than 700 pixels wide or open the application on a mobile device, the layout changes to be better suited for smaller screens.
azure-maps Tutorial Creator Indoor Maps https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/tutorial-creator-indoor-maps.md
This tutorial uses the [Postman] application, but you can use a different API de
Follow the steps outlined in the [How to create data registry] article to upload the GeoJSON package into your Azure storage account then register it in your Azure Maps account. > [!IMPORTANT]
-> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the GeoJSON package you uploaded into your Azure storage account from your source code and HTTP requests.
+> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the GeoJSON package you uploaded into your Azure storage account from your source code and HTTP requests.
## Convert a drawing package
azure-maps Tutorial Ev Routing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/tutorial-ev-routing.md
for loc in range(len(searchPolyResponse["results"])):
## Upload the reachable range and charging points
-It's helpful to visualize the charging stations and the boundary for the maximum reachable range of the electric vehicle on a map. Follow the steps outlined in the [How to create data registry] article to upload the boundary data and charging stations data as geojson objects to your [Azure storage account] then register them in your Azure Maps account. Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the geojson objects you uploaded into your Azure storage account from your source code.
+It's helpful to visualize the charging stations and the boundary for the maximum reachable range of the electric vehicle on a map. Follow the steps outlined in the [How to create data registry] article to upload the boundary data and charging stations data as geojson objects to your [Azure storage account] then register them in your Azure Maps account. Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the geojson objects you uploaded into your Azure storage account from your source code.
<! To upload the boundary and charging point data to Azure Maps Data service, run the following two cells:
routeData = {
## Visualize the route
-To help visualize the route, follow the steps outlined in the [How to create data registry] article to upload the route data as a geojson object to your [Azure storage account] then register it in your Azure Maps account. Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the geojson objects you uploaded into your Azure storage account from your source code. Then, call the rendering service, [Get Map Image API], to render the route on the map, and visualize it.
+To help visualize the route, follow the steps outlined in the [How to create data registry] article to upload the route data as a geojson object to your [Azure storage account] then register it in your Azure Maps account. Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the geojson objects you uploaded into your Azure storage account from your source code. Then, call the rendering service, [Get Map Image API], to render the route on the map, and visualize it.
To get an image for the rendered route on the map, run the following script:
azure-maps Tutorial Geofence https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/tutorial-geofence.md
Create the geofence JSON file using the following geofence data. You'll upload t
Follow the steps outlined in the [How to create data registry] article to upload the geofence JSON file into your Azure storage account then register it in your Azure Maps account. > [!IMPORTANT]
-> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is is how you reference the geofence you uploaded into your Azure storage account from your source code and HTTP requests.
+> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the geofence you uploaded into your Azure storage account from your source code and HTTP requests.
## Create workflows in Azure Logic Apps
azure-maps Webgl Custom Layer https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-maps/webgl-custom-layer.md
You need to add the following script files.
This sample renders an animated 3D parrot on the map.
-![A screenshot showing an an animated 3D parrot on the map.](./media/how-to-webgl-custom-layer/3d-parrot.gif)
+![A screenshot showing an animated 3D parrot on the map.](./media/how-to-webgl-custom-layer/3d-parrot.gif)
For a fully functional sample with source code, see [Three custom WebGL layer] in the Azure Maps Samples.
azure-monitor Agent Windows Troubleshoot https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/agents/agent-windows-troubleshoot.md
Both of these scripts may take a while to complete.
# This script uses parallel processing, modify the $parallelThrottleLimit parameter to either increase or decrease the number of parallel processes # PS> .\UpdateMMA.ps1 GetInventory # The above command will generate a csv file with the details of VM's and VMSS that require MMA upgrade.
-# The customer can modify the the csv by adding/removing rows if needed
+# The customer can modify the csv by adding/removing rows if needed
# Update the MMA by running the script again and passing the csv file as parameter as shown below: # PS> .\UpdateMMA.ps1 Upgrade # If you don't want to check the inventory, then run the script wiht an additional -no-inventory-check
azure-monitor Log Analytics Agent https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/agents/log-analytics-agent.md
Title: Log Analytics agent overview
description: This article helps you understand how to collect data and monitor computers hosted in Azure, on-premises, or other cloud environments with Log Analytics. -+ Last updated 07/06/2023
azure-monitor Autoscale Multiprofile https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/autoscale/autoscale-multiprofile.md
The example below shows how to create two recurring profiles. One profile for we
Use the following command to deploy the template: `az deployment group create --name VMSS1-Autoscale-607 --resource-group rg-vmss1 --template-file VMSS1-autoscale.json`
-where *VMSS1-autoscale.json* is the the file containing the JSON object below.
+where *VMSS1-autoscale.json* is the file containing the JSON object below.
``` JSON {
azure-monitor Container Insights Logging V2 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/containers/container-insights-logging-v2.md
For Python:
Customers must [enable ContainerLogV2](./container-insights-logging-v2.md#enable-the-containerlogv2-schema) for multi-line logging to work. ### How to enable
-Multi-line logging feature can be enabled by setting **enabled** flag to "true" under the `[log_collection_settings.enable_multiline_logs]` section in the the [config map](https://github.com/microsoft/Docker-Provider/blob/ci_prod/kubernetes/container-azm-ms-agentconfig.yaml)
+Multi-line logging feature can be enabled by setting **enabled** flag to "true" under the `[log_collection_settings.enable_multiline_logs]` section in the [config map](https://github.com/microsoft/Docker-Provider/blob/ci_prod/kubernetes/container-azm-ms-agentconfig.yaml)
```yaml [log_collection_settings.enable_multiline_logs]
azure-monitor Activity Log https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/activity-log.md
Activity log events are retained in Azure for *90 days* and then deleted. There'
## View the activity log You can access the activity log from most menus in the Azure portal. The menu that you open it from determines its initial filter. If you open it from the **Monitor** menu, the only filter is on the subscription. If you open it from a resource's menu, the filter is set to that resource. You can always change the filter to view all other entries. Select **Add Filter** to add more properties to the filter.-
-![Screenshot that shows the activity log.](./media/activity-log/view-activity-log.png)
+<!-- convertborder later -->
For a description of activity log categories, see [Azure activity log event schema](activity-log-schema.md#categories). ## Download the activity log Select **Download as CSV** to download the events in the current view.-
-![Screenshot that shows downloading the activity log.](media/activity-log/download-activity-log.png)
+<!-- convertborder later -->
### View change history For some events, you can view the change history, which shows what changes happened during that event time. Select an event from the activity log you want to look at more deeply. Select the **Change history** tab to view any changes on the resource up to 30 minutes before and after the time of the operation.
-![Screenshot that shows the Change history list for an event.](media/activity-log/change-history-event.png)
If any changes are associated with the event, you'll see a list of changes that you can select. Selecting a change opens the **Change history** page. This page displays the changes to the resource. In the following example, you can see that the VM changed sizes. The page displays the VM size before the change and after the change. To learn more about change history, see [Get resource changes](../../governance/resource-graph/how-to/get-resource-changes.md).
-![Screenshot that shows the Change history page showing differences.](media/activity-log/change-history-event-details.png)
### Other methods to retrieve activity log events
You can also access activity log events by using the following methods:
Select **Export Activity Logs** to send the activity log to a Log Analytics workspace.
- ![Screenshot that shows exporting activity logs.](media/activity-log/diagnostic-settings-export.png)
+ :::image type="content" source="media/activity-log/diagnostic-settings-export.png" lightbox="media/activity-log/diagnostic-settings-export.png" alt-text="Screenshot that shows exporting activity logs.":::
You can send the activity log from any single subscription to up to five workspaces.
azure-monitor Collect Custom Metrics Guestos Resource Manager Vm https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/collect-custom-metrics-guestos-resource-manager-vm.md
To deploy the ARM template, we use Azure PowerShell.
1. On the **Monitor** page, select **Metrics**.
- ![Screenshot that shows the Metrics page.](media/collect-custom-metrics-guestos-resource-manager-vm/metrics.png)
+ :::image type="content" source="media/collect-custom-metrics-guestos-resource-manager-vm/metrics.png" lightbox="media/collect-custom-metrics-guestos-resource-manager-vm/metrics.png" alt-text="Screenshot that shows the Metrics page.":::
1. Change the aggregation period to **Last 30 minutes**.
azure-monitor Collect Custom Metrics Guestos Vm Classic https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/collect-custom-metrics-guestos-vm-classic.md
The process that's outlined in this article only works on classic virtual machin
## Create a classic virtual machine and storage account 1. Create a classic VM by using the Azure portal.
- ![Create Classic VM](./media/collect-custom-metrics-guestos-vm-classic/create-classic-vm.png)
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-classic/create-classic-vm.png" lightbox="./media/collect-custom-metrics-guestos-vm-classic/create-classic-vm.png" alt-text="Create Classic VM":::
1. When you're creating this VM, choose the option to create a new classic storage account. We use this storage account in later steps. 1. In the Azure portal, go to the **Storage accounts** resource pane. Select **Keys**, and take note of the storage account name and storage account key. You need this information in later steps.
- ![Storage access keys](./media/collect-custom-metrics-guestos-vm-classic/storage-access-keys.png)
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-classic/storage-access-keys.png" lightbox="./media/collect-custom-metrics-guestos-vm-classic/storage-access-keys.png" alt-text="Storage access keys":::
## Create a service principal
Give this app ΓÇ£Monitoring Metrics PublisherΓÇ¥ permissions to the resource tha
1. On the **Monitor** pane on the left, select **Metrics**.
- ![Navigate metrics](./media/collect-custom-metrics-guestos-vm-classic/navigate-metrics.png)
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-classic/navigate-metrics.png" lightbox="./media/collect-custom-metrics-guestos-vm-classic/navigate-metrics.png" alt-text="Navigate metrics":::
1. In the resources drop-down menu, select your classic VM. 1. In the namespaces drop-down menu, select **azure.vm.windows.guest**. 1. In the metrics drop-down menu, select **Memory\Committed Bytes in Use**.
- ![Plot metrics](./media/collect-custom-metrics-guestos-vm-classic/plot-metrics.png)
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-classic/plot-metrics.png" lightbox="./media/collect-custom-metrics-guestos-vm-classic/plot-metrics.png" alt-text="Plot metrics":::
## Next steps
azure-monitor Collect Custom Metrics Guestos Vm Cloud Service Classic https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/collect-custom-metrics-guestos-vm-cloud-service-classic.md
The process that's outlined in this article works only for performance counters
1. Create and deploy a classic cloud service. A sample classic Cloud Services application and deployment can be found at [Get started with Azure Cloud Services and ASP.NET](../../cloud-services/cloud-services-dotnet-get-started.md). 2. You can use an existing storage account or deploy a new storage account. It's best if the storage account is in the same region as the classic cloud service that you created. In the Azure portal, go to the **Storage accounts** resource pane, and then select **Keys**. Take note of the storage account name and the storage account key. You'll need this information in later steps.-
- ![Storage account keys](./media/collect-custom-metrics-guestos-vm-cloud-service-classic/storage-keys.png)
+ <!-- convertborder later -->
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/storage-keys.png" lightbox="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/storage-keys.png" alt-text="Storage account keys" border="false":::
## Create a service principal
Set-AzureServiceDiagnosticsExtension -ServiceName <classicCloudServiceName> -Sto
1. Go to the Azure portal.
- ![Screenshot shows the Azure portal with Monitor, then Metrics selected.](./media/collect-custom-metrics-guestos-vm-cloud-service-classic/navigate-metrics.png)
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/navigate-metrics.png" lightbox="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/navigate-metrics.png" alt-text="Screenshot shows the Azure portal with Monitor, then Metrics selected.":::
2. On the left menu, select **Monitor.**
Set-AzureServiceDiagnosticsExtension -ServiceName <classicCloudServiceName> -Sto
6. In the metrics drop-down menu, select **Memory\Committed Bytes in Use**. You use the dimension filtering and splitting capabilities to view the total memory that's used by a specific role or role instance. -
- ![Screenshot shows Metrics data.](./media/collect-custom-metrics-guestos-vm-cloud-service-classic/metrics-graph.png)
+ <!-- convertborder later -->
+ :::image type="content" source="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/metrics-graph.png" lightbox="./media/collect-custom-metrics-guestos-vm-cloud-service-classic/metrics-graph.png" alt-text="Screenshot shows Metrics data." border="false":::
## Next steps
azure-monitor Data Collection Endpoint Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/data-collection-endpoint-overview.md
This table describes the components of a data collection endpoint, related regio
# [Azure portal](#tab/portal) 1. On the **Azure Monitor** menu in the Azure portal, select **Data Collection Endpoints** under the **Settings** section. Select **Create** to create a new DCR and assignment.-
- [![Screenshot that shows data collection endpoints.](media/data-collection-endpoint-overview/data-collection-endpoint-overview.png)](media/data-collection-endpoint-overview/data-collection-endpoint-overview.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/data-collection-endpoint-overview/data-collection-endpoint-overview.png" lightbox="media/data-collection-endpoint-overview/data-collection-endpoint-overview.png" alt-text="Screenshot that shows data collection endpoints." border="false":::
1. Select **Create** to create a new endpoint. Provide a **Rule name** and specify a **Subscription**, **Resource Group**, and **Region**. This information specifies where the DCE will be created.-
- [![Screenshot that shows data collection rule basics.](media/data-collection-endpoint-overview/data-collection-endpoint-basics.png)](media/data-collection-endpoint-overview/data-collection-endpoint-basics.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/data-collection-endpoint-overview/data-collection-endpoint-basics.png" lightbox="media/data-collection-endpoint-overview/data-collection-endpoint-basics.png" alt-text="Screenshot that shows data collection rule basics." border="false":::
1. Select **Review + create** to review the details of the DCE. Select **Create** to create it.
azure-monitor Data Platform Metrics https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/data-platform-metrics.md
There are multiple types of metrics supported by Azure Monitor Metrics:
- Custom metrics are collected from different sources that you configure including applications and agents running on virtual machines. - Prometheus metrics are collected from Kubernetes clusters including Azure Kubernetes service (AKS) and use industry standard tools for analyzing and alerting such as PromQL and Grafana.
-![Diagram that shows sources and uses of metrics.](media/data-platform-metrics/metrics-overview.png)
The differences between each of the metrics are summarized in the following table.
For a complete list of data sources that can send data to Azure Monitor Metrics,
Azure Monitor provides REST APIs that allow you to get data in and out of Azure Monitor Metrics. - **Custom metrics API** - [Custom metrics](./metrics-custom-overview.md) allow you to load your own metrics into the Azure Monitor Metrics database. Those metrics can then be used by the same analysis tools that process Azure Monitor platform metrics. - **Azure Monitor Metrics REST API** - Allows you to access Azure Monitor platform metrics definitions and values. For more information, see [Azure Monitor REST API](/rest/api/monitor/). For information on how to use the API, see the [Azure monitoring REST API walkthrough](./rest-api-walkthrough.md).-- **Azure Monitor Metrics Data plane REST API** - [Azure Monitor Metrics data plane API](/rest/api/monitor/metrics-data-plane/) is a high-volume API designed for customers with large volume metrics queries. It's similar to the existing standard Azure Monitor Metrics REST API, but provides the capability to retrieve metric data for up to 50 resource IDs in the same subscription and region in a single batch API call. This improves query throughput and reduces the risk of throttling.
+- **Azure Monitor Metrics Batch REST API** - [Azure Monitor Metrics Batch API](/rest/api/monitor/metrics-batch/) is a high-volume API designed for customers with large volume metrics queries. It's similar to the existing standard Azure Monitor Metrics REST API, but provides the capability to retrieve metric data for up to 50 resource IDs in the same subscription and region in a single batch API call. This improves query throughput and reduces the risk of throttling.
## Security
Secure connection is established between the agent and the Azure Monitor service
## Metrics Explorer Use [Metrics Explorer](metrics-charts.md) to interactively analyze the data in your metric database and chart the values of multiple metrics over time. You can pin the charts to a dashboard to view them with other visualizations. You can also retrieve metrics by using the [Azure monitoring REST API](./rest-api-walkthrough.md).-
-![Screenshot that shows an example graph in Metrics Explorer that displays server requests, server response time, and failed requests.](media/data-platform-metrics/metrics-explorer.png)
+<!-- convertborder later -->
For more information, see [Analyze metrics with Azure Monitor metrics explorer](./analyze-metrics.md).
azure-monitor Diagnostic Settings Policy https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/diagnostic-settings-policy.md
For details on creating an initiative, see [Create and assign an initiative defi
- Set **Category** to **Monitoring** to group it with related built-in and custom policy definitions. - Instead of specifying the details for the Log Analytics workspace and the event hub for policy definitions included in the initiative, use a common initiative parameter. This parameter allows you to easily specify a common value for all policy definitions and change that value if necessary.-
-![Screenshot that shows settings for initiative definition.](media/diagnostic-settings-policy/initiative-definition.png)
+<!-- convertborder later -->
## Assignment Assign the initiative to an Azure management group, subscription, or resource group, depending on the scope of your resources to monitor. A [management group](../../governance/management-groups/overview.md) is useful for scoping policy, especially if your organization has multiple subscriptions.-
-![Screenshot of the settings for the Basics tab in the Assign initiative section of the Diagnostic settings to Log Analytics workspace in the Azure portal.](media/diagnostic-settings-policy/initiative-assignment.png)
+<!-- convertborder later -->
By using initiative parameters, you can specify the workspace or any other details once for all of the policy definitions in the initiative. -
-![Screenshot that shows initiative parameters on the Parameters tab.](media/diagnostic-settings-policy/initiative-parameters.png)
+<!-- convertborder later -->
## Remediation The initiative will be applied to each virtual machine as it's created. A [remediation task](../../governance/policy/how-to/remediate-resources.md) deploys the policy definitions in the initiative to existing resources, so you can create diagnostic settings for any resources that were already created. When you create the assignment by using the Azure portal, you have the option of creating a remediation task at the same time. See [Remediate non-compliant resources with Azure Policy](../../governance/policy/how-to/remediate-resources.md) for details on the remediation.-
-![Screenshot that shows initiative remediation for a Log Analytics workspace.](media/diagnostic-settings-policy/initiative-remediation.png)
+<!-- convertborder later -->
## Troubleshooting
azure-monitor Metrics Troubleshoot https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/metrics-troubleshoot.md
Use this article if you run into issues with creating, customizing, or interpret
## Chart shows no data
-Sometimes the charts might show no data after selecting correct resources and metrics. This behavior can be caused by several of the following reasons:
+Sometimes the charts might show no data after selecting correct resources and metrics. Several of the following reasons can cause this behavior:
### Microsoft.Insights resource provider isn't registered for your subscription
Exploring metrics requires *Microsoft.Insights* resource provider registered in
### You don't have sufficient access rights to your resource
-In Azure, access to metrics is controlled by [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md). You must be a member of [monitoring reader](../../role-based-access-control/built-in-roles.md#monitoring-reader), [monitoring contributor](../../role-based-access-control/built-in-roles.md#monitoring-contributor), or [contributor](../../role-based-access-control/built-in-roles.md#contributor) to explore metrics for any resource.
+In Azure, [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md) controls access to metrics. You must be a member of [monitoring reader](../../role-based-access-control/built-in-roles.md#monitoring-reader), [monitoring contributor](../../role-based-access-control/built-in-roles.md#monitoring-contributor), or [contributor](../../role-based-access-control/built-in-roles.md#contributor) to explore metrics for any resource.
**Solution:** Ensure that you have sufficient permissions for the resource from which you're exploring metrics. ### Your resource didn't emit metrics during the selected time range
-Some resources donΓÇÖt constantly emit their metrics. For example, Azure won't collect metrics for stopped virtual machines. Other resources might emit their metrics only when some condition occurs. For example, a metric showing processing time of a transaction requires at least one transaction. If there were no transactions in the selected time range, the chart will naturally be empty. Additionally, while most of the metrics in Azure are collected every minute, there are some that are collected less frequently. See the metric documentation to get more details about the metric that you're trying to explore.
+Some resources donΓÇÖt constantly emit their metrics. For example, Azure doesn't collect metrics for stopped virtual machines. Other resources might emit their metrics only when some condition occurs. For example, a metric showing processing time of a transaction requires at least one transaction. If there were no transactions in the selected time range, the chart is naturally empty. Additionally, while most of the metrics in Azure are collected every minute, there are some that are collected less frequently. See the metric documentation to get more details about the metric that you're trying to explore.
**Solution:** Change the time of the chart to a wider range. You may start from ΓÇ£Last 30 daysΓÇ¥ using a larger time granularity (or relying on the ΓÇ£Automatic time granularityΓÇ¥ option).
Some resources donΓÇÖt constantly emit their metrics. For example, Azure won't c
[Most metrics in Azure are stored for 93 days](../essentials/data-platform-metrics.md#retention-of-metrics). However, you can only query for no more than 30 days worth of data on any single chart. This limitation doesn't apply to [log-based metrics](../app/pre-aggregated-metrics-log-metrics.md#log-based-metrics).
-**Solution:** If you see a blank chart or your chart only displays part of metric data, verify that the difference between start- and end- dates in the time picker doesn't exceed the 30-day interval. Once you have selected a 30 day interval, you can [pan](metrics-charts.md#pan) the chart to view the full retention window.
+**Solution:** If you see a blank chart or your chart only displays part of metric data, verify that the difference between start- and end- dates in the time picker doesn't exceed the 30-day interval. Once you select a 30 day interval, you can [pan](metrics-charts.md#pan) the chart to view the full retention window.
### All metric values were outside of the locked y-axis range
This problem may happen when your dashboard was created with a metric that was l
## Chart shows dashed line
-Azure metrics charts use dashed line style to indicate that there's a missing value (also known as ΓÇ£null valueΓÇ¥) between two known time grain data points. For example, if in the time selector you picked ΓÇ£1 minuteΓÇ¥ time granularity but the metric was reported at 07:26, 07:27, 07:29, and 07:30 (note a minute gap between second and third data points), then a dashed line will connect 07:27 and 07:29 and a solid line will connect all other data points. The dashed line drops down to zero when the metric uses **count** and **sum** aggregation. For the **avg**, **min** or **max** aggregations, the dashed line connects two nearest known data points. Also, when the data is missing on the rightmost or leftmost side of the chart, the dashed line expands to the direction of the missing data point.
- ![Screenshot that shows how when the data is missing on the rightmost or leftmost side of the chart, the dashed line expands to the direction of the missing data point.](./media/metrics-troubleshoot/dashed-line.png)
+Azure metrics charts use dashed line style to indicate that there's a missing value (also known as ΓÇ£null valueΓÇ¥) between two known time grain data points. For example, if in the time selector you picked ΓÇ£1 minuteΓÇ¥ time granularity but the metric was reported at 07:26, 07:27, 07:29, and 07:30 (note a minute gap between second and third data points), then a dashed line connects 07:27 and 07:29 and a solid line connects all other data points. The dashed line drops down to zero when the metric uses **count** and **sum** aggregation. For the **avg**, **min** or **max** aggregations, the dashed line connects two nearest known data points. Also, when the data is missing on the rightmost or leftmost side of the chart, the dashed line expands to the direction of the missing data point.
+ :::image type="content" source="./media/metrics-troubleshoot/dashed-line.png" lightbox="./media/metrics-troubleshoot/dashed-line.png" alt-text="Screenshot that shows how when the data is missing on the rightmost or leftmost side of the chart, the dashed line expands to the direction of the missing data point.":::
**Solution:** This behavior is by design. It's useful for identifying missing data points. The line chart is a superior choice for visualizing trends of high-density metrics but may be difficult to interpret for the metrics with sparse values, especially when corelating values with time grain is important. The dashed line makes reading of these charts easier but if your chart is still unclear, consider viewing your metrics with a different chart type. For example, a scattered plot chart for the same metric clearly shows each time grain by only visualizing a dot when there's a value and skipping the data point altogether when the value is missing:
- ![Screenshot that highlights the Scatter chart menu option.](./media/metrics-troubleshoot/scatter-plot.png)
+ <!-- convertborder later -->
+ :::image type="content" source="./media/metrics-troubleshoot/scatter-plot.png" lightbox="./media/metrics-troubleshoot/scatter-plot.png" alt-text="Screenshot that highlights the Scatter chart menu option." border="false":::
> [!NOTE] > If you still prefer a line chart for your metric, moving mouse over the chart may help to assess the time granularity by highlighting the data point at the location of the mouse pointer. ## Units of measure in metrics charts
-Azure monitor metrics uses SI based prefixes. Metrics will only be using IEC prefixes if the resource provider has chosen an appropriate unit for a metric.
+Azure monitor metrics uses SI based prefixes. Metrics only use IEC prefixes if the resource provider chooses an appropriate unit for a metric.
For ex: The resource provider Network interface (resource name: rarana-vm816) has no metric unit defined for "Packets Sent". The prefix used for the metric value here's k representing kilo (1000), a SI prefix.
-![Screenshot that shows metric value with prefix kilo.](./media/metrics-troubleshoot/prefix-si.png)
The resource provider Storage account (resource name: ibabichvm) has metric unit defined for "Blob Capacity" as bytes. Hence, the prefix used is mebi (1024^2), an IEC prefix.
-![Screenshot that shows metric value with prefix mebi.](./media/metrics-troubleshoot/prefix-iec.png)
SI uses decimal
IEC uses binary
## Chart shows unexpected drop in values
-In many cases, the perceived drop in the metric values is a misunderstanding of the data shown on the chart. You can be misled by a drop in sums or counts when the chart shows the most-recent minutes because the last metric data points havenΓÇÖt been received or processed by Azure yet. Depending on the service, the latency of processing metrics can be within a couple minutes range. For charts showing a recent time range with a 1- or 5- minute granularity, a drop of the value over the last few minutes becomes more noticeable:
- ![Screenshot that shows a drop of the value over the last few minutes.](./media/metrics-troubleshoot/unexpected-dip.png)
+In many cases, the perceived drop in the metric values is a misunderstanding of the data shown on the chart. You can be misled by a drop in sums or counts when the chart shows the most-recent minutes because Azure hasn't received or processed the last metric data points yet. Depending on the service, the latency of processing metrics can be within a couple minutes range. For charts showing a recent time range with a 1- or 5- minute granularity, a drop of the value over the last few minutes becomes more noticeable:
+ <!-- convertborder later -->
+ :::image type="content" source="./media/metrics-troubleshoot/unexpected-dip.png" lightbox="./media/metrics-troubleshoot/unexpected-dip.png" alt-text="Screenshot that shows a drop of the value over the last few minutes." border="false":::
-**Solution:** This behavior is by design. We believe that showing data as soon as we receive it's beneficial even when the data is *partial* or *incomplete*. Doing so allows you to make important conclusion sooner and start investigation right away. For example, for a metric that shows the number of failures, seeing a partial value X tells you that there were at least X failures on a given minute. You can start investigating the problem right away, rather than wait to see the exact count of failures that happened on this minute, which might not be as important. The chart will update once we receive the entire set of data, but at that time it may also show new incomplete data points from more recent minutes.
+**Solution:** This behavior is by design. We believe that showing data as soon as we receive it's beneficial even when the data is *partial* or *incomplete*. Doing so allows you to make important conclusion sooner and start investigation right away. For example, for a metric that shows the number of failures, seeing a partial value X tells you that there were at least X failures on a given minute. You can start investigating the problem right away, rather than wait to see the exact count of failures that happened on this minute, which might not be as important. The chart updates once we receive the entire set of data, but at that time it may also show new incomplete data points from more recent minutes.
## Cannot pick Guest namespace and metrics
Virtual machines and virtual machine scale sets have two categories of metrics:
By default, Guest (classic) metrics are stored in Azure Storage account, which you pick from the **Diagnostic settings** tab of your resource. If Guest metrics aren't collected or metrics explorer cannot access them, you'll only see the **Virtual Machine Host** metric namespace:
-![metric image](./media/metrics-troubleshoot/vm-metrics.png)
**Solution:** If you don't see **Guest (classic)** namespace and metrics in metrics explorer:
azure-monitor Monitor Azure Resource https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/monitor-azure-resource.md
The **Overview** page includes details about the resource and often its current
To learn how to use Metrics Explorer, see [Analyze metrics for an Azure resource](../essentials/tutorial-metrics.md).
-![Screenshot that shows the Overview page.](media/monitor-azure-resource/overview-page.png)
### Activity log The **Activity log** menu item lets you view entries in the [activity log](../essentials/activity-log.md) for the current resource.-
+<!-- convertborder later -->
## Alerts
To learn how to create alert rules and view alerts, see [Create a metric alert f
The **Metrics** menu item opens [Metrics Explorer](./metrics-getting-started.md). You can use it to work with individual metrics or combine multiple metrics to identify correlations and trends. This is the same Metrics Explorer that opens when you select one of the charts on the **Overview** page. To learn how to use Metrics Explorer, see [Analyze metrics for an Azure resource](../essentials/tutorial-metrics.md).-
+<!-- convertborder later -->
## Diagnostic settings
To learn how to create a diagnostic setting, see [Collect and analyze resource l
The **Insights** menu item opens the insight for the resource if the Azure service has one. [Insights](../monitor-reference.md) provide a customized monitoring experience built on the Azure Monitor data platform and standard features. For a list of insights that are available and links to their documentation, see [Insights](../insights/insights-overview.md) and [core solutions](/previous-versions/azure/azure-monitor/insights/solutions).-
+<!-- convertborder later -->
## Next steps
azure-monitor Prometheus Workbooks https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/essentials/prometheus-workbooks.md
Azure Monitor workspaces include an exploration workbook to query your Prometheu
1. From the Azure Monitor workspace overview page, select **Prometheus explorer**
-![Screenshot that shows Azure Monitor workspace menu selection.](./media/prometheus-workbooks/prometheus-explorer-menu.png)
2. Or the **Workbooks** menu item, and in the Azure Monitor workspace gallery, select the **Prometheus Explorer** workbook tile.
-![Screenshot that shows Azure Monitor workspace gallery.](./media/prometheus-workbooks/prometheus-gallery.png)
A workbook has the following input options: - **Time Range**. Select the period of time that you want to include in your query. Select **Custom** to set a start and end time. - **PromQL**. Enter the PromQL query to retrieve your data. For more information about PromQL, see [Querying Prometheus](https://prometheus.io/docs/prometheus/latest/querying/basics/#querying-prometheus). - **Graph**, **Grid**, and **Dimensions** tabs. Switch between a graphic, tabular, and dimensional view of the query output.
-![Screenshot that shows PromQL explorer.](./media/prometheus-workbooks/prometheus-explorer.png)
## Create a Prometheus workbook
Workbooks support many visualizations and Azure integrations. For more informati
1. Select **New**. 1. In the new workbook, select **Add**, and select **Add query** from the dropdown. 1. Azure Workbooks use [data sources](../visualize/workbooks-data-sources.md#prometheus-preview) to set the source scope the data they present. To query Prometheus metrics, select the **Data source** dropdown, and choose **Prometheus** . 1. From the **Azure Monitor workspace** dropdown, select your workspace. 1. Select your query type from **Prometheus query type** dropdown.
Workbooks support many visualizations and Azure integrations. For more informati
1. Select **Run Query** button. 1. Select the **Done Editing** at the bottom of the section and save your work
-![Screenshot that shows sample PromQL query.](./media/prometheus-workbooks/prometheus-query.png)
## Troubleshooting
azure-monitor Aiops Machine Learning https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/aiops-machine-learning.md
Last updated 02/28/2023
-#customer-intent: As a DevOps manager or data scientist, I want to understand which AIOps features Azure Monitor offers and how to implement a machine learning pipeline on data in Azure Monitor Logs so that I can use artifical intelligence to to improve service quality and reliability of my IT environment.
+#customer-intent: As a DevOps manager or data scientist, I want to understand which AIOps features Azure Monitor offers and how to implement a machine learning pipeline on data in Azure Monitor Logs so that I can use artifical intelligence to improve service quality and reliability of my IT environment.
# Detect and mitigate potential issues using AIOps and machine learning in Azure Monitor
azure-monitor Basic Logs Query https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/basic-logs-query.md
Creating a query using Basic Logs is the same as any other query in Log Analytic
In the Azure portal, select **Monitor** > **Logs** > **Tables**. In the list of tables, you can identify Basic Logs tables by their unique icon: -
-![Screenshot of the Basic Logs table icon in the table list.](./media/basic-logs-configure/table-icon.png)
+<!-- convertborder later -->
You can also hover over a table name for the table information view, which will specify that the table is configured as Basic Logs:-
-![Screenshot of the Basic Logs table indicator in the table details.](./media/basic-logs-configure/table-info.png)
+<!-- convertborder later -->
When you add a table to the query, Log Analytics will identify a Basic Logs table and align the authoring experience accordingly. The following example shows when you attempt to use an operator that isn't supported by Basic Logs.
-![Screenshot of Query on Basic Logs limitations.](./media/basic-logs-query/query-validator.png)
# [API](#tab/api-1)
azure-monitor Custom Fields https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/custom-fields.md
Last updated 03/31/2023
The **Custom Fields** feature of Azure Monitor allows you to extend existing records in your Log Analytics workspace by adding your own searchable fields. Custom fields are automatically populated from data extracted from other properties in the same record.
-![Diagram shows an original record associated with a modified record in a Log Analytics workspace with property value pairs added to the original property in the modified record.](media/custom-fields/overview.png)
For example, the sample record below has useful data buried in the event description. Extracting this data into a separate property makes it available for such actions as sorting and filtering.-
-![Sample extract](media/custom-fields/sample-extract.png)
+<!-- convertborder later -->
> [!NOTE] > In the Preview, you are limited to 500 custom fields in your workspace. This limit will be expanded when this feature reaches general availability.
There are two ways to remove a custom field. The first is the **Remove** option
The following section walks through a complete example of creating a custom field. This example extracts the service name in Windows events that indicate a service changing state. This relies on events created by Service Control Manager during system startup on Windows computers. If you want to follow this example, you must be [collecting Information events for the System log](../agents/data-sources-windows-events.md). We enter the following query to return all events from Service Control Manager that have an Event ID of 7036 which is the event that indicates a service starting or stopping.-
-![Screenshot showing a query for an event source and ID.](media/custom-fields/query.png)
+<!-- convertborder later -->
We then right-click on any record with event ID 7036 and select **Extract fields from \`Event`**.-
-![Screenshot showing the Copy and Extract fields options, which are available when you right-click a record from the list of results.](media/custom-fields/extract-fields.png)
+<!-- convertborder later -->
The **Field Extraction Wizard** opens with the **EventLog** and **EventID** fields selected in the **Main Example** column. This indicates that the custom field will be defined for events from the System log with an event ID of 7036. This is sufficient so we donΓÇÖt need to select any other fields.-
-![Main example](media/custom-fields/main-example.png)
+<!-- convertborder later -->
We highlight the name of the service in the **RenderedDescription** property and use **Service** to identify the service name. The custom field will be called **Service_CF**. The field type in this case is a string, so we can leave that unchanged.-
-![Field Title](media/custom-fields/field-title.png)
+<!-- convertborder later -->
We see that the service name is identified properly for some records but not for others. The **Search Results** show that part of the name for the **WMI Performance Adapter** wasnΓÇÖt selected. The **Summary** shows that one record identified **Modules Installer** instead of **Windows Modules Installer**. -
-![Screenshot showing portions of the service name highlighted in the Search Results pane and one incorrect service name highlighted in the Summary.](media/custom-fields/search-results-01.png)
+<!-- convertborder later -->
We start with the **WMI Performance Adapter** record. We click its edit icon and then **Modify this highlight**. -
-![Modify highlight](media/custom-fields/modify-highlight.png)
+<!-- convertborder later -->
We increase the highlight to include the word **WMI** and then rerun the extract. -
-![Additional example](media/custom-fields/additional-example-01.png)
+<!-- convertborder later -->
We can see that the entries for **WMI Performance Adapter** have been corrected, and Log Analytics also used that information to correct the records for **Windows Module Installer**.-
-![Screenshot showing the full service name highlighted in the Search Results pane and the correct service names highlighted in the Summary.](media/custom-fields/search-results-02.png)
+<!-- convertborder later -->
We can now run a query that verifies **Service_CF** is created but is not yet added to any records. That's because the custom field doesn't work against existing records so we need to wait for new records to be collected.-
-![Initial count](media/custom-fields/initial-count.png)
+<!-- convertborder later -->
After some time has passed so new events are collected, we can see that the **Service_CF** field is now being added to records that match our criteria.-
-![Final results](media/custom-fields/final-results.png)
+<!-- convertborder later -->
We can now use the custom field like any other record property. To illustrate this, we create a query that groups by the new **Service_CF** field to inspect which services are the most active.-
-![Group by query](media/custom-fields/query-group.png)
+<!-- convertborder later -->
## Next steps * Learn about [log queries](./log-query-overview.md) to build queries using custom fields for criteria.
azure-monitor Custom Logs Migrate https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/custom-logs-migrate.md
The migration procedure described in this article assumes you have:
The Log Ingestion API requires you to create two new types of resources, which the HTTP Data Collector API doesn't require: -- [Data collection endpoints](../essentials/data-collection-endpoint-overview.md), from which the the data you collect is ingested into the pipeline for processing.
+- [Data collection endpoints](../essentials/data-collection-endpoint-overview.md), from which the data you collect is ingested into the pipeline for processing.
- [Data collection rules](../essentials/data-collection-rule-overview.md), which define [data transformations](../essentials/data-collection-transformations.md) and the destination table to which the data is ingested. ## Migrate existing custom tables or create new tables
azure-monitor Customer Managed Keys https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/customer-managed-keys.md
You can apply Customer-managed key configuration to a new cluster, or existing c
> [!IMPORTANT] > Customer-managed key capability is regional. Your Azure Key Vault, cluster and linked workspaces must be in the same region, but they can be in different subscriptions.-
-[![Customer-managed key overview](media/customer-managed-keys/cmk-overview.png "Screenshot of Customer-managed key diagram.")](media/customer-managed-keys/cmk-overview.png#lightbox)
+<!-- convertborder later -->
1. Key Vault 2. Log Analytics cluster resource having managed identity with permissions to Key VaultΓÇöThe identity is propagated to the underlay dedicated cluster storage
Customer-managed key configuration isn't supported in Azure portal currently and
A [portfolio of Azure Key Management products](../../key-vault/managed-hsm/mhsm-control-data.md#portfolio-of-azure-key-management-products) lists the vaults and managed HSMs that can be used. Create or use an existing Azure Key Vault in the region that the cluster is planed, and generate or import a key to be used for logs encryption. The Azure Key Vault must be configured as recoverable, to protect your key and the access to your data in Azure Monitor. You can verify this configuration under properties in your Key Vault, both **Soft delete** and **Purge protection** should be enabled.-
-[![Soft delete and purge protection settings](media/customer-managed-keys/soft-purge-protection.png "Screenshot of Key Vault soft delete and purge protection properties")](media/customer-managed-keys/soft-purge-protection.png#lightbox)
+<!-- convertborder later -->
These settings can be updated in Key Vault via CLI and PowerShell:
There are two permission models in Key Vault to grant access to your cluster and
- Select principalΓÇödepending on the identity type used in the cluster (system or user assigned managed identity) - System assigned managed identity - enter the cluster name or cluster principal ID - User assigned managed identity - enter the identity name-
- [<img src="media/customer-managed-keys/grant-key-vault-permissions-8bit.png" alt="Screenshot of Grant Key Vault access policy permissions." title="Grant Key Vault access policy permissions" width="80%"/>](media/customer-managed-keys/grant-key-vault-permissions-8bit.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/customer-managed-keys/grant-key-vault-permissions-8bit.png" lightbox="media/customer-managed-keys/grant-key-vault-permissions-8bit.png" alt-text="Screenshot of Grant Key Vault access policy permissions." border="false":::
The **Get** permission is required to verify that your Key Vault is configured as recoverable to protect your key and the access to your Azure Monitor data.
This step updates dedicated cluster storage with the key and version to use for
>- Key rotation can be automatic or require explicit key update, see [Key rotation](#key-rotation) to determine approach that is suitable for you before updating the key identifier details in cluster. >- Cluster update should not include both identity and key identifier details in the same operation. If you need to update both, the update should be in two consecutive operations.
-[![Grant Key Vault permissions](media/customer-managed-keys/key-identifier-8bit.png "Screenshot of Key Vault key identifier details")](media/customer-managed-keys/key-identifier-8bit.png#lightbox)
Update KeyVaultProperties in cluster with key identifier details.
The query language used in Log Analytics is expressive and can contain sensitive
## Customer-managed key for Workbooks With the considerations mentioned for [Customer-managed key for saved queries and log alerts](#customer-managed-key-for-saved-queries-and-log-alerts), Azure Monitor enables you to store Workbook queries encrypted with your key in your own Storage Account, when selecting **Save content to an Azure Storage Account** in Workbook 'Save' operation.-
-[ ![Screenshot of Workbook save.](media/customer-managed-keys/cmk-workbook.png) ](media/customer-managed-keys/cmk-workbook.png#lightbox)
+<!-- convertborder later -->
> [!NOTE] > Queries remain encrypted with Microsoft key ("MMK") in the following scenarios regardless Customer-managed key configuration: Azure dashboards, Azure Logic App, Azure Notebooks and Automation Runbooks.
azure-monitor Data Collector Api https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/data-collector-api.md
You can use the HTTP Data Collector API to send log data to a Log Analytics work
All data in the Log Analytics workspace is stored as a record with a particular record type. You format your data to send to the HTTP Data Collector API as multiple records in JavaScript Object Notation (JSON). When you submit the data, an individual record is created in the repository for each record in the request payload.
-![Screenshot illustrating the HTTP Data Collector overview.](media/data-collector-api/overview.png)
## Create a request To use the HTTP Data Collector API, you create a POST request that includes the data to send in JSON. The next three tables list the attributes that are required for each request. We describe each attribute in more detail later in the article.
The data type that Azure Monitor uses for each property depends on whether the r
* If the record type does exist, Azure Monitor attempts to create a new record based on existing properties. If the data type for a property in the new record doesnΓÇÖt match and canΓÇÖt be converted to the existing type, or if the record includes a property that doesnΓÇÖt exist, Azure Monitor creates a new property that has the relevant suffix. For example, the following submission entry would create a record with three properties, **number_d**, **boolean_b**, and **string_s**:-
-![Screenshot of sample record 1.](media/data-collector-api/record-01.png)
+<!-- convertborder later -->
If you were to submit this next entry, with all values formatted as strings, the properties wouldn't change. You can convert the values to existing data types.-
-![Screenshot of sample record 2.](media/data-collector-api/record-02.png)
+<!-- convertborder later -->
But, if you then make this next submission, Azure Monitor would create the new properties **boolean_d** and **string_d**. You can't convert these values.-
-![Screenshot of sample record 3.](media/data-collector-api/record-03.png)
+<!-- convertborder later -->
If you then submit the following entry, before the record type is created, Azure Monitor would create a record with three properties, **number_s**, **boolean_s**, and **string_s**. In this entry, each of the initial values is formatted as a string:-
-![Screenshot of sample record 4.](media/data-collector-api/record-04.png)
+<!-- convertborder later -->
## Reserved properties The following properties are reserved and shouldn't be used in a custom record type. You'll receive an error if your payload includes any of these property names:
azure-monitor Data Platform Logs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/data-platform-logs.md
The following table describes some of the ways that you can use Azure Monitor Lo
| Export | Configure [automated export of log data](./logs-data-export.md) to an Azure Storage account or Azure Event Hubs.<br>Build a workflow to retrieve log data and copy it to an external location by using [Azure Logic Apps](../../connectors/connectors-azure-monitor-logs.md). | | Bring your own analysis | [Analyze data in Azure Monitor Logs using a notebook](../logs/notebooks-azure-monitor-logs.md) to create streamlined, multi-step processes on top of data you collect in Azure Monitor Logs. This is especially useful for purposes such as [building and running machine learning pipelines](../logs/aiops-machine-learning.md#create-your-own-machine-learning-pipeline-on-data-in-azure-monitor-logs), advanced analysis, and troubleshooting guides (TSGs) for Support needs. |
-![Diagram that shows an overview of Azure Monitor Logs.](media/data-platform-logs/logs-overview.png)
## Data collection After you create a [Log Analytics workspace](#log-analytics-workspaces), you must configure sources to send their data. No data is collected automatically.
You can:
Insights include prebuilt queries to support their views and workbooks. For a list of where log queries are used and references to tutorials and other documentation to get you started, see [Log queries in Azure Monitor](./log-query-overview.md).-
-![Screenshot that shows queries in Log Analytics.](media/data-platform-logs/log-analytics.png)
+<!-- convertborder later -->
## Relationship to Azure Data Explorer Azure Monitor Logs is based on Azure Data Explorer. A Log Analytics workspace is roughly the equivalent of a database in Azure Data Explorer. Tables are structured the same, and both use KQL. For information on KQL, see [Kusto Query Language (KQL) overview](/azure/data-explorer/kusto/query/).
azure-monitor Data Retention Archive https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/data-retention-archive.md
This article describes how to configure data retention and archiving.
Each workspace has a default retention setting that's applied to all tables. You can configure a different retention setting on individual tables. During the interactive retention period, data is available for monitoring, troubleshooting, and analytics. When you no longer use the logs, but still need to keep the data for compliance or occasional investigation, archive the logs to save costs.
To set the default workspace retention:
1. Select **Usage and estimated costs** in the left pane. 1. Select **Data Retention** at the top of the page.
- :::image type="content" source="media/manage-cost-storage/manage-cost-change-retention-01.png" alt-text="Screenshot that shows changing the workspace data retention setting.":::
+ :::image type="content" source="media/manage-cost-storage/manage-cost-change-retention-01.png" lightbox="media/manage-cost-storage/manage-cost-change-retention-01.png" alt-text="Screenshot that shows changing the workspace data retention setting.":::
1. Move the slider to increase or decrease the number of days, and then select **OK**.
The default retention for Application Insights resources is 90 days. You can sel
To change the retention, from your Application Insights resource, go to the **Usage and estimated costs** page and select the **Data retention** option.
-![Screenshot that shows where to change the data retention period.](../app/media/pricing/pricing-005.png)
A several-day grace period begins when the retention is lowered before the oldest data is removed.
azure-monitor Data Security https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/data-security.md
Azure Log Analytics meets the following requirements:
## Cloud computing security data flow The following diagram shows a cloud security architecture as the flow of information from your company and how it's secured as is moves to Azure Monitor, ultimately seen by you in the Azure portal. More information about each step follows the diagram.-
-![Image of Azure Monitor Logs data collection and security](./media/data-security/log-analytics-data-security-diagram.png)
+<!-- convertborder later -->
### 1. Sign up for Azure Monitor and collect data For your organization to send data to Azure Monitor Logs, you configure a Windows or Linux agent running on Azure virtual machines, or on virtual or physical computers in your environment or other cloud provider. If you use Operations Manager, from the management group you configure the Operations Manager agent. Users (which might be you, other individual users, or a group of people) create one or more Log Analytics workspaces, and register agents by using one of the following accounts:
azure-monitor Delete Workspace https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/delete-workspace.md
You can delete a workspace by using [PowerShell](/powershell/module/azurerm.oper
1. If you want to permanently delete the workspace and remove the option to later recover it, select the **Delete the workspace permanently** checkbox. 1. Enter the name of the workspace to confirm and then select **Delete**.
- ![Screenshot that shows confirming the deletion of a workspace.](media/delete-workspace/workspace-delete.png)
+ :::image type="content" source="media/delete-workspace/workspace-delete.png" lightbox="media/delete-workspace/workspace-delete.png" alt-text="Screenshot that shows confirming the deletion of a workspace.":::
### PowerShell ```PowerShell
You can recover your workspace during the soft-delete period, including its data
1. Sign in to the [Azure portal](https://portal.azure.com). 1. In the Azure portal, select **All services**. In the list of resources, enter **Log Analytics**. As you begin typing, the list filters based on your input. Select **Log Analytics workspaces**. You see the list of workspaces you have in the selected scope. 1. Select **Recover** on the top left menu to open a page with workspaces in a soft-delete state that can be recovered.-
- ![Screenshot that shows the Log Analytics workspaces screen and Open recycle bin on the menu bar.](media/delete-workspace/recover-menu.png)
+ <!-- convertborder later -->
+ :::image type="content" source="media/delete-workspace/recover-menu.png" lightbox="media/delete-workspace/recover-menu.png" alt-text="Screenshot that shows the Log Analytics workspaces screen and Open recycle bin on the menu bar." border="false":::
1. Select the workspace. Then select **Recover** to recover the workspace.-
- ![Screenshot that shows the Recycle bin with a workspace and the Recover button.](media/delete-workspace/recover-workspace.png)
+ <!-- convertborder later -->
+ :::image type="content" source="media/delete-workspace/recover-workspace.png" lightbox="media/delete-workspace/recover-workspace.png" alt-text="Screenshot that shows the Recycle bin with a workspace and the Recover button." border="false":::
### PowerShell ```PowerShell
azure-monitor Get Started Queries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/get-started-queries.md
SecurityEvent
``` Descending is the default sorting order, so you would usually omit the `desc` argument. The output looks like this example.-
-![Screenshot that shows the top 10 records sorted in descending order.](media/get-started-queries/top10.png)
+<!-- convertborder later -->
## The where operator: Filter on a condition Filters, as indicated by their name, filter the data by a specific condition. Filtering is the most common way to limit query results to relevant information.
You can specify a time range by using the time picker or a time filter.
### Use the time picker The time picker is displayed next to the **Run** button and indicates that you're querying records from only the last 24 hours. This default time range is applied to all queries. To get records from only the last hour, select **Last hour** and then run the query again.-
-![Screenshot that shows the time picker and its list of time-range commands.](media/get-started-queries/timepicker.png)
+<!-- convertborder later -->
### Add a time filter to the query
SecurityEvent
``` The preceding example generates the following output:-
-![Screenshot that shows the query "project" results list.](media/get-started-queries/project.png)
+<!-- convertborder later -->
You can also use `project` to rename columns and define new ones. The next example uses `project` to do the following:
Perf
``` To make the output clearer, you can select to display it as a time chart, which shows the available memory over time.-
-![Screenshot that shows the values of a query memory over time.](media/get-started-queries/chart.png)
+<!-- convertborder later -->
## Frequently asked questions
azure-monitor Log Analytics Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/log-analytics-overview.md
Whether you work with the results of your queries interactively or use them with
To start Log Analytics in the Azure portal, on the **Azure Monitor** menu select **Logs**. You'll also see this option on the menu for most Azure resources. No matter where you start Log Analytics, the tool is the same. But the menu you use to start Log Analytics determines the data that's available. If you start Log Analytics from the **Azure Monitor** menu or the **Log Analytics workspaces** menu, you'll have access to all the records in a workspace. If you select **Logs** from another type of resource, your data will be limited to log data for that resource. For more information, see [Log query scope and time range in Azure Monitor Log Analytics](./scope.md).-
-[![Screenshot that shows starting Log Analytics.](media/log-analytics-overview/start-log-analytics.png)](media/log-analytics-overview/start-log-analytics.png#lightbox)
+<!-- convertborder later -->
When you start Log Analytics, a dialog appears that contains [example queries](../logs/queries.md). The queries are categorized by solution. Browse or search for queries that match your requirements. You might find one that does exactly what you need. You can also load one to the editor and modify it as required. Browsing through example queries is a good way to learn how to write your own queries.
If you want to start with an empty script and write it yourself, close the examp
The following image identifies four Log Analytics components.
-[![Screenshot that shows the Log Analytics interface with four features identified.](media/log-analytics-overview/log-analytics.png)](media/log-analytics-overview/log-analytics.png#lightbox)
### Top action bar
azure-monitor Log Analytics Workspace Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/log-analytics-workspace-overview.md
To create a new workspace, see [Create a Log Analytics workspace in the Azure po
Each workspace contains multiple tables that are organized into separate columns with multiple rows of data. Each table is defined by a unique set of columns. Rows of data provided by the data source share those columns. Log queries define columns of data to retrieve and provide output to different features of Azure Monitor and other services that use workspaces.
-[![Diagram that shows the Azure Monitor Logs structure.](media/data-platform-logs/logs-structure.png)](media/data-platform-logs/logs-structure.png#lightbox)
> [!WARNING] > Table names are used for billing purposes so they should not contain sensitive information.
To access archived data, you must first retrieve data from it in an Analytics Lo
| [Search jobs](search-jobs.md) | Retrieve data matching particular criteria. | | [Restore](restore.md) | Retrieve data from a particular time range. | ## Permissions
azure-monitor Log Standard Columns https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/log-standard-columns.md
Last updated 02/18/2022
# Standard columns in Azure Monitor Logs Data in Azure Monitor Logs is [stored as a set of records in either a Log Analytics workspace or Application Insights application](../logs/data-platform-logs.md), each with a particular data type that has a unique set of columns. Many data types will have standard columns that are common across multiple types. This article describes these columns and provides examples of how you can use them in queries.
-Workspace-based applications in Application Insights store their data in a Log Analytics workspace and use the same standard columns as other other tables in the workspace. Classic applications store their data separately and have different standard columns as specified in this article.
+Workspace-based applications in Application Insights store their data in a Log Analytics workspace and use the same standard columns as other tables in the workspace. Classic applications store their data separately and have different standard columns as specified in this article.
> [!NOTE] > Some of the standard columns will not show in the schema view or intellisense in Log Analytics, and they won't show in query results unless you explicitly specify the column in the output.
azure-monitor Logs Data Export https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/logs-data-export.md
Data in Log Analytics is available for the retention period defined in your work
After you've configured data export rules in a Log Analytics workspace, new data for tables in rules is exported from the Azure Monitor pipeline to your Storage Account or Event Hubs as it arrives.
-[![Diagram that shows a data export flow.](media/logs-data-export/data-export-overview.png "Diagram that shows a data export flow.")](media/logs-data-export/data-export-overview.png#lightbox)
Data is exported without a filter. For example, when you configure a data export rule for a *SecurityEvent* table, all data sent to the *SecurityEvent* table is exported starting from the configuration time. Alternatively, you can filter or modify exported data by configuring [transformations](./../essentials/data-collection-transformations.md) in your workspace, which apply to incoming data, before it's sent to your Log Analytics workspaces and to export destinations.
Blobs are stored in 5-minute folders in the following path structure: *Workspace
The format of blobs in a Storage Account is in [JSON lines](/previous-versions/azure/azure-monitor/essentials/resource-logs-blob-format), where each record is delimited by a new line, with no outer records array and no commas between JSON records.
-[![Screenshot that shows data format in a blob.](media/logs-data-export/storage-data.png "Screenshot that shows data format in a blob.")](media/logs-data-export/storage-data-expand.png#lightbox)
### Event Hubs
Register-AzResourceProvider -ProviderNamespace Microsoft.insights
### Allow trusted Microsoft services If you've configured your Storage Account to allow access from selected networks, you need to add an exception to allow Azure Monitor to write to the account. From **Firewalls and virtual networks** for your Storage Account, select **Allow Azure services on the trusted services list to access this Storage Account**.-
-[![Screenshot that shows the option Allow Azure services on the trusted services list.](media/logs-data-export/storage-account-network.png "Screenshot that shows the option Allow Azure services on the trusted services list.")](media/logs-data-export/storage-account-network.png#lightbox)
+<!-- convertborder later -->
### Monitor destinations
A data export rule defines the destination and tables for which data is exported
1. On the **Log Analytics workspace** menu in the Azure portal, select **Data Export** under the **Settings** section. Select **New export rule** at the top of the pane.
- [![Screenshot that shows the data export entry point.](media/logs-data-export/export-create-1.png "Screenshot that shows the data export entry point.")](media/logs-data-export/export-create-1.png#lightbox)
+ :::image type="content" source="media/logs-data-export/export-create-1.png" lightbox="media/logs-data-export/export-create-1.png" alt-text="Screenshot that shows the data export entry point.":::
1. Follow the steps, and then select **Create**.
Use the following command to create a data export rule to a specific Event Hub b
1. On the **Log Analytics workspace** menu in the Azure portal, select **Data Export** under the **Settings** section.
- [![Screenshot that shows the Data Export screen.](media/logs-data-export/export-view-1.png "Screenshot that shows the Data Export screen.")](media/logs-data-export/export-view-1.png#lightbox)
+ :::image type="content" source="media/logs-data-export/export-view-1.png" lightbox="media/logs-data-export/export-view-1.png" alt-text="Screenshot that shows the Data Export screen.":::
1. Select a rule for a configuration view.-
- <img src="media/logs-data-export/export-view-2.png" alt="Screenshot of data export rule view." title= "Data export rule configuration view" width="65%"/>
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-data-export/export-view-2.png" lightbox="media/logs-data-export/export-view-2.png" alt-text="Screenshot of data export rule view." border="false":::
# [PowerShell](#tab/powershell)
The template option doesn't apply.
You can disable export rules to stop the export for a certain period, such as when testing is being held. On the **Log Analytics workspace** menu in the Azure portal, select **Data Export** under the **Settings** section. Select the **Status** toggle to disable or enable the export rule.
-[![Screenshot that shows disabling the data export rule.](media/logs-data-export/export-disable.png "Screenshot that shows disabling the data export rule.")](media/logs-data-export/export-disable.png#lightbox)
# [PowerShell](#tab/powershell)
You can disable export rules to stop export when testing is performed and you do
On the **Log Analytics workspace** menu in the Azure portal, select **Data Export** under the **Settings** section. Select the ellipsis to the right of the rule and select **Delete**.
-[![Screenshot that shows deleting the data export rule.](media/logs-data-export/export-delete.png "Screenshot that shows deleting the data export rule.")](media/logs-data-export/export-delete.png#lightbox)
# [PowerShell](#tab/powershell)
The template option doesn't apply.
On the **Log Analytics workspace** menu in the Azure portal, select **Data Export** under the **Settings** section to view all export rules in the workspace.
-[![Screenshot that shows the data export rules view.](media/logs-data-export/export-view.png "Screenshot that shows the data export rules view.")](media/logs-data-export/export-view.png#lightbox)
# [PowerShell](#tab/powershell)
azure-monitor Logs Export Logic App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/logs-export-logic-app.md
The method discussed in this article describes a scheduled export from a log que
## Overview This procedure uses the [Azure Monitor Logs connector](/connectors/azuremonitorlogs), which lets you run a log query from a logic app and use its output in other actions in the workflow. The [Azure Blob Storage connector](/connectors/azureblob) is used in this procedure to send the query output to storage.-
-[![Screenshot that shows a Logic Apps overview.](media/logs-export-logic-app/logic-app-overview.png "Screenshot that shows a Logic Apps flow.")](media/logs-export-logic-app/logic-app-overview.png#lightbox)
+<!-- convertborder later -->
When you export data from a Log Analytics workspace, limit the amount of data processed by your Logic Apps workflow. Filter and aggregate your log data in the query to reduce the required data. For example, if you need to export sign-in events, filter for required events and project only the required fields. For example:
Use the procedure in [Create a container](../../storage/blobs/storage-quickstart
### Create a logic app workflow 1. Go to **Logic Apps** in the Azure portal and select **Add**. Select a **Subscription**, **Resource group**, and **Region** to store the new logic app. Then give it a unique name. You can turn on the **Log Analytics** setting to collect information about runtime data and events as described in [Set up Azure Monitor Logs and collect diagnostics data for Azure Logic Apps](../../logic-apps/monitor-workflows-collect-diagnostic-data.md). This setting isn't required for using the Azure Monitor Logs connector.-
- [![Screenshot that shows creating a logic app.](media/logs-export-logic-app/create-logic-app.png "Screenshot that shows creating a Logic Apps resource.")](media/logs-export-logic-app/create-logic-app.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/create-logic-app.png" lightbox="media/logs-export-logic-app/create-logic-app.png" alt-text="Screenshot that shows creating a logic app." border="false":::
1. Select **Review + create** and then select **Create**. After the deployment is finished, select **Go to resource** to open the **Logic Apps Designer**. ### Create a trigger for the workflow Under **Start with a common trigger**, select **Recurrence**. This setting creates a logic app workflow that automatically runs at a regular interval. In the **Frequency** box of the action, select **Day**. In the **Interval** box, enter **1** to run the workflow once per day.-
-[![Screenshot that shows a Recurrence action.](media/logs-export-logic-app/recurrence-action.png "Screenshot that shows creating a recurrence action.")](media/logs-export-logic-app/recurrence-action.png#lightbox)
+<!-- convertborder later -->
### Add an Azure Monitor Logs action
The Azure Monitor Logs action lets you specify the query to run. The log query u
You're prompted to select a tenant to grant access to the Log Analytics workspace with the account that the workflow will use to run the query. 1. Select **+ New step** to add an action that runs after the recurrence action. Under **Choose an action**, enter **azure monitor**. Then select **Azure Monitor Logs**.-
- [![Screenshot that shows an Azure Monitor Logs action.](media/logs-export-logic-app/select-azure-monitor-connector.png "Screenshot that shows creating a Azure Monitor Logs action.")](media/logs-export-logic-app/select-azure-monitor-connector.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-azure-monitor-connector.png" lightbox="media/logs-export-logic-app/select-azure-monitor-connector.png" alt-text="Screenshot that shows an Azure Monitor Logs action." border="false":::
1. Select **Azure Log Analytics ΓÇô Run query and list results**.-
- [![Screenshot that shows Azure Monitor Logs is highlighted under Choose an action.](media/logs-export-logic-app/select-query-action-list.png "Screenshot that shows a new action being added to a step in the Logic Apps Designer.")](media/logs-export-logic-app/select-query-action-list.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-query-action-list.png" lightbox="media/logs-export-logic-app/select-query-action-list.png" alt-text="Screenshot that shows Azure Monitor Logs is highlighted under Choose an action." border="false":::
1. Select the **Subscription** and **Resource Group** for your Log Analytics workspace. Select **Log Analytics Workspace** for the **Resource Type**. Then select the workspace name under **Resource Name**.
You're prompted to select a tenant to grant access to the Log Analytics workspac
``` 1. The **Time Range** specifies the records that will be included in the query based on the **TimeGenerated** column. The value should be greater than the time range selected in the query. Because this query isn't using the **TimeGenerated** column, the **Set in query** option isn't available. For more information about the time range, see [Query scope](./scope.md). Select **Last 4 hours** for the **Time Range**. This setting ensures that any records with an ingestion time larger than **TimeGenerated** will be included in the results.-
- [![Screenshot that shows the settings for the new Azure Monitor Logs action named Run query and visualize results.](media/logs-export-logic-app/run-query-list-action.png "Screenshot that shows the settings for the Azure Monitor Logs action named Run query.")](media/logs-export-logic-app/run-query-list-action.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/run-query-list-action.png" lightbox="media/logs-export-logic-app/run-query-list-action.png" alt-text="Screenshot that shows the settings for the new Azure Monitor Logs action named Run query and visualize results." border="false":::
### Add a Parse JSON action (optional)
You can use a sample output from the **Run query and list results** step.
``` 1. Select **+ New step** and then select **+ Add an action**. Under **Choose an operation**, enter **json** and then select **Parse JSON**.-
- [![Screenshot that shows selecting a Parse JSON operator.](media/logs-export-logic-app/select-parse-json.png "Screenshot that shows the Parse JSON operator.")](media/logs-export-logic-app/select-parse-json.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-parse-json.png" lightbox="media/logs-export-logic-app/select-parse-json.png" alt-text="Screenshot that shows selecting a Parse JSON operator." border="false":::
1. Select the **Content** box to display a list of values from previous activities. Select **Body** from the **Run query and list results** action. This output is from the log query.-
- [![Screenshot that shows selecting a Body.](media/logs-export-logic-app/select-body.png "Screenshot that shows a Parse JSON Content setting with the output Body from the previous step.")](media/logs-export-logic-app/select-body.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-body.png" lightbox="media/logs-export-logic-app/select-body.png" alt-text="Screenshot that shows selecting a Body." border="false":::
1. Copy the sample record saved earlier. Select **Use sample payload to generate schema** and paste.-
- [![Screenshot that shows parsing a JSON payload.](media/logs-export-logic-app/parse-json-payload.png "Screenshot that shows a Parse JSON schema.")](media/logs-export-logic-app/parse-json-payload.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/parse-json-payload.png" lightbox="media/logs-export-logic-app/parse-json-payload.png" alt-text="Screenshot that shows parsing a JSON payload." border="false":::
### Add the Compose action The **Compose** action takes the parsed JSON output and creates the object that you need to store in the blob. 1. Select **+ New step**, and then select **+ Add an action**. Under **Choose an operation**, enter **compose**. Then select the **Compose** action.-
- [![Screenshot that shows selecting a Compose action.](media/logs-export-logic-app/select-compose.png "Screenshot that shows a Compose action.")](media/logs-export-logic-app/select-compose.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-compose.png" lightbox="media/logs-export-logic-app/select-compose.png" alt-text="Screenshot that shows selecting a Compose action." border="false":::
1. Select the **Inputs** box to display a list of values from previous activities. Select **Body** from the **Parse JSON** action. This parsed output is from the log query.-
- [![Screenshot that shows selecting a body for a Compose action.](media/logs-export-logic-app/select-body-compose.png "Screenshot that shows a body for Compose action.")](media/logs-export-logic-app/select-body-compose.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-body-compose.png" lightbox="media/logs-export-logic-app/select-body-compose.png" alt-text="Screenshot that shows selecting a body for a Compose action." border="false":::
### Add the Create blob action The **Create blob** action writes the composed JSON to storage. 1. Select **+ New step**, and then select **+ Add an action**. Under **Choose an operation**, enter **blob**. Then select the **Create blob** action.-
- [![Screenshot that shows selecting the Create Blob action.](media/logs-export-logic-app/select-create-blob.png "Screenshot that shows creating a Blob storage action.")](media/logs-export-logic-app/select-create-blob.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/select-create-blob.png" lightbox="media/logs-export-logic-app/select-create-blob.png" alt-text="Screenshot that shows selecting the Create Blob action." border="false":::
1. Enter a name for the connection to your storage account in **Connection Name**. Then select the folder icon in the **Folder path** box to select the container in your storage account. Select **Blob name** to see a list of values from previous activities. Select **Expression** and enter an expression that matches your time interval. For this query, which is run hourly, the following expression sets the blob name per previous hour: ```json subtractFromTime(formatDateTime(utcNow(),'yyyy-MM-ddTHH:00:00'), 1,'Hour') ```-
- [![Screenshot that shows a blob expression.](media/logs-export-logic-app/blob-expression.png "Screenshot that shows a Blob action connection.")](media/logs-export-logic-app/blob-expression.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/blob-expression.png" lightbox="media/logs-export-logic-app/blob-expression.png" alt-text="Screenshot that shows a blob expression." border="false":::
1. Select the **Blob content** box to display a list of values from previous activities. Then select **Outputs** in the **Compose** section.-
- [![Screenshot that shows creating a blob expression.](media/logs-export-logic-app/create-blob.png "Screenshot that shows a Blob action output configuration.")](media/logs-export-logic-app/create-blob.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/logs-export-logic-app/create-blob.png" lightbox="media/logs-export-logic-app/create-blob.png" alt-text="Screenshot that shows creating a blob expression." border="false":::
### Test the workflow To test the workflow, select **Run**. If the workflow has errors, they're indicated on the step with the problem. You can view the executions and drill in to each step to view the input and output to investigate failures. See [Troubleshoot and diagnose workflow failures in Azure Logic Apps](../../logic-apps/logic-apps-diagnosing-failures.md), if necessary.-
-[![Screenshot that shows Runs history.](media/logs-export-logic-app/runs-history.png "Screenshot that shows trigger run history.")](media/logs-export-logic-app/runs-history.png#lightbox)
+<!-- convertborder later -->
### View logs in storage Go to the **Storage accounts** menu in the Azure portal and select your storage account. Select the **Blobs** tile. Then select the container you specified in the **Create blob** action. Select one of the blobs and then select **Edit blob**.-
-[![Screenshot that shows blob data.](media/logs-export-logic-app/blob-data.png "Screenshot that shows sample data exported to a blob.")](media/logs-export-logic-app/blob-data.png#lightbox)
+<!-- convertborder later -->
### Logic App template
azure-monitor Manage Access https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/manage-access.md
The *access control mode* is a setting on each workspace that defines how permis
View the current workspace access control mode on the **Overview** page for the workspace in the **Log Analytics workspace** menu.
-![Screenshot that shows the workspace access control mode.](media/manage-access/view-access-control-mode.png)
Change this setting on the **Properties** page of the workspace. If you don't have permissions to configure the workspace, changing the setting is disabled.
-![Screenshot that shows changing workspace access mode.](media/manage-access/change-access-control-mode.png)
# [PowerShell](#tab/powershell)
azure-monitor Move Workspace https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/move-workspace.md
Run the [Get-AzSubscription](/powershell/module/az.accounts/get-azsubscription/)
1. Open the menu for the resource group where any solutions are installed. 1. Select the solutions to remove. 1. Select **Delete Resources** and then confirm the resources to be removed by selecting **Delete**.-
- [![Screenshot that shows deleting solutions.](media/move-workspace/delete-solutions.png)](media/move-workspace/delete-solutions.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/move-workspace/delete-solutions.png" lightbox="media/move-workspace/delete-solutions.png" alt-text="Screenshot that shows deleting solutions." border="false":::
### [REST API](#tab/rest-api)
To remove the **Start/Stop VMs** solution, you also need to remove the alert rul
- AutoStop_VM_Child - ScheduledStartStop_Parent - SequencedStartStop_Parent-
- [![Screenshot that shows deleting rules.](media/move-workspace/delete-rules.png)](media/move-workspace/delete-rules.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/move-workspace/delete-rules.png" lightbox="media/move-workspace/delete-rules.png" alt-text="Screenshot that shows deleting rules." border="false":::
### [REST API](#tab/rest-api)
Not supported.
1. Select a destination **Subscription** and **Resource group**. If you're moving the workspace to another resource group in the same subscription, you won't see the **Subscription** option. 1. Select **OK** to move the workspace and selected resources.
- [![Screenshot that shows the Overview pane in the Log Analytics workspace with options to change the resource group and subscription name.](media/move-workspace/portal.png)](media/move-workspace/portal.png#lightbox)
+ :::image type="content" source="media/move-workspace/portal.png" lightbox="media/move-workspace/portal.png" alt-text="Screenshot that shows the Overview pane in the Log Analytics workspace with options to change the resource group and subscription name.":::
### [ REST API](#tab/rest-api)
azure-monitor Private Link Configure https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/private-link-configure.md
In this section, we review the step-by-step process of setting up a private link
1. Give the AMPLS a name. Use a meaningful and clear name like *AppServerProdTelem*. 1. Select **Review + create**.
- ![Screenshot that shows creating an Azure Monitor Private Link Scope.](./media/private-link-security/ampls-create-1d.png)
+ :::image type="content" source="./media/private-link-security/ampls-create-1d.png" lightbox="./media/private-link-security/ampls-create-1d.png" alt-text="Screenshot that shows creating an Azure Monitor Private Link Scope.":::
1. Let the validation pass and select **Create**.
Connect Azure Monitor resources like Log Analytics workspaces, Application Insig
1. In your AMPLS, select **Azure Monitor Resources** in the menu on the left. Select **Add**. 1. Add the workspace or component. Selecting **Add** opens a dialog where you can select Azure Monitor resources. You can browse through your subscriptions and resource groups. You can also enter their names to filter down to them. Select the workspace or component and select **Apply** to add them to your scope.
- ![Screenshot that shows selecting a scope.](./media/private-link-security/ampls-select-2.png)
+ :::image type="content" source="./media/private-link-security/ampls-select-2.png" lightbox="./media/private-link-security/ampls-select-2.png" alt-text="Screenshot that shows selecting a scope.":::
> [!NOTE] > Deleting Azure Monitor resources requires that you first disconnect them from any AMPLS objects they're connected to. It's not possible to delete resources connected to an AMPLS.
So far we've covered the configuration of your network. But you should also cons
Go to the Azure portal. On your resource's menu, find **Network Isolation** on the left side. This page controls which networks can reach the resource through a private link and whether other networks can reach it or not.
-![Screenshot that shows Network Isolation.](./media/private-link-security/ampls-network-isolation.png)
### Connected Azure Monitor Private Link Scopes Here you can review and configure the resource's connections to an AMPLS. Connecting to an AMPLS allows traffic from the virtual network connected to each AMPLS to reach the resource. It has the same effect as connecting it from the scope as we did in the section [Connect Azure Monitor resources](#connect-azure-monitor-resources).
This zone also covers the resource-specific endpoints for [data collection endpo
* `<unique-dce-identifier>.<regionname>.handler.control`: Private configuration endpoint, part of a DCE resource. * `<unique-dce-identifier>.<regionname>.ingest`: Private ingestion endpoint, part of a DCE resource.-
-[![Screenshot that shows Private DNS zone monitor-azure-com.](./media/private-link-security/dns-zone-privatelink-monitor-azure-com-with-endpoint.png)](./media/private-link-security/dns-zone-privatelink-monitor-azure-com-expanded-with-endpoint.png#lightbox)
+<!-- convertborder later -->
#### Log Analytics endpoints > [!IMPORTANT]
Log Analytics uses four DNS zones:
The following screenshot shows endpoints mapped for an AMPLS with two workspaces in East US and one workspace in West Europe. Notice the East US workspaces share the IP addresses. The West Europe workspace endpoint is mapped to a different IP address. The blob endpoint doesn't appear in this image but it's configured.
-[![Screenshot that shows private link compressed endpoints.](./media/private-link-security/dns-zone-privatelink-compressed-endpoints.png)](./media/private-link-security/dns-zone-privatelink-compressed-endpoints.png#lightbox)
### Validate that you're communicating over a private link
azure-monitor Private Link Design https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/private-link-design.md
In the following diagram, virtual network 10.0.1.x connects to AMPLS1, which cre
To avoid this conflict, create only a single AMPLS object per DNS.
-![Diagram that shows DNS overrides in multiple virtual networks.](./media/private-link-security/dns-overrides-multiple-vnets.png)
### Hub-and-spoke networks Hub-and-spoke networks should use a single private link connection set on the hub (main) network, and not on each spoke virtual network.
-![Diagram that shows a hub-and-spoke single private link.](./media/private-link-security/hub-and-spoke-with-single-private-endpoint-with-data-collection-endpoint.png)
> [!NOTE] > You might prefer to create separate private links for your spoke virtual networks, for example, to allow each virtual network to access a limited set of monitoring resources. In such cases, you can create a dedicated private endpoint and AMPLS for each virtual network. *You must also verify they don't share the same DNS zones to avoid DNS overrides*.
By using private link access modes, you can control how private links affect you
Choosing the proper access mode is critical to ensuring continuous, uninterrupted network traffic. Each of these modes can be set for ingestion and queries, separately: * **Private Only**: Allows the virtual network to reach only private link resources (resources in the AMPLS). That's the most secure mode of work. It prevents data exfiltration by blocking traffic out of the AMPLS to Azure Monitor resources.
-![Diagram that shows the AMPLS Private Only access mode.](./media/private-link-security/ampls-private-only-access-mode.png)
* **Open**: Allows the virtual network to reach both private link resources and resources not in the AMPLS (if they [accept traffic from public networks](./private-link-design.md#control-network-access-to-your-resources)). The Open access mode doesn't prevent data exfiltration, but it still offers the other benefits of private links. Traffic to private link resources is sent through private endpoints, validated, and sent over the Microsoft backbone. The Open mode is useful for a mixed mode of work (accessing some resources publicly and others over a private link) or during a gradual onboarding process.
-![Diagram that shows the AMPLS Open access mode.](./media/private-link-security/ampls-open-access-mode.png)
Access modes are set separately for ingestion and queries. For example, you can set the Private Only mode for ingestion and the Open mode for queries. Apply caution when you select your access mode. Using the Private Only access mode will block traffic to resources not in the AMPLS across all networks that share the same DNS, regardless of subscription or tenant. The exception is Log Analytics ingestion requests, which is explained. If you can't add all Azure Monitor resources to the AMPLS, start by adding select resources and applying the Open access mode. Switch to the Private Only mode for maximum security *only after you've added all Azure Monitor resources to your AMPLS*.
For configuration details and examples, see [Use APIs and the command line](./pr
The access modes set on the AMPLS resource affect all networks, but you can override these settings for specific networks. In the following diagram, VNet1 uses the Open mode and VNet2 uses the Private Only mode. Requests from VNet1 can reach Workspace 1 and Component 2 over a private link. Requests can reach Component 3 only if it [accepts traffic from public networks](./private-link-design.md#control-network-access-to-your-resources). VNet2 requests can't reach Component 3.
-![Diagram that shows mixed access modes.](./media/private-link-security/ampls-mixed-access-modes.png)
## Consider AMPLS limits
In the following diagram:
* Workspace 2 connects to AMPLS A and AMPLS B by using two of the five possible AMPLS connections. * AMPLS B is connected to private endpoints of two virtual networks (VNet2 and VNet3) by using two of the 10 possible private endpoint connections.
-![Diagram that shows AMPLS limits.](./media/private-link-security/ampls-limits.png)
## Control network access to your resources Your Log Analytics workspaces or Application Insights components can be set to:
azure-monitor Private Link Security https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/private-link-security.md
For more information, see [Key benefits of Private Link](../../private-link/priv
## How it works: Main principles An Azure Monitor private link connects a private endpoint to a set of Azure Monitor resources made up of Log Analytics workspaces and Application Insights resources. That set is called an Azure Monitor Private Link Scope.
-![Diagram that shows basic resource topology.](./media/private-link-security/private-link-basic-topology.png)
An AMPLS:
azure-monitor Private Storage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/private-storage.md
For the storage account to connect to your private link, it must:
* Be located on the same region as the workspace it's linked to. * Allow Azure Monitor to access the storage account. To allow only specific networks to access your storage account, select the exception **Allow trusted Microsoft services to access this storage account**.
- ![Screenshot that shows Storage account trust Microsoft services.](./media/private-storage/storage-trust.png)
+ :::image type="content" source="./media/private-storage/storage-trust.png" lightbox="./media/private-storage/storage-trust.png" alt-text="Screenshot that shows Storage account trust Microsoft services.":::
If your workspace handles traffic from other networks, configure the storage account to allow incoming traffic coming from the relevant networks/internet.
To configure your Azure Storage account to use CMKs with Key Vault, use the [Azu
### Use the Azure portal On the Azure portal, open your workspace menu and select **Linked storage accounts**. A pane shows the linked storage accounts by the use cases previously mentioned (ingestion over Private Link, applying CMKs to saved queries or to alerts).
-![Screenshot that shows the Linked storage accounts pane.](./media/private-storage/all-linked-storage-accounts.png)
Selecting an item on the table opens its storage account details, where you can set or update the linked storage account for this type.
-![Screenshot that shows the Link storage account pane.](./media/private-storage/link-a-storage-account-blade.png)
You can use the same account for different use cases if you prefer. ### Use the Azure CLI or REST API
azure-monitor Queries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/queries.md
Select queries from the query interface, which is available from two different l
When you open Log Analytics, the **Queries** dialog automatically appears. If you don't want this dialog to automatically appear, turn off the **Always show Queries** toggle.
-![Screenshot that shows the Queries screen.](media/queries/query-start.png)
Each query is represented by a card. You can quickly scan through the queries to find what you need. You can run the query directly from the dialog or choose to load it to the query editor for modification. You can also access it by selecting **Queries** in the upper-right corner.-
-[![Screenshot that shows the Queries button.](media/queries/queries-button.png)](media/queries/queries-button.png#lightbox)
+<!-- convertborder later -->
### Query sidebar You can access the same functionality of the dialog experience from the **Queries** pane on the left sidebar of Log Analytics. Hover over a query name to get the query description and more functionality.-
-[![Screenshot that shows the Query sidebar.](media/queries/query-sidebar.png)](media/queries/query-sidebar.png#lightbox)
+<!-- convertborder later -->
## Find and filter queries
The options in this section are available in both the dialog and sidebar query e
Change the grouping of the queries by selecting the **group by** dropdown list. The grouping values also act as an active table of contents. Selecting one of the values on the left side of the screen scrolls the **Queries** view directly to the item selected. If your organization created query packs with tags, the custom tags will be included in this list.
-[![Screenshot that shows the Example queries screen group by dropdown list.](media/queries/example-query-groupby.png)](media/queries/example-query-groupby.png#lightbox)
### [Filter](#tab/filter) You can also filter the queries according to the **group by** values mentioned earlier. In the **Example queries** dialog, the filters are found at the top.
-[![Screenshot that shows an Example queries screen filter.](media/queries/example-query-filter.png)](media/queries/example-query-filter.png#lightbox)
### [Combine group by and filter](#tab/combinegroupbyandfilter)
azure-monitor Query Audit https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/query-audit.md
Query auditing is enabled with a [diagnostic setting](../essentials/diagnostic-s
Access the diagnostic setting for a Log Analytics workspace in the Azure portal in either of the following locations: - From the **Azure Monitor** menu, select **Diagnostic settings**, and then locate and select the workspace.-
- [![Diagnostic settings Azure Monitor](media/query-audit/diagnostic-setting-monitor.png) ](media/query-audit/diagnostic-setting-monitor.png#lightbox)
+ <!-- convertborder later -->
+ :::image type="content" source="media/query-audit/diagnostic-setting-monitor.png" lightbox="media/query-audit/diagnostic-setting-monitor.png" alt-text="Screenshot of diagnostic settings Azure Monitor." border="false":::
- From the **Log Analytics workspaces** menu, select the workspace, and then select **Diagnostic settings**.
- [![Diagnostic settings Log Analytics workspace](media/query-audit/diagnostic-setting-workspace.png) ](media/query-audit/diagnostic-setting-workspace.png#lightbox)
+ :::image type="content" source="media/query-audit/diagnostic-setting-workspace.png" lightbox="media/query-audit/diagnostic-setting-workspace.png" alt-text="Screenshot of diagnostic settings Log Analytics workspace.":::
### Resource Manager template You can get an example Resource Manager template from [Diagnostic setting for Log Analytics workspace](../essentials/resource-manager-diagnostic-settings.md#diagnostic-setting-for-a-log-analytics-workspace).
azure-monitor Query Packs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/query-packs.md
You can set the permissions on a query pack when you view it in the Azure portal
## View query packs You can view and manage query packs in the Azure portal from the **Log Analytics query packs** menu. Select a query pack to view and edit its permissions. This article describes how to create a query pack by using the API.-
-[![Screenshot that shows query packs.](media/query-packs/view-query-pack.png)](media/query-packs/view-query-pack.png#lightbox)
+<!-- convertborder later -->
## Default query pack Azure Monitor automatically creates a query pack called `DefaultQueryPack` in each subscription in a resource group called `LogAnalyticsDefaultResources` when you save your first query. You can save queries to this query pack or create other query packs depending on your requirements.
azure-monitor Save Query https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/save-query.md
When you save a query, it's stored in a query pack, which has benefits over the
## Save a query To save a query to a query pack, select **Save as query** from the **Save** dropdown in Log Analytics.-
-[![Screenshot that shows the Save query menu.](media/save-query/save-query.png)](media/save-query/save-query.png#lightbox)
+<!-- convertborder later -->
When you save a query to a query pack, the following dialog box appears where you can provide values for the query properties. The query properties are used for filtering and grouping of similar queries to help you find the query you're looking for. For a detailed description of each property, see [Query properties](queries.md#query-properties). Most users should leave the option to **Save to the default query pack**, which will save the query in the [default query pack](query-packs.md#default-query-pack). Clear this checkbox if there are other query packs in your subscription. For information on how to create a new query pack, see [Query packs in Azure Monitor Logs](query-packs.md).-
-[![Screenshot that shows the Save as query dialog.](media/save-query/save-query-dialog.png)](media/save-query/save-query-dialog.png#lightbox)
+<!-- convertborder later -->
## Edit a query You might want to edit a query that you've already saved. You might want to change the query itself or modify any of its properties. After you open an existing query in Log Analytics, you can edit it by selecting **Edit query details** from the **Save** dropdown. Now you can save the edited query with the same properties or modify any properties before saving.
azure-monitor Scope https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/logs/scope.md
When you run a [log query](../logs/log-query-overview.md) in [Log Analytics in t
[!INCLUDE [log-analytics-query-permissions](../../../includes/log-analytics-query-permissions.md)] ## Query scope
-The query scope defines the records that are evaluated by the query. This will usually include all records in a single Log Analytics workspace or Application Insights application. Log Analytics also allows you to set a scope for a particular monitored Azure resource. This allows a resource owner to focus only on their data, even if that resource writes to multiple workspaces.
+The query scope defines the records that the query evaluates. This definition will usually include all records in a single Log Analytics workspace or Application Insights application. Log Analytics also allows you to set a scope for a particular monitored Azure resource. This allows a resource owner to focus only on their data, even if that resource writes to multiple workspaces.
The scope is always displayed at the top left of the Log Analytics window. An icon indicates whether the scope is a Log Analytics workspace or an Application Insights application. No icon indicates another Azure resource.
-![Scope displayed in portal](media/scope/scope.png)
-The scope is determined by the method you use to start Log Analytics, and in some cases you can change the scope by clicking on it. The following table lists the different types of scope used and different details for each.
+The method you use to start Log Analytics determines the scope, and in some cases you can change the scope by clicking on it. The following table lists the different types of scope used and different details for each.
> [!IMPORTANT] > If you're using a workspace-based application in Application Insights, then its data is stored in a Log Analytics workspace with all other log data. For backward compatibility you will get the classic Application Insights experience when you select the application as your scope. To see this data in the Log Analytics workspace, set the scope to the workspace.
The scope is determined by the method you use to start Log Analytics, and in som
|:|:|:|:| | Log Analytics workspace | All records in the Log Analytics workspace. | Select **Logs** from the **Azure Monitor** menu or the **Log Analytics workspaces** menu. | Can change scope to any other resource type. | | Application Insights application | All records in the Application Insights application. | Select **Logs** from the **Application Insights** menu for the application. | Can only change scope to another Application Insights application. |
-| Resource group | Records created by all resources in the resource group. May include data from multiple Log Analytics workspaces. | Select **Logs** from the resource group menu. | Cannot change scope.|
-| Subscription | Records created by all resources in the subscription. May include data from multiple Log Analytics workspaces. | Select **Logs** from the subscription menu. | Cannot change scope. |
-| Other Azure resources | Records created by the resource. May include data from multiple Log Analytics workspaces. | Select **Logs** from the resource menu.<br>OR<br>Select **Logs** from the **Azure Monitor** menu and then select a new scope. | Can only change scope to same resource type. |
+| Resource group | Records created by all resources in the resource group. Can include data from multiple Log Analytics workspaces. | Select **Logs** from the resource group menu. | Can't change scope.|
+| Subscription | Records created by all resources in the subscription. Can include data from multiple Log Analytics workspaces. | Select **Logs** from the subscription menu. | Can't change scope. |
+| Other Azure resources | Records created by the resource. Can include data from multiple Log Analytics workspaces. | Select **Logs** from the resource menu.<br>OR<br>Select **Logs** from the **Azure Monitor** menu and then select a new scope. | Can only change scope to same resource type. |
### Limitations when scoped to a resource
When the query scope is a Log Analytics workspace or an Application Insights app
- Query explorer - New alert rule
-You can't use the following commands in a query when scoped to a resource since the query scope will already include any workspaces with data for that resource or set of resources:
+You can't use the following commands in a query when scoped to a resource since the query scope already includes any workspaces with data for that resource or set of resources:
- [app](../logs/app-expression.md) - [workspace](../logs/workspace-expression.md) ## Query scope limits
-Setting the scope to a resource or set of resources is a particularly powerful feature of Log Analytics since it allows you to automatically consolidate distributed data in a single query. It can significantly affect performance though if data needs to be retrieved from workspaces across multiple Azure regions.
+Setting the scope to a resource or set of resources is a powerful feature of Log Analytics since it allows you to automatically consolidate distributed data in a single query. It can significantly affect performance though if data needs to be retrieved from workspaces across multiple Azure regions.
Log Analytics helps protect against excessive overhead from queries that span workspaces in multiple regions by issuing a warning or error when a certain number of regions are being used.
-Your query will receive a warning if the scope includes workspaces in 5 or more regions. it will still run, but it may take excessive time to complete.
+Your query receives a warning if the scope includes workspaces in 5 or more regions. it will still run, but it might take excessive time to complete.
+<!-- convertborder later -->
-![Query warning](media/scope/query-warning.png)
-
-Your query will be blocked from running if the scope includes workspaces in 20 or more regions. In this case you will be prompted to reduce the number of workspace regions and attempt to run the query again. The dropdown will display all of the regions in the scope of the query, and you should reduce the number of regions before attempting to run the query again.
-
-![Query failed](media/scope/query-failed.png)
+Your query will be blocked from running if the scope includes workspaces in 20 or more regions. In this case, you'll be prompted to reduce the number of workspace regions and attempt to run the query again. The dropdown will display all of the regions in the scope of the query, and you should reduce the number of regions before attempting to run the query again.
+<!-- convertborder later -->
## Time range
The time range specifies the set of records that are evaluated for the query bas
Set the time range by selecting it from the time picker at the top of the Log Analytics window. You can select a predefined period or select **Custom** to specify a specific time range.-
-![Time picker](media/scope/time-picker.png)
+<!-- convertborder later -->
If you set a filter in the query that uses the standard time column as shown in the table above, the time picker changes to **Set in query**, and the time picker is disabled. In this case, it's most efficient to put the filter at the top of the query so that any subsequent processing only needs to work with the filtered records.
+<!-- convertborder later -->
-![Filtered query](media/scope/query-filtered.png)
-
-If you use the [workspace](../logs/workspace-expression.md) or [app](../logs/app-expression.md) command to retrieve data from another workspace or classic application, the time picker may behave differently. If the scope is a Log Analytics workspace and you use **app**, or if the scope is a classic Application Insights application and you use **workspace**, then Log Analytics may not understand that the column used in the filter should determine the time filter.
+If you use the [workspace](../logs/workspace-expression.md) or [app](../logs/app-expression.md) command to retrieve data from another workspace or classic application, the time picker might behave differently. If the scope is a Log Analytics workspace and you use **app**, or if the scope is a classic Application Insights application and you use **workspace**, then Log Analytics might not understand that the column used in the filter should determine the time filter.
In the following example, the scope is set to a Log Analytics workspace. The query uses **workspace** to retrieve data from another Log Analytics workspace. The time picker changes to **Set in query** because it sees a filter that uses the expected **TimeGenerated** column.-
-![Query with workspace](media/scope/query-workspace.png)
+<!-- convertborder later -->
If the query uses **app** to retrieve data from a classic Application Insights application though, Log Analytics doesn't recognize the **timestamp** column in the filter, and the time picker remains unchanged. In this case, both filters are applied. In the example, only records created in the last 24 hours are included in the query even though it specifies 7 days in the **where** clause.-
-![Query with app](media/scope/query-app.png)
+<!-- convertborder later -->
## Next steps
azure-monitor Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/policy-reference.md
Title: Built-in policy definitions for Azure Monitor description: Lists Azure Policy built-in policy definitions for Azure Monitor. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-monitor Profiler Troubleshooting https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/profiler/profiler-troubleshooting.md
Search for trace messages and custom events sent by Profiler to your Application
1. In your Application Insights resource, select **Search** from the top menu.
- :::image type="content" source="./media/profiler-troubleshooting/search-trace-messages.png" alt-text="Screenshot that shows selecting the Search button from the Application Insights resource.":::
+ :::image type="content" source="./media/profiler-troubleshooting/search-trace-messages.png" lightbox="./media/profiler-troubleshooting/search-trace-messages.png" alt-text="Screenshot that shows selecting the Search button from the Application Insights resource.":::
1. Use the following search string to find the relevant data:
Search for trace messages and custom events sent by Profiler to your Application
stopprofiler OR startprofiler OR upload OR ServiceProfilerSample ```
- :::image type="content" source="./media/profiler-troubleshooting/search-results.png" alt-text="Screenshot that shows the search results from aforementioned search string.":::
+ :::image type="content" source="./media/profiler-troubleshooting/search-results.png" lightbox="./media/profiler-troubleshooting/search-results.png" alt-text="Screenshot that shows the search results from aforementioned search string.":::
The preceding search results include two examples of searches from two AI resources:
For Profiler to work properly, make sure:
If **ApplicationInsightsProfiler3** doesn't show up, restart your App Service application.
- :::image type="content" source="./media/profiler-troubleshooting/profiler-web-job.png" alt-text="Screenshot that shows the WebJobs pane, which displays the name, status, and last runtime of jobs.":::
+ :::image type="content" source="./media/profiler-troubleshooting/profiler-web-job.png" lightbox="./media/profiler-troubleshooting/profiler-web-job.png" alt-text="Screenshot that shows the WebJobs pane, which displays the name, status, and last runtime of jobs.":::
1. To view the details of the WebJob, including the log, select the **ApplicationInsightsProfiler3** link. The **Continuous WebJob Details** pane opens.
- :::image type="content" source="./media/profiler-troubleshooting/profiler-web-job-log.png" alt-text="Screenshot that shows the Continuous WebJob Details pane.":::
+ :::image type="content" source="./media/profiler-troubleshooting/profiler-web-job-log.png" lightbox="./media/profiler-troubleshooting/profiler-web-job-log.png" alt-text="Screenshot that shows the Continuous WebJob Details pane.":::
If Profiler still isn't working for you, download the log and [submit an Azure support ticket](https://azure.microsoft.com/support/).
It ends like `https://<kudu-url>/DiagnosticServices`.
A status page appears similar to the following example.
-![Screenshot that shows the Diagnostic Services status page.](../app/media/diagnostic-services-site-extension/status-page.png)
> [!NOTE] > Codeless installation of Application Insights Profiler follows the .NET Core support policy. For more information about supported runtimes, see [.NET Core support policy](https://dotnet.microsoft.com/platform/support/policy/dotnet-core).
azure-monitor Monitor Virtual Machine Analyze https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-monitor/vm/monitor-virtual-machine-analyze.md
Access the single machine analysis experience from the **Monitoring** section of
|:|:| | Overview page | Select the **Monitoring** tab to display alerts, [platform metrics](../essentials/data-platform-metrics.md), and other monitoring information for the virtual machine host. You can see the number of active alerts on the tab. In the **Monitoring** tab, you get a quick view of:<br><br>**Alerts:** the alerts fired in the last 24 hours, with some important statistics about those alerts. If you do not have any alerts set up for this VM, there is a link to help you quickly create new alerts for your VM.<br><br>**Key metrics:** the trend over different time periods for important metrics, such as CPU, network, and disk. Because these are host metrics though, counters from the guest operating system such as memory aren't included. Select a graph to work with this data in [metrics explorer](../essentials/analyze-metrics.md) where you can perform different aggregations, and add more counters for analysis. | | Activity log | See [activity log](../essentials/activity-log.md#view-the-activity-log) entries filtered for the current virtual machine. Use this log to view the recent activity of the machine, such as any configuration changes and when it was stopped and started.
-| Insights | Displays VM insights views if If the VM is enabled for [VM insights](../vm/vminsights-overview.md).<br><br>Select the **Performance** tab to view trends of critical performance counters over different periods of time. When you open VM insights from the virtual machine menu, you also have a table with detailed metrics for each disk. For details on how to use the Map view for a single machine, see [Chart performance with VM insights](vminsights-performance.md#view-performance-directly-from-an-azure-vm).<br><br>If *processes and dependencies* is enabled for the VM, select the **Map** tab to view the running processes on the machine, dependencies on other machines, and external processes. For details on how to use the Map view for a single machine, see [Use the Map feature of VM insights to understand application components](vminsights-maps.md#view-a-map-from-a-vm).<br><br>If the VM is not enabled for VM insights, it offers the option to enable VM insights. |
+| Insights | Displays VM insights views if the VM is enabled for [VM insights](../vm/vminsights-overview.md).<br><br>Select the **Performance** tab to view trends of critical performance counters over different periods of time. When you open VM insights from the virtual machine menu, you also have a table with detailed metrics for each disk. For details on how to use the Map view for a single machine, see [Chart performance with VM insights](vminsights-performance.md#view-performance-directly-from-an-azure-vm).<br><br>If *processes and dependencies* is enabled for the VM, select the **Map** tab to view the running processes on the machine, dependencies on other machines, and external processes. For details on how to use the Map view for a single machine, see [Use the Map feature of VM insights to understand application components](vminsights-maps.md#view-a-map-from-a-vm).<br><br>If the VM is not enabled for VM insights, it offers the option to enable VM insights. |
| Alerts | View [alerts](../alerts/alerts-overview.md) for the current virtual machine. These alerts only use the machine as the target resource, so there might be other alerts associated with it. You might need to use the **Alerts** option in the Azure Monitor menu to view alerts for all resources. For details, see [Monitor virtual machines with Azure Monitor - Alerts](monitor-virtual-machine-alerts.md). | | Metrics | Open metrics explorer with the scope set to the machine. This option is the same as selecting one of the performance charts from the **Overview** page except that the metric isn't already added. | | Diagnostic settings | Enable and configure the [diagnostics extension](../agents/diagnostics-extension-overview.md) for the current virtual machine. This option is different than the **Diagnostic settings** option for other Azure resources. This is a [legacy agent](monitor-virtual-machine-agent.md#legacy-agents) that has been replaced by the [Azure Monitor agent](monitor-virtual-machine-agent.md). |
azure-netapp-files Configure Application Volume Group Sap Hana Api https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/configure-application-volume-group-sap-hana-api.md
The following list describes all the possible volume types for application volum
## Prepare your environment
-1. **Networking:** You need to decide on the networking architecture. To use Azure NetApp Files, you need to create create a VNet that will host a delegated subnet for the Azure NetApp Files storage endpoints (IPs). To ensure that the size of this subnet is large enough, see [Considerations about delegating a subnet to Azure NetApp Files](azure-netapp-files-delegate-subnet.md#considerations).
+1. **Networking:** You need to decide on the networking architecture. To use Azure NetApp Files, you need to create a VNet that will host a delegated subnet for the Azure NetApp Files storage endpoints (IPs). To ensure that the size of this subnet is large enough, see [Considerations about delegating a subnet to Azure NetApp Files](azure-netapp-files-delegate-subnet.md#considerations).
1. Create a VNet. 2. Create a virtual machine (VM) subnet and delegated subnet for Azure NetApp Files. 1. **Storage Account and Capacity Pool:** A storage account is the entry point to consume Azure NetApp Files. At least one storage account needs to be created. Within a storage account, a capacity pool is the logical unit to create volumes. Application volume groups require a capacity pool with a manual QoS. It should be created with a size and service level that meets your HANA requirements.
azure-netapp-files Convert Nfsv3 Nfsv41 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/convert-nfsv3-nfsv41.md
This section shows you how to convert the NFSv4.1 volume to NFSv3.
`mount -v | grep /path/to/vol1` `vol1:/path/to/vol1 on /path type nfs (rw,intr,tcp,nfsvers=3,rsize=16384,wsize=16384,addr=192.168.1.1)`.
-7. Change the read-only export policy back to the original export policy. See See [Configure export policy for NFS or dual-protocol volumes](azure-netapp-files-configure-export-policy.md).
+7. Change the read-only export policy back to the original export policy. See [Configure export policy for NFS or dual-protocol volumes](azure-netapp-files-configure-export-policy.md).
8. Verify access using root and non-root users.
azure-netapp-files Create Active Directory Connections https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/create-active-directory-connections.md
Several features of Azure NetApp Files require that you have an Active Directory
This feature is used for installing SQL Server in certain scenarios where a non-administrator AD DS domain account must temporarily be granted elevated security privilege. >[!NOTE]
- > Using the Security privilege users feature relies on the [SMB Continuous Availability Shares feature](azure-netapp-files-create-volumes-smb.md#continuous-availability). SMB Continuous Availability is **not** supported on custom applications. It is is only supported for workloads using Citrix App Laying, [FSLogix user profile containers](../virtual-desktop/create-fslogix-profile-container.md), and Microsoft SQL Server (not Linux SQL Server).
+ > Using the Security privilege users feature relies on the [SMB Continuous Availability Shares feature](azure-netapp-files-create-volumes-smb.md#continuous-availability). SMB Continuous Availability is **not** supported on custom applications. It is only supported for workloads using Citrix App Laying, [FSLogix user profile containers](../virtual-desktop/create-fslogix-profile-container.md), and Microsoft SQL Server (not Linux SQL Server).
> [!IMPORTANT] > Using the **Security privilege users** feature requires that you submit a waitlist request through the **[Azure NetApp Files SMB Continuous Availability Shares Public Preview waitlist submission page](https://aka.ms/anfsmbcasharespreviewsignup)**. Wait for an official confirmation email from the Azure NetApp Files team before using this feature.
azure-netapp-files Cross Region Replication Display Health Status https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/cross-region-replication-display-health-status.md
You can view replication status on the source volume or the destination volume.
This is the state after you break the peering relationship. The destination volume is `ΓÇÿRWΓÇÖ` and snapshots are present. * **Relationship status** ΓÇô Shows one of the following values: * *Idle*:
- No transfer operation is in progress and future transfers are not disabled.
+ No transfer operation is in progress and future transfers aren't disabled.
* *Transferring*:
- A transfer operation is in progress and future transfers are not disabled.
+ A transfer operation is in progress and future transfers aren't disabled.
* **Replication schedule** ΓÇô Shows how frequently incremental mirroring updates will be performed when the initialization (baseline copy) is complete. * **Total progress** ΓÇô Shows the total number of cumulative bytes transferred over the lifetime of the relationship. This amount is the actual bytes transferred, and it might differ from the logical space that the source and destination volumes report.
You can view replication status on the source volume or the destination volume.
## Set alert rules to monitor replication
-Follow the following steps to create [alert rules in Azure Monitor](../azure-monitor/alerts/alerts-overview.md) to help you monitor the status of cross-region replication:
+Create [alert rules in Azure Monitor](../azure-monitor/alerts/alerts-overview.md) to help you monitor the status of cross-region replication:
-1. From Azure Monitor, select **Alerts**.
-2. From the Alerts window, select the **Create** dropdown and select **Create new alert rule**.
-3. From the Scope tab of the Create an Alert Rule page, select **Select scope**. The **Select a Resource** page appears.
-4. From the Resource tab, find the **Volumes** resource type.
-5. From the Condition tab, select **Add condition**. From there, find a signal called ΓÇ£**is volume replication healthy**ΓÇ¥.
-6. There you'll see **Condition of the relationship, 1 or 0** and the **Configure Signal Logic** window is displayed.
-7. To check if the replication is _unhealthy_:
- * Set **Operator** to `Less than`.
- * Set **Aggregation type** to `Average`.
- * Set **Threshold** value to `1`.
- * Set **Unit** to `Count`.
-8. To check if the replication is _healthy_:
- * Set **Operator** to `Greater than or equal to`.
- * Set **Aggregation** type to `Average`.
- * Set **Threshold** value to `1`.
- * Set **Unit** to `Count`.
-9. Select **Review + create**. The alert rule is ready for use.
+1. In Azure Monitor, select **Alerts**.
+2. From the **Alerts** window, select the **Create** dropdown then **Alert rule**.
+3. From the **Scope** tab of the **Create an Alert Rule** page, choose **Select scope**. The **Select a Resource** page appears.
+4. From the **Browse** tab, enter "Volumes" in the **Search to filter items...** field.
+5. Select the target volume you'd like to monitor and select **Apply**.
+6. From the **Condition** tab, use the **Signal name** dropdown to select **See all signals**. Identify the **Volume replication lag time** signal then select **Apply**.
+7. Confirm **Greater than** is selected for the **Operator** field.
+8. For the **Threshold** value field, enter the number of seconds equal to your replication schedule plus 20%. For example:
+ * If your replication schedule is 10 minutes, enter 720 (10 minutes * 60 seconds * 1.2).
+ * If your replication schedule is hourly, enter 4,320 (60 minutes * 60 seconds * 1.2).
+ * If your replication schedule is daily, enter 103,680 (24 hours * 60 minutes * 60 seconds * 1.2).
+9. Select **Review + create**. The alert rule is ready for use.
:::image type="content" source="../media/azure-netapp-files/alert-config-signal-logic.png" alt-text="Screenshot of the Azure interface that shows the configure signal logic step with a backdrop of the Create alert rule page." lightbox="../media/azure-netapp-files/alert-config-signal-logic.png":::
azure-netapp-files Understand Guidelines Active Directory Domain Service Site https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/understand-guidelines-active-directory-domain-service-site.md
In addition to multiple domain controllers assigned to the AD DS site configured
>[!NOTE] >It's essential that all the domain controllers and subnets assigned to the Azure NetApp Files AD DS site must be well connected (less than 10ms RTT latency) and reachable by the network interfaces used by the Azure NetApp Files volumes. >
->If you're using using Standard network features, you should ensure that any User Defined Routes (UDRs) or Network Security Group (NSG) rules do not block Azure NetApp Files network communication with AD DS domain controllers assigned to the Azure NetApp Files AD DS site.
+>If you're using Standard network features, you should ensure that any User Defined Routes (UDRs) or Network Security Group (NSG) rules do not block Azure NetApp Files network communication with AD DS domain controllers assigned to the Azure NetApp Files AD DS site.
> >If you're using Network Virtual Appliances or firewalls (such as Palo Alto Networks or Fortinet firewalls), they must be configured to not block network traffic between Azure NetApp Files and the AD DS domain controllers and subnets assigned to the Azure NetApp Files AD DS site.
azure-netapp-files Use Availability Zones https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-netapp-files/use-availability-zones.md
Latency is subject to availability zone latency for within availability zone acc
## Azure regions with availability zones
-For a list of regions that that currently support availability zones, see [Azure regions with availability zone support](../reliability/availability-zones-service-support.md).
+For a list of regions that currently support availability zones, see [Azure regions with availability zone support](../reliability/availability-zones-service-support.md).
## Next steps
azure-portal Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-portal/policy-reference.md
Title: Built-in policy definitions for Azure portal description: Lists Azure Policy built-in policy definitions for Azure portal. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-resource-manager Bicep Cli https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-cli.md
Title: Bicep CLI commands and overview
description: Describes the commands that you can use in the Bicep CLI. These commands include building Azure Resource Manager templates from Bicep. Previously updated : 10/13/2023 Last updated : 11/03/2023 # Bicep CLI commands
The module with reference "br:exampleregistry.azurecr.io/bicep/modules/storage:v
When you get this error, either run the `build` command without the `--no-restore` switch or run `bicep restore` first.
-To use the `--no-restore` switch, you must have Bicep CLI version **0.4.1008 or later**.
+To use the `--no-restore` switch, you must have [Bicep CLI version 0.4.X or higher](./install.md).
## build-params
The `publish` command adds a module to a registry. The Azure container registry
After publishing the file to the registry, you can [reference it in a module](modules.md#file-in-registry).
-To use the publish command, you must have Bicep CLI version **0.4.1008 or later**. To use the `--documentationUri`/`-d` parameter, you must have Bicep CLI version **0.14.46 or later**.
+To use the publish command, you must have [Bicep CLI version 0.4.X or higher](./install.md). To use the `--documentationUri`/`-d` parameter, you must have [Bicep CLI version 0.14.X or higher](./install.md).
To publish a module to a registry, use:
When your Bicep file uses modules that are published to a registry, the `restore
To restore external modules to the local cache, the account must have the correct profile and permissions to access the registry. You can configure the profile and credential precedence for authenticating to the registry in the [Bicep config file](./bicep-config-modules.md#configure-profiles-and-credentials).
-To use the restore command, you must have Bicep CLI version **0.4.1008 or later**. This command is currently only available when calling the Bicep CLI directly. It's not currently available through the Azure CLI command.
+To use the restore command, you must have [Bicep CLI version 0.4.X or higher](./install.md). This command is currently only available when calling the Bicep CLI directly. It's not currently available through the Azure CLI command.
To manually restore the external modules for a file, use:
az bicep version
The command shows the version number. ```azurecli
-Bicep CLI version 0.20.4 (c9422e016d)
+Bicep CLI version 0.22.6 (d62b94db31)
``` To call this command directly through the Bicep CLI, use:
azure-resource-manager Bicep Functions Date https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-functions-date.md
Title: Bicep functions - date
description: Describes the functions to use in a Bicep file to work with dates. Previously updated : 10/12/2023 Last updated : 11/03/2023 # Date functions for Bicep
An ISO 8601 datetime string.
### Remarks
-This function requires **Bicep version 0.5.6 or later**.
+This function requires [Bicep CLI version 0.5.X or higher](./install.md).
### Example
An integer that represents the number of seconds from midnight on January 1, 197
### Remarks
-This function requires **Bicep version 0.5.6 or later**.
+This function requires [Bicep CLI version 0.5.X or higher](./install.md).
### Examples
azure-resource-manager Bicep Functions Files https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-functions-files.md
Title: Bicep functions - files
description: Describes the functions to use in a Bicep file to load content from a file. Previously updated : 04/21/2023 Last updated : 11/03/2023 # File functions for Bicep
Namespace: [sys](bicep-functions.md#namespaces-for-functions).
Use this function when you have binary content you would like to include in deployment. Rather than manually encoding the file to a base64 string and adding it to your Bicep file, load the file with this function. The file is loaded when the Bicep file is compiled to a JSON template. You can't use variables in the file path because they haven't been resolved when compiling to the template. During deployment, the JSON template contains the contents of the file as a hard-coded string.
-This function requires **Bicep version 0.4.412 or later**.
+This function requires [Bicep CLI version 0.4.X or higher](./install.md).
The maximum allowed size of the file is **96 Kb**.
Use this function when you have JSON content or minified JSON content that is st
In VS Code, the properties of the loaded object are available intellisense. For example, you can create a file with values to share across many Bicep files. An example is shown in this article.
-This function requires **Bicep version 0.7.4 or later**.
+This function requires [Bicep CLI version 0.7.X or higher](./install.md).
The maximum allowed size of the file is **1,048,576 characters**, including line endings.
Use this function when you have YAML content or minified YAML content that is st
In VS Code, the properties of the loaded object are available intellisense. For example, you can create a file with values to share across many Bicep files. An example is shown in this article.
-This function requires **Bicep version >0.16.2**.
+This function requires [Bicep CLI version 0.16.X or higher](./install.md).
The maximum allowed size of the file is **1,048,576 characters**, including line endings.
Use this function when you have content that is stored in a separate file. You c
Use the [`loadJsonContent()`](#loadjsoncontent) function to load JSON files.
-This function requires **Bicep version 0.4.412 or later**.
+This function requires [Bicep CLI version 0.4.X or higher](./install.md).
The maximum allowed size of the file is **131,072 characters**, including line endings.
azure-resource-manager Bicep Functions Lambda https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-functions-lambda.md
Title: Bicep functions - lambda description: Describes the lambda functions to use in a Bicep file.- - Previously updated : 03/15/2023 Last updated : 11/03/2023 # Lambda functions for Bicep
This article describes the lambda functions to use in Bicep. [Lambda expressions
``` > [!NOTE]
-> The lambda functions are only supported in Bicep CLI version 0.10.61 or newer.
+> The lambda functions are only supported in [Bicep CLI version 0.10.X or higher](./install.md).
## Limitations
azure-resource-manager Bicep Functions Resource https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-functions-resource.md
Previously updated : 06/22/2023 Last updated : 11/03/2023 # Resource functions for Bicep
You can call a list function for any resource type with an operation that starts
The syntax for this function varies by the name of the list operation. The returned values also vary by operation. Bicep doesn't currently support completions and validation for `list*` functions.
-With **Bicep version 0.4.412 or later**, you call the list function by using the [accessor operator](operators-access.md#function-accessor). For example, `storageAccount.listKeys()`.
+With [Bicep CLI version 0.4.X or higher](./install.md), you call the list function by using the [accessor operator](operators-access.md#function-accessor). For example, `storageAccount.listKeys()`.
A [namespace qualifier](bicep-functions.md#namespaces-for-functions) isn't needed because the function is used with a resource type.
The possible uses of `list*` are shown in the following table.
| Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces | [listConnectionInfo](/rest/api/cosmos-db-resource-provider/2023-03-15-preview/notebook-workspaces/list-connection-info?tabs=HTTP) | | Microsoft.DomainRegistration | [listDomainRecommendations](/rest/api/appservice/domains/listrecommendations) | | Microsoft.DomainRegistration/topLevelDomains | [listAgreements](/rest/api/appservice/topleveldomains/listagreements) |
-| Microsoft.EventGrid/domains | [listKeys](/rest/api/eventgrid/controlplane-version2022-06-15/domains/list-shared-access-keys) |
-| Microsoft.EventGrid/topics | [listKeys](/rest/api/eventgrid/controlplane-version2022-06-15/topics/list-shared-access-keys) |
+| Microsoft.EventGrid/domains | [listKeys](/rest/api/eventgrid/controlplane/domains/list-shared-access-keys) |
+| Microsoft.EventGrid/topics | [listKeys](/rest/api/eventgrid/controlplane/topics/list-shared-access-keys) |
| Microsoft.EventHub/namespaces/authorizationRules | [listkeys](/rest/api/eventhub) | | Microsoft.EventHub/namespaces/disasterRecoveryConfigs/authorizationRules | [listkeys](/rest/api/eventhub) | | Microsoft.EventHub/namespaces/eventhubs/authorizationRules | [listkeys](/rest/api/eventhub) |
The possible uses of `list*` are shown in the following table.
| Microsoft.Logic/workflows/versions/triggers | [listCallbackUrl](/rest/api/logic/workflowversions/listcallbackurl) | | Microsoft.MachineLearning/webServices | [listkeys](/rest/api/machinelearning/webservices/listkeys) | | Microsoft.MachineLearning/Workspaces | listworkspacekeys |
-| Microsoft.MachineLearningServices/workspaces/computes | [listKeys](/rest/api/azureml/2023-04-01/compute/list-keys) |
-| Microsoft.MachineLearningServices/workspaces/computes | [listNodes](/rest/api/azureml/2023-04-01/compute/list-nodes) |
-| Microsoft.MachineLearningServices/workspaces | [listKeys](/rest/api/azureml/2023-04-01/workspaces/list-keys) |
+| Microsoft.MachineLearningServices/workspaces/computes | [listKeys](/rest/api/azureml/compute/list-keys) |
+| Microsoft.MachineLearningServices/workspaces/computes | [listNodes](/rest/api/azureml/compute/list-nodes) |
+| Microsoft.MachineLearningServices/workspaces | [listKeys](/rest/api/azureml/workspaces/list-keys) |
| Microsoft.Maps/accounts | [listKeys](/rest/api/maps-management/accounts/listkeys) | | Microsoft.Media/mediaservices/assets | [listContainerSas](/rest/api/media/assets/listcontainersas) | | Microsoft.Media/mediaservices/assets | [listStreamingLocators](/rest/api/media/assets/liststreaminglocators) |
azure-resource-manager Bicep Functions String https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-functions-string.md
The output from the preceding example with the default values is:
| firstOutput | String | "one,two,three" | | secondOutput | String | "one;two;three" |
-This function requires **Bicep version 0.8.2 or later**.
+This function requires [Bicep CLI version 0.8.X or higher](./install.md).
<a id="json"></a>
azure-resource-manager Bicep Import https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/bicep-import.md
Title: Imports in Bicep
description: Describes how to import shared functionality and namespaces in Bicep. Previously updated : 09/21/2023 Last updated : 11/03/2023 # Imports in Bicep
This article describes the syntax you use to export and import shared functional
## Exporting types, variables and functions (Preview) > [!NOTE]
-> [Bicep version 0.23 or newer](./install.md) is required to use this feature. The experimental feature `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features). For user-defined functions, the experimental feature `userDefinedFunctions` must also be enabled.
+> [Bicep CLI version 0.23.X or higher](./install.md) is required to use this feature. The experimental feature `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features). For user-defined functions, the experimental feature `userDefinedFunctions` must also be enabled.
The `@export()` decorator is used to indicate that a given statement can be imported by another file. This decorator is only valid on type, variable and function statements. Variable statements marked with `@export()` must be compile-time constants.
The syntax for exporting functionality for use in other Bicep files is:
## Import types, variables and functions (Preview) > [!NOTE]
-> [Bicep version 0.23.X or newer](./install.md) is required to use this feature. The experimental feature `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features). For user-defined functions, the experimental feature `userDefinedFunctions` must also be enabled.
+> [Bicep CLI version 0.23.X or higher](./install.md) is required to use this feature. The experimental feature `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features). For user-defined functions, the experimental feature `userDefinedFunctions` must also be enabled.
The syntax for importing functionality from another Bicep file is:
azure-resource-manager Data Types https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/data-types.md
Title: Data types in Bicep
description: Describes the data types that are available in Bicep Previously updated : 07/07/2023 Last updated : 11/03/2023 # Data types in Bicep
Within a Bicep, you can use these data types:
## Arrays
-Arrays start with a left bracket (`[`) and end with a right bracket (`]`). In Bicep, an array can be declared in single line or multiple lines. Commas (`,`) are used between values in single-line declarations, but not used in multiple-line declarations, You can mix and match single-line and multiple-line declarations. The multiple-line declaration requires **Bicep version 0.7.4 or later**.
+Arrays start with a left bracket (`[`) and end with a right bracket (`]`). In Bicep, an array can be declared in single line or multiple lines. Commas (`,`) are used between values in single-line declarations, but not used in multiple-line declarations, You can mix and match single-line and multiple-line declarations. The multiple-line declaration requires [Bicep CLI version 0.7.X or higher](./install.md).
```bicep var multiLineArray = [
Floating point, decimal or binary formats aren't currently supported.
## Objects
-Objects start with a left brace (`{`) and end with a right brace (`}`). In Bicep, an object can be declared in single line or multiple lines. Each property in an object consists of key and value. The key and value are separated by a colon (`:`). An object allows any property of any type. Commas (`,`) are used between properties for single-line declarations, but not used between properties for multiple-line declarations. You can mix and match single-line and multiple-line declarations. The multiple-line declaration requires **Bicep version 0.7.4 or later**.
+Objects start with a left brace (`{`) and end with a right brace (`}`). In Bicep, an object can be declared in single line or multiple lines. Each property in an object consists of key and value. The key and value are separated by a colon (`:`). An object allows any property of any type. Commas (`,`) are used between properties for single-line declarations, but not used between properties for multiple-line declarations. You can mix and match single-line and multiple-line declarations. The multiple-line declaration requires [Bicep CLI version 0.7.X or higher](./install.md).
```bicep param singleLineObject object = {name: 'test name', id: '123-abc', isCurrent: true, tier: 1}
azure-resource-manager Deploy Cli https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/deploy-cli.md
Title: Deploy resources with Azure CLI and Bicep files | Microsoft Docs description: Use Azure Resource Manager and Azure CLI to deploy resources to Azure. The resources are defined in a Bicep file. Previously updated : 10/10/2023 Last updated : 11/03/2023
The evaluation of parameters follows a sequential order, meaning that if a value
Rather than passing parameters as inline values in your script, you might find it easier to use a parameters file, either a [Bicep parameters file](#bicep-parameter-files) or a [JSON parameters file](#json-parameter-files) that contains the parameter values. The parameters file must be a local file. External parameters files aren't supported with Azure CLI. For more information about the parameters file, see [Create Resource Manager parameters file](./parameter-files.md).
-With Azure CLI version 2.53.0 or later, and Bicep CLI version 0.22.6 or later, you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there's no need to provide the `--template-file` switch when specifying a Bicep parameter file for the `--parameters` switch. Including the `--template-file` switch will result in an "Only a .bicep template is allowed with a .bicepparam file" error.
+With Azure CLI version 2.53.0 or later, and [Bicep CLI version 0.22.X or higher](./install.md), you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there's no need to provide the `--template-file` switch when specifying a Bicep parameter file for the `--parameters` switch. Including the `--template-file` switch will result in an "Only a .bicep template is allowed with a .bicepparam file" error.
The following example shows a parameters file named _storage.bicepparam_. The file is in the same directory where the command is run.
azure-resource-manager Deploy Powershell https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/deploy-powershell.md
Title: Deploy resources with PowerShell and Bicep
description: Use Azure Resource Manager and Azure PowerShell to deploy resources to Azure. The resources are defined in a Bicep file. Previously updated : 06/05/2023 Last updated : 11/03/2023 # Deploy resources with Bicep and Azure PowerShell
New-AzResourceGroupDeployment -ResourceGroupName testgroup `
Rather than passing parameters as inline values in your script, you might find it easier to use a parameters file, either a `.bicepparam` file or a JSON parameters file, that contains the parameter values. The Bicep parameters file must be a local file.
-With Azure PowerShell version 10.4.0 or later, and Bicep CLI version 0.22.6 or later, you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there is no need to provide the `-TemplateFile` switch when specifying a Bicep parameter file for the `-TemplateParameterFile` switch.
+With Azure PowerShell version 10.4.0 or later, and [Bicep CLI version 0.22.X or higher](./install.md), you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there is no need to provide the `-TemplateFile` switch when specifying a Bicep parameter file for the `-TemplateParameterFile` switch.
The following example shows a parameters file named _storage.bicepparam_. The file is in the same directory where the command is run.
azure-resource-manager Deployment Stacks https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/deployment-stacks.md
Currently not implemented.
You get a warning similar to the following: ```warning
-The deployment stack 'myStack' you're trying to create already already exists in the current subscription/management group/resource group. Do you want to overwrite it? Detaching: resources, resourceGroups (Y/N)
+The deployment stack 'myStack' you're trying to create already exists in the current subscription/management group/resource group. Do you want to overwrite it? Detaching: resources, resourceGroups (Y/N)
``` For more information, see [Create deployment stacks](#create-deployment-stacks).
azure-resource-manager File https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/file.md
Title: Bicep file structure and syntax
description: Describes the structure and properties of a Bicep file using declarative syntax. Previously updated : 09/11/2023 Last updated : 11/03/2023 # Understand the structure and syntax of Bicep files
The preceding example is equivalent to the following JSON.
## Multiple-line declarations
-You can now use multiple lines in function, array and object declarations. This feature requires **Bicep version 0.7.4 or later**.
+You can now use multiple lines in function, array and object declarations. This feature requires [Bicep CLI version 0.7.X or higher](./install.md).
In the following example, the `resourceGroup()` definition is broken into multiple lines.
azure-resource-manager Install https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/install.md
Title: Set up Bicep development and deployment environments description: How to configure Bicep development and deployment environments Previously updated : 09/21/2023 Last updated : 11/03/2023
bicep --help
``` > [!NOTE]
-> The installation of Bicep CLI version 0.16 or newer does not need Gatekeeper exception. However, [nightly builds](#install-the-nightly-builds) of the Bicep CLI still require the exception.
+> The installation of [Bicep CLI version 0.16.X or higher](./install.md) does not need Gatekeeper exception. However, [nightly builds](#install-the-nightly-builds) of the Bicep CLI still require the exception.
### Windows
azure-resource-manager Loops https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/loops.md
Title: Iterative loops in Bicep
description: Use loops to iterate over collections in Bicep Previously updated : 10/17/2023 Last updated : 11/03/2023 # Iterative loops in Bicep
resource share 'Microsoft.Storage/storageAccounts/fileServices/shares@2021-06-01
## Reference resource/module collections
-The ARM template [`references`](../templates/template-functions-resource.md#references) function returns an array of objects representing a resource collection's runtime states. In Bicep, there is no explicit references function. Instead, symbolic collection usage is employed directly, and during code generation, Bicep translates it to an ARM template that utilizes the ARM template references function. For the translation feature that transforms symbolic collections into ARM templates using the references function, it is necessary to have Bicep CLI version 0.20.4 or a more recent version. Additionally, in the [`bicepconfig.json`](./bicep-config.md#enable-experimental-features) file, the `symbolicNameCodegen` setting should be presented and set to `true`.
+The ARM template [`references`](../templates/template-functions-resource.md#references) function returns an array of objects representing a resource collection's runtime states. In Bicep, there is no explicit references function. Instead, symbolic collection usage is employed directly, and during code generation, Bicep translates it to an ARM template that utilizes the ARM template references function. For the translation feature that transforms symbolic collections into ARM templates using the references function, it is necessary to have [Bicep CLI version 0.20.X or higher](./install.md). Additionally, in the [`bicepconfig.json`](./bicep-config.md#enable-experimental-features) file, the `symbolicNameCodegen` setting should be presented and set to `true`.
The outputs of the two samples in [Integer index](#integer-index) can be written as:
azure-resource-manager Msbuild Bicep File https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/msbuild-bicep-file.md
You'll need the latest versions of the following software:
If your existing continuous integration (CI) pipeline relies on [MSBuild](/visualstudio/msbuild/msbuild), you can use MSBuild tasks and CLI packages to convert Bicep files into ARM template JSON.
-The functionality relies on the following NuGet packages. The latest NuGet package versions match the latest Bicep version.
+The functionality relies on the following NuGet packages. The latest NuGet package versions match the latest Bicep CLI version.
| Package Name | Description | | - |- |
azure-resource-manager Outputs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/outputs.md
output stringOutput string = user['user-name']
## Conditional output
-When the value to return depends on a condition in the deployment, use the the `?` operator.
+When the value to return depends on a condition in the deployment, use the `?` operator.
```bicep output <name> <data-type> = <condition> ? <true-value> : <false-value>
azure-resource-manager Parameter Files https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/parameter-files.md
Title: Create parameters files for Bicep deployment
description: Create parameters file for passing in values during deployment of a Bicep file Previously updated : 10/10/2023 Last updated : 11/03/2023 # Create parameters files for Bicep deployment
using './main.bicep'
param intFromEnvironmentVariables = int(readEnvironmentVariable('intEnvVariableName')) ```
-You can define and use variables. Bicep CLI version 0.21.1 or newer is required for using variables in .bicepparam file. Here are some examples:
+You can define and use variables. [Bicep CLI version 0.21.X or higher](./install.md) is required for using variables in .bicepparam file. Here are some examples:
```bicep using './main.bicep'
From Azure CLI, you can pass a parameter file with your Bicep file deployment.
# [Bicep parameters file](#tab/Bicep)
-With Azure CLI version 2.53.0 or later, and Bicep CLI version 0.22.6 or later, you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there is no need to provide the `--template-file` switch when specifying a Bicep parameter file for the `--parameters` switch. Including the `--template-file` switch will result in an "Only a .bicep template is allowed with a .bicepparam file" error.
+With Azure CLI version 2.53.0 or later, and [Bicep CLI version 0.22.X or higher](./install.md), you can deploy a Bicep file by utilizing a Bicep parameter file. With the `using` statement within the Bicep parameters file, there is no need to provide the `--template-file` switch when specifying a Bicep parameter file for the `--parameters` switch. Including the `--template-file` switch will result in an "Only a .bicep template is allowed with a .bicepparam file" error.
```azurecli
az deployment group create \
-For more information, see [Deploy resources with Bicep and Azure CLI](./deploy-cli.md#parameters).
+For more information, see [Deploy resources with Bicep and Azure CLI](./deploy-cli.md#parameters).
From Azure PowerShell, pass a local parameters file using the `TemplateParameterFile` parameter.
azure-resource-manager User Defined Data Types https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/user-defined-data-types.md
Title: User-defined types in Bicep
description: Describes how to define and use user-defined data types in Bicep. Previously updated : 09/26/2023 Last updated : 11/03/2023 # User-defined data types in Bicep Learn how to use user-defined data types in Bicep.
-[Bicep version 0.12.1 or newer](./install.md) is required to use this feature.
+[Bicep CLI version 0.12.X or higher](./install.md) is required to use this feature.
## User-defined data type syntax
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
## Declare tagged union type
-To declare a custom tagged union data type within a Bicep file, you can place a discriminator decorator above a user-defined type declartion. [Bicep version 0.21.1 or newer](./install.md) is required to use this decorator. The syntax is:
+To declare a custom tagged union data type within a Bicep file, you can place a discriminator decorator above a user-defined type declartion. [Bicep CLI version 0.21.X or higher](./install.md) is required to use this decorator. The syntax is:
```bicep @discriminator('<propertyName>')
param serviceConfig ServiceConfig = { type: 'bar', value: true }
output config object = serviceConfig ```
-The parameter value is validated based on the discriminated property value. In the preceeding example, if the *serviceConfig* parameter value is of type *foo*, it undergoes validation using the *FooConfig*type. Likewise, if the parameter value is of type *bar*, validation is performed using the *BarConfig* type, and this pattern continues for other types as well.
+The parameter value is validated based on the discriminated property value. In the preceeding example, if the *serviceConfig* parameter value is of type *foo*, it undergoes validation using the *FooConfig*type. Likewise, if the parameter value is of type *bar*, validation is performed using the *BarConfig* type, and this pattern continues for other types as well.
## Import types between Bicep files (Preview)
-[Bicep version 0.21.1 or newer](./install.md) is required to use this compile-time import feature. The experimental flag `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features).
+[Bicep CLI version 0.21.X or higher](./install.md) is required to use this compile-time import feature. The experimental flag `compileTimeImports` must be enabled from the [Bicep config file](./bicep-config.md#enable-experimental-features).
Only user-defined data types that bear the `@export()` decorator can be imported to other templates. Currently, this decorator can only be used on `type` statements.
azure-resource-manager User Defined Functions https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/bicep/user-defined-functions.md
Title: User-defined functions in Bicep
description: Describes how to define and use user-defined functions in Bicep. Previously updated : 11/02/2023 Last updated : 11/03/2023 # User-defined functions in Bicep (Preview) Within your Bicep file, you can create your own functions. These functions are available for use in your Bicep files. User-defined functions are separate from the [standard Bicep functions](./bicep-functions.md) that are automatically available within your Bicep files. Create your own functions when you have complicated expressions that are used repeatedly in your Bicep files.
-[Bicep version 0.20 or newer](./install.md) is required to use this feature.
+[Bicep CLI version 0.20.X or higher](./install.md) is required to use this feature.
## Enable the preview feature
The outputs from the preceding examples are:
| nameArray | Array | ["John"] | | addNameArray | Array | ["Mary","Bob","John"] |
-With [Bicep version 0.23 or newer](./install.md), you have the flexibility to invoke another user-defined function within a user-defined function. In the preceding example, with the function definition of `sayHelloString`, you can redefine the `sayHelloObject` function as:
+With [Bicep CLI version 0.23.X or higher](./install.md), you have the flexibility to invoke another user-defined function within a user-defined function. In the preceding example, with the function definition of `sayHelloString`, you can redefine the `sayHelloObject` function as:
```bicep func sayHelloObject(name string) object => {
azure-resource-manager Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/custom-providers/policy-reference.md
Title: Built-in policy definitions for Azure Custom Resource Providers description: Lists Azure Policy built-in policy definitions for Azure Custom Resource Providers. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-resource-manager Deploy Marketplace App Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/managed-applications/deploy-marketplace-app-quickstart.md
After the managed application deployment is finished, you can verify the resourc
1. The managed resource group shows the resources that were deployed and the deployments that created the resources.
- :::image type="content" source="media/deploy-marketplace-app-quickstart/mrg-apps.png" alt-text="Screenshot of the managed resource group that that highlights the deployments and list of deployed resources.":::
+ :::image type="content" source="media/deploy-marketplace-app-quickstart/mrg-apps.png" alt-text="Screenshot of the managed resource group that highlights the deployments and list of deployed resources.":::
1. To review the publisher's permissions in the managed resource group, select **Access Control (IAM)** > **Role assignments**.
azure-resource-manager Microsoft Common Serviceprincipalselector https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/managed-applications/microsoft-common-serviceprincipalselector.md
After you register a new application, use the **Authentication Type** to enter a
### Use existing application
-To use an existing application, choose **Select Existing** and then select **Make selection**. Use the **Select an application** dialog box to search for the application's name. From the results, select the the application and then the **Select** button. After you select an application, the control displays the **Authentication Type** to enter a password or certificate thumbprint.
+To use an existing application, choose **Select Existing** and then select **Make selection**. Use the **Select an application** dialog box to search for the application's name. From the results, select the application and then the **Select** button. After you select an application, the control displays the **Authentication Type** to enter a password or certificate thumbprint.
:::image type="content" source="./media/managed-application-elements/microsoft-common-serviceprincipal-existing.png" alt-text="Screenshot of Microsoft.Common.ServicePrincipalSelector with select existing application option and authentication type displayed.":::
azure-resource-manager Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/managed-applications/policy-reference.md
Title: Built-in policy definitions for Azure Managed Applications description: Lists Azure Policy built-in policy definitions for Azure Managed Applications. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-resource-manager Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-resource-manager/management/policy-reference.md
Title: Built-in policy definitions for Azure Resource Manager description: Lists Azure Policy built-in policy definitions for Azure Resource Manager. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-signalr Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-signalr/policy-reference.md
Title: Built-in policy definitions for Azure SignalR description: Lists Azure Policy built-in policy definitions for Azure SignalR. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
azure-web-pubsub Concept Disaster Recovery https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/azure-web-pubsub/concept-disaster-recovery.md
For regional disaster recovery, we recommend the following two approaches:
## High available architecture for Web PubSub service There are two typical patterns using Web PubSub service:
-* One is client-server pattern that [clients send events the the server](./quickstarts-event-notifications-from-clients.md) and [server pushes messages to the clients](./quickstarts-push-messages-from-server.md).
+* One is client-server pattern that [clients send events to the server](./quickstarts-event-notifications-from-clients.md) and [server pushes messages to the clients](./quickstarts-push-messages-from-server.md).
* Another is client-client pattern that [clients pub/sub messages through the Web PubSub service to other clients](./quickstarts-pubsub-among-clients.md). Below sections describe different ways for these two patterns to do disaster recovery
backup Backup Azure Backup Server Import Export https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/backup-azure-backup-server-import-export.md
The information in this section helps you complete the offline-backup workflow s
3. Provide the inputs on the **Use your Own Disk** page.
- ![Screenshot shows how how to add details to use your own disk.](./media/backup-azure-backup-server-import-export/use-your-own-disk.png)
+ ![Screenshot shows how to add details to use your own disk.](./media/backup-azure-backup-server-import-export/use-your-own-disk.png)
The description of the inputs is as follows:
backup Backup Azure Restore Files From Vm https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/backup-azure-restore-files-from-vm.md
If you run the script on a computer with restricted access, ensure there's acces
> [!NOTE] > > In case, the backed up VM is Windows, then the geo-name will be mentioned in the password generated.<br><br>
-> For eg, if the generated password is *ContosoVM_wcus_GUID*, then then geo-name is wcus and the URL would be: <`https://pod01-rec2.wcus.backup.windowsazure.com`><br><br>
+> For eg, if the generated password is *ContosoVM_wcus_GUID*, then geo-name is wcus and the URL would be: <`https://pod01-rec2.wcus.backup.windowsazure.com`><br><br>
> > > If the backed up VM is Linux, then the script file you downloaded in step 1 [above](#step-1-generate-and-download-script-to-browse-and-recover-files) will have the **geo-name** in the name of the file. Use that **geo-name** to fill in the URL. The downloaded script name will begin with: \'VMname\'\_\'geoname\'_\'GUID\'.<br><br>
backup Backup Mabs Sql Azure Stack https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/backup-mabs-sql-azure-stack.md
To create a backup policy to protect SQL Server databases to Azure, follow these
14. Once you review the policy details in the **Summary** screen, select **Create group** to complete the workflow. You can select **Close** and monitor the job progress in Monitoring workspace.
- ![Screenshot shows the the in-progress job state of the Protection Group creation.](./media/backup-azure-backup-sql/pg-summary.png)
+ ![Screenshot shows the in-progress job state of the Protection Group creation.](./media/backup-azure-backup-sql/pg-summary.png)
## Run an on-demand backup
To run an on-demand backup of a SQL Server database, follow these steps:
![Screenshot shows the Protection Group members.](./media/backup-azure-backup-sql/sqlbackup-recoverypoint.png) 2. Right-click the database and select **Create Recovery Point**.
- ![Screenshot shows how to start creating the online online Recovery Point.](./media/backup-azure-backup-sql/sqlbackup-createrp.png)
+ ![Screenshot shows how to start creating the online Recovery Point.](./media/backup-azure-backup-sql/sqlbackup-createrp.png)
3. Choose **Online Protection** in the drop-down menu and select **OK** to start creation of a recovery point in Azure. ![Screenshot shows how to choose the Online Protection option.](./media/backup-azure-backup-sql/sqlbackup-azure.png)
backup Multi User Authorization Concept https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/multi-user-authorization-concept.md
The following table lists the scenarios for creating your Resource Guard and vau
**Usage scenario** | **Protection due to MUA** | **Ease of implementation** | **Notes** | | | | Vault and Resource Guard are **in the same subscription.** </br> The Backup admin doesn't have access to the Resource Guard. | Least isolation between the Backup admin and the Security admin. | Relatively easy to implement since only one subscription is required. | Resource level permissions/ roles need to be ensured are correctly assigned.
-Vault and Resource Guard are **in different subscriptions but the same tenant.** </br> The Backup admin doesn't have access to the Resource Guard or the corresponding subscription. | Medium isolation between the Backup admin and the Security admin. | Relatively medium ease of implementation since two subscriptions (but a single tenant) are required. | Ensure that that permissions/ roles are correctly assigned for the resource or the subscription.
+Vault and Resource Guard are **in different subscriptions but the same tenant.** </br> The Backup admin doesn't have access to the Resource Guard or the corresponding subscription. | Medium isolation between the Backup admin and the Security admin. | Relatively medium ease of implementation since two subscriptions (but a single tenant) are required. | Ensure that permissions/ roles are correctly assigned for the resource or the subscription.
Vault and Resource Guard are **in different tenants.** </br> The Backup admin doesn't have access to the Resource Guard, the corresponding subscription, or the corresponding tenant.| Maximum isolation between the Backup admin and the Security admin, hence, maximum security. | Relatively difficult to test since requires two tenants or directories to test. | Ensure that permissions/ roles are correctly assigned for the resource, the subscription or the directory. ## Next steps
backup Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/policy-reference.md
Title: Built-in policy definitions for Azure Backup description: Lists Azure Policy built-in policy definitions for Azure Backup. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
backup Use Restapi Update Vault Properties https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/backup/use-restapi-update-vault-properties.md
This article describes how to update backup related configurations in Azure Reco
Deleting backups of a protected item is a significant operation that has to be monitored. To protect against accidental deletions, Azure Recovery Services vault has a soft-delete capability. This capability allows you to restore deleted backups, if necessary, within a time period after the deletion.
-But there are scenarios in which this capability isn't required. An Azure Recovery Services vault can't be deleted if there are backup items within it, even soft-deleted ones. This may pose a problem if the vault needs to be immediately deleted. For for example: deployment operations often clean up the created resources in the same workflow. A deployment can create a vault, configure backups for an item, do a test restore and then proceed to delete the backup items and the vault. If the vault deletion fails, the entire deployment might fail. Disabling soft-delete is the only way to guarantee immediate deletion.
+But there are scenarios in which this capability isn't required. An Azure Recovery Services vault can't be deleted if there are backup items within it, even soft-deleted ones. This may pose a problem if the vault needs to be immediately deleted. For example: deployment operations often clean up the created resources in the same workflow. A deployment can create a vault, configure backups for an item, do a test restore and then proceed to delete the backup items and the vault. If the vault deletion fails, the entire deployment might fail. Disabling soft-delete is the only way to guarantee immediate deletion.
So you need to carefully choose whether or not to disable soft-delete for a particular vault depending on the scenario. For more information, see the [soft-delete article](backup-azure-security-feature-cloud.md).
batch Batch Sig Images https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/batch/batch-sig-images.md
Using a Shared Image configured for your scenario can provide several advantages
> > The image can be in a different region as long as it has replicas in the same region as your Batch account.
-If you use a Microsoft Entra application to create a custom image pool with an Azure Compute Gallery image, that application must have been granted an [Azure built-in role](../role-based-access-control/rbac-and-directory-admin-roles.md#azure-roles) that gives it access to the the Shared Image. You can grant this access in the Azure portal by navigating to the Shared Image, selecting **Access control (IAM)** and adding a role assignment for the application.
+If you use a Microsoft Entra application to create a custom image pool with an Azure Compute Gallery image, that application must have been granted an [Azure built-in role](../role-based-access-control/rbac-and-directory-admin-roles.md#azure-roles) that gives it access to the Shared Image. You can grant this access in the Azure portal by navigating to the Shared Image, selecting **Access control (IAM)** and adding a role assignment for the application.
## Prepare a Shared Image
batch Best Practices https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/batch/best-practices.md
The automated cleanup for the working directory will be blocked if you run a ser
- Learn about the [Batch service workflow and primary resources](batch-service-workflow-features.md) such as pools, nodes, jobs, and tasks. - Learn about [default Azure Batch quotas, limits, and constraints, and how to request quota increases](batch-quota-limit.md).-- Learn how to to [detect and avoid failures in pool and node background operations ](batch-pool-node-error-checking.md).
+- Learn how to [detect and avoid failures in pool and node background operations ](batch-pool-node-error-checking.md).
batch Nodes And Pools https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/batch/nodes-and-pools.md
If you add a certificate to an existing pool, you must reboot its compute nodes
## Next steps - Learn about [jobs and tasks](jobs-and-tasks.md).-- Learn how to to [detect and avoid failures in pool and node background operations ](batch-pool-node-error-checking.md).
+- Learn how to [detect and avoid failures in pool and node background operations ](batch-pool-node-error-checking.md).
batch Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/batch/policy-reference.md
Title: Built-in policy definitions for Azure Batch description: Lists Azure Policy built-in policy definitions for Azure Batch. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
cdn Monitoring And Access Log https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cdn/monitoring-and-access-log.md
For more information, see [Azure Monitor metrics](../azure-monitor/essentials/da
| TotalLatency | The total time from the client request received by CDN **until the last response byte send from CDN to client**. |Endpoint </br> Client country. </br> Client region. </br> HTTP status. </br> HTTP status group. | > [!NOTE]
-> If a request to the the origin timeout, the value for HttpStatusCode is set to **0**.
+> If a request to the origin timeout, the value for HttpStatusCode is set to **0**.
***Bytes Hit Ratio = (egress from edge - egress from origin)/egress from edge**
chaos-studio Chaos Studio Tutorial Aad Outage Portal https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/chaos-studio/chaos-studio-tutorial-aad-outage-portal.md
Now you can create your experiment from a pre-filled experiment template. A chao
[![Screenshot that shows the experiment templates screen, with the AAD outage template button highlighted.](images/tutorial-aad-outage-select.png)](images/tutorial-aad-outage-select.png#lightbox) 1. Add a name for your experiment that complies with resource naming guidelines. Select **Next: Permissions**.
- [![Screenshot that shows the experiment basics screen, with the permissions tab button button highlighted.](images/tutorial-aad-outage-basics.png)](images/tutorial-aad-outage-basics.png#lightbox)
+ [![Screenshot that shows the experiment basics screen, with the permissions tab button highlighted.](images/tutorial-aad-outage-basics.png)](images/tutorial-aad-outage-basics.png#lightbox)
1. For your chaos experiment to run successfully, it must have [sufficient permissions on target resources](chaos-studio-permissions-security.md). Select a system-assigned managed identity or a user-assigned managed identity for your experiment. You can choose to enable custom role assignment if you would like Chaos Studio to add the necessary permissions to run (in the form of a custom role) to your experiment's identity. Select **Next: Experiment designer**.
- [![Screenshot that shows the experiment permissions screen, with the experiment designer tab button button highlighted.](images/tutorial-aad-outage-permissions.png)](images/tutorial-aad-outage-permissions.png#lightbox)
+ [![Screenshot that shows the experiment permissions screen, with the experiment designer tab button highlighted.](images/tutorial-aad-outage-permissions.png)](images/tutorial-aad-outage-permissions.png#lightbox)
1. Within the **NSG Security Rule (version 1.1)** fault, select **Edit**. [![Screenshot that shows the experiment designer screen, with the edit button within the NSG fault highlighted.](images/tutorial-aad-outage-edit-fault.png)](images/tutorial-aad-outage-edit-fault.png#lightbox)
chaos-studio Sample Policy Targets https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/chaos-studio/sample-policy-targets.md
# Azure Policy samples for adding resources to Azure Chaos Studio
-This article includes sample [Azure Policy](../governance/policy/overview.md) definitions that create [targets and capabilities](chaos-studio-targets-capabilities.md) for a specific resource type. You can automatically add resources to Azure Chaos Studio. First, you [deploy these samples as custom policy definitions](../governance/policy/tutorials/create-custom-policy-definition.md). Then you [assign the policy](../governance/policy/assign-policy-portal.md) to a scope.
+This article includes sample [Azure Policy](../governance/policy/overview.md) definitions that create [targets and capabilities](chaos-studio-targets-capabilities.md) for a specific resource type. You can automatically add resources to Azure Chaos Studio. First, you [deploy these samples as custom policy definitions](../governance/policy/tutorials/create-and-manage.md). Then you [assign the policy](../governance/policy/assign-policy-portal.md) to a scope.
In these samples, we add service-direct targets and capabilities for each [supported resource type](chaos-studio-fault-providers.md) by using [targets and capabilities](chaos-studio-targets-capabilities.md).
chaos-studio Troubleshooting https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/chaos-studio/troubleshooting.md
From the **Experiments** list in the Azure portal, select the experiment name to
This error might happen if you added the agent by using the Azure portal, which has a known issue. Enabling an agent-based target doesn't assign the user-assigned managed identity to the VM or virtual machine scale set.
-To resolve this problem, go to the VM or virtual machine scale set in the Azure portal and go to **Identity**. Open the **User assigned** tab and add your user-assigned identity to the VM. After you're finished, you might need to reboot the VM for the agent to connect.
+To resolve this problem, go to the VM or virtual machine scale set in the Azure portal and go to **Identity**. Open the **User assigned** tab and add your user-assigned identity to the VM. After you're finished, you might need to reboot the VM for the agent to connect.
+
+## Problems when setting up a managed identity
+
+### When I try to add a system-assigned/user-assigned managed identity to my existing experiment, it fails to save.
+
+If you are trying to add a user-assigned or system-assigned managed identity to an experiment that **already** has a managed identity assigned to it, the experiment fails to deploy. You need to delete the existing user-assigned or system-assigned managed identity on the desired experiment **first** before adding your desired managed identity.
cloud-services-extended-support Sample Create Cloud Service https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cloud-services-extended-support/sample-create-cloud-service.md
# Create a new Azure Cloud Service (extended Support)
-These samples cover various ways to to create a new Azure Cloud Service (extended support) deployment.
+These samples cover various ways to create a new Azure Cloud Service (extended support) deployment.
## Create new Cloud Service with single role
cloud-services-extended-support Support Help https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cloud-services-extended-support/support-help.md
Here are suggestions for where you can get help when developing your Azure Cloud
## Self help troubleshooting
-For common issues and and workarounds, see [Azure Cloud Services troubleshooting documentation](/troubleshoot/azure/cloud-services/welcome-cloud-services) and [Frequently asked questions](faq.yml)
+For common issues and workarounds, see [Azure Cloud Services troubleshooting documentation](/troubleshoot/azure/cloud-services/welcome-cloud-services) and [Frequently asked questions](faq.yml)
## Post a question on Microsoft Q&A
cloud-services Resource Health For Cloud Services https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cloud-services/resource-health-for-cloud-services.md
Since Role Instances are basically VMs and the health check for VMs is reused fo
| Provisioning failure | We're sorry, your virtual machine isn't available due to unexpected provisioning problems. The provisioning of your virtual machine has failed due to an unexpected error | | Live Migration | This virtual machine is paused because of a memory-preserving Live Migration operation. The virtual machine typically resumes within 10 seconds. No additional action is required from you at this time | | Live Migration | This virtual machine is paused because of a memory-preserving Live Migration operation. The virtual machine typically resumes within 10 seconds. No additional action is required from you at this time |
-| Remote disk disconnected | We're sorry, your virtual machine is unavailable because because of connectivity loss to the remote disk. We're working to reestablish disk connectivity. No additional action is required from you at this time |
+| Remote disk disconnected | We're sorry, your virtual machine is unavailable because of connectivity loss to the remote disk. We're working to reestablish disk connectivity. No additional action is required from you at this time |
| Azure service issue | Your virtual machine is impacted by Azure service issue | | Network issue | This virtual machine is impacted by a top-of-rack network device | | Unavailable | Your virtual machine is unavailable. We are currently unable to determine the reason for this downtime |
cognitive-services Bing Autosuggest Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/bing-autosuggest-upgrade-guide-v5-to-v7.md
- Title: Upgrade Bing Autosuggest API v5 to v7-
-description: Identifies the parts of your Bing Autosuggest application that you need to update to use version 7.
------- Previously updated : 02/20/2019--
-# Autosuggest API upgrade guide
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing Autosuggest API. Use this guide to help update your application to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number changed from v5 to v7. For example, https:\//api.cognitive.microsoft.com/bing/\*\*v7.0**/Suggestions.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
--- Replaced the v5 error codes with the following possible `code` and `subCode` values.-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the sub-code conditions occur. The response includes these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code is 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Use and display requirements](../bing-web-search/use-display-requirements.md)
cognitive-services Get Suggestions https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/concepts/get-suggestions.md
- Title: Suggesting search terms with the Bing Autosuggest API-
-description: This article discusses the concept of suggesting query terms using the Bing Autosuggest API and the impact of query length on relevance.
------ Previously updated : 02/20/2019---
-# Suggesting query terms
---
-Typically, you'd call the Bing Autosuggest API each time a user types a new character in your application's search box. The completeness of the query string impacts the relevance of the suggested query terms that the API returns. The more complete the query string, the more relevant the list of suggested query terms are. For example, the suggestions that the API may return for `s` are likely to be less relevant than the queries it returns for `sailing dinghies`.
-
-## Example request
-
-The following example shows a request that returns the suggested query strings for *sail*. Remember to URL encode the user's partial query term when you set the [q](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#query) query parameter. For example, if the user entered *sailing les*, set `q` to `sailing+les` or `sailing%20les`.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/suggestions?q=sail&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following response contains a list of [SearchAction](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#searchaction) objects that contain the suggested query terms.
-
-```json
-{
- "url" : "https:\/\/www.bing.com\/search?q=sailing+lessons+seattle&FORM=USBAPI",
- "displayText" : "sailing lessons seattle",
- "query" : "sailing lessons seattle",
- "searchKind" : "WebSearch"
-}, ...
-```
-
-## Using suggested query terms
-
-Each suggestion includes a `displayText`, `query` and, `url` field. The `displayText` field contains the suggested query that you use to populate your search box's drop-down list. You must display all suggestions that the response includes, and in the given order.
-
-The following example shows a drop-down search box with suggested query terms from the Bing Autosuggest API.
-
-![Autosuggest drop-down search box list](../media/cognitive-services-bing-autosuggest-api/bing-autosuggest-drop-down-list.PNG)
-
-If the user selects a suggested query from the drop-down list, you'd use the query term in the `query` field to call the [Bing Web Search API](../../bing-web-search/overview.md) and display the results yourself. Or, you could use the URL in the `url` field to send the user to the Bing search results page instead.
-
-## Next steps
-
-* [What is the Bing Autosuggest API?](../get-suggested-search-terms.md)
cognitive-services Sending Requests https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/concepts/sending-requests.md
- Title: "Sending requests to the Bing Autosuggest API"-
-description: The Bing Autosuggest API returns a list of suggested queries based on the partial query string in the search box. Learn more about sending requests.
------- Previously updated : 06/27/2019---
-# Sending requests to the Bing Autosuggest API.
--
-If your application sends queries to any of the Bing Search APIs, you can use the Bing Autosuggest API to improve your users' search experience. The Bing Autosuggest API returns a list of suggested queries based on the partial query string in the search box. As characters are entered into a search box in your application, you can display suggestions in a drop-down list. Use this article to learn more about sending requests to this API.
-
-## Bing Autosuggest API Endpoint
-
-The **Bing Autosuggest API** includes one endpoint, which returns a list of suggested queries from a partial search term.
-
-To get suggested queries using the Bing API, send a `GET` request to the following endpoint. Use the headers and URL parameters to define further specifications.
-
-**Endpoint:** Returns search suggestions as JSON results that are relevant to the user's input defined by `?q=""`.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/Suggestions
-```
-
-For details about headers, parameters, market codes, response objects, errors, etc., see the [Bing Autosuggest API v7](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference) reference.
-
-The **Bing** APIs support search actions that return results according to their type. All search endpoints return results as JSON response objects.
-All endpoints support queries that return a specific language and/or location by longitude, latitude, and search radius.
-
-For complete information about the parameters supported by each endpoint, see the reference pages for each type.
-For examples of basic requests using the Autosuggest API, see [Autosuggest Quickstarts](/azure/cognitive-services/bing-autosuggest/get-suggested-search-terms).
-
-## Bing Autosuggest API requests
-
-> [!NOTE]
-> * Requests to the Bing Autosuggest API must use the HTTPS protocol.
-
-We recommend that all requests originate from a server. Distributing the key as part of a client application provides more opportunity malicious third-party access. Additionally, making calls from a server provides a single upgrade point for future updates.
-
-The request must specify the [q](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#query) query parameter, which contains the user's partial search term. Although it's optional, the request should also specify the [mkt](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters, see [Query Parameters](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#query-parameters). All query parameter values must be URL encoded.
-
-The request must specify the [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#subscriptionkey) header. Although optional, you are encouraged to also specify the following headers:
--- [User-Agent](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#useragent)-- [X-MSEdge-ClientID](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#clientid)-- [X-Search-ClientIP](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#clientip)-- [X-Search-Location](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#location)-
-The client IP and location headers are important for returning location aware content.
-
-For a list of all request and response headers, see [Headers](/rest/api/cognitiveservices/bing-autosuggest-api-v5-reference#headers).
-
-> [!NOTE]
-> When you call the Bing Autosuggest API from JavaScript, your browser's built-in security features might prevent you from accessing the values of these headers.
-
-To resolve this, you can make the Bing Autosuggest API request through a CORS proxy. The response from such a proxy has a `Access-Control-Expose-Headers` header that filter response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our [tutorial app](../tutorials/autosuggest.md) to access the optional client headers. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then enter the following command at a command prompt.
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Autosuggest API endpoint in the HTML file to:
-
-```http
-http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/Suggestions
-```
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-Requests should include all suggested query parameters and headers.
-
-The following example shows a request that returns the suggested query strings for *sail*.
-
-> ```http
-> GET https://api.cognitive.microsoft.com/bing/v7.0/suggestions?q=sail&mkt=en-us HTTP/1.1
-> Ocp-Apim-Subscription-Key: 123456789ABCDE
-> X-MSEdge-ClientIP: 999.999.999.999
-> X-Search-Location: lat:47.60357;long:-122.3295;re:100
-> X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-> Host: api.cognitive.microsoft.com
-> ```
-
-If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID header if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-The following web suggestion group is a response to the above request. The group contains a list of search query suggestions, with each suggestion including a `displayText`, `query`, and `url` field.
-
-The `displayText` field contains the suggested query that you'd use to populate your search box's drop-down list. You must display all suggestions that the response includes, and in the given order.
-
-If the user selects a query from the drop-down list, you can use it to call the one of the [Bing Search APIs](../../bing-web-search/bing-api-comparison.md?bc=%2fen-us%2fazure%2fbread%2ftoc.json&toc=%2fen-us%2fazure%2fcognitive-services%2fbing-autosuggest%2ftoc.json) and display the results yourself, or send the user to the Bing results page using the returned `url` field.
--
-```json
-BingAPIs-TraceId: 76DD2C2549B94F9FB55B4BD6FEB6AC
-X-MSEdge-ClientID: 1C3352B306E669780D58D607B96869
-BingAPIs-Market: en-US
-
-{
- "_type" : "Suggestions",
- "queryContext" : {
- "originalQuery" : "sail"
- },
- "suggestionGroups" : [{
- "name" : "Web",
- "searchSuggestions" : [{
- "url" : "https:\/\/www.bing.com\/search?q=sailing+lessons+seattle&FORM=USBAPI",
- "displayText" : "sailing lessons seattle",
- "query" : "sailing lessons seattle",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailor+moon+news&FORM=USBAPI",
- "displayText" : "sailor moon news",
- "query" : "sailor moon news",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailor+jack%27s+lincoln+city&FORM=USBAPI",
- "displayText" : "sailor jack's lincoln city",
- "query" : "sailor jack's lincoln city",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailing+anarchy&FORM=USBAPI",
- "displayText" : "sailing anarchy",
- "query" : "sailing anarchy",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailboats+for+sale&FORM=USBAPI",
- "displayText" : "sailboats for sale",
- "query" : "sailboats for sale",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailstn.mylabsplus.com&FORM=USBAPI",
- "displayText" : "sailstn.mylabsplus.com",
- "query" : "sailstn.mylabsplus.com",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailusfood&FORM=USBAPI",
- "displayText" : "sailusfood",
- "query" : "sailusfood",
- "searchKind" : "WebSearch"
- },
- {
- "url" : "https:\/\/www.bing.com\/search?q=sailboats+for+sale+seattle&FORM=USBAPI",
- "displayText" : "sailboats for sale seattle",
- "query" : "sailboats for sale seattle",
- "searchKind" : "WebSearch"
- }]
- }]
-}
-```
-
-## Next steps
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)-- [Getting suggested search terms from the Bing Autosuggest API](get-suggestions.md)
cognitive-services Get Suggested Search Terms https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/get-suggested-search-terms.md
- Title: What is Bing Autosuggest?-
-description: The Bing Autosuggest API returns a list of suggested queries based on the partial query string in the search box.
------- Previously updated : 12/18/2019--
-# What is Bing Autosuggest?
--
-If your application sends queries to any of the Bing Search APIs, you can use the Bing Autosuggest API to improve your users' search experience. The Bing Autosuggest API returns a list of suggested queries based on the partial query string in the search box. As characters are entered into the search box, you can display suggestions in a drop-down list.
-
-## Bing Autosuggest API features
-
-| Feature | Description |
-|--||
-| [Suggest search terms in real-time](concepts/get-suggestions.md) | Improve your app experience by using the Autosuggest API to display suggested search terms as they're typed. |
-
-## Workflow
-
-The Bing Autosuggest API is a RESTful web service, easy to call from any programming language that can make HTTP requests and parse JSON.
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-2. Send a request to this API each time a user types a new character in your application's search box.
-3. Process the API response by parsing the returned JSON message.
-
-Typically, you'd call this API each time the user types a new character in your application's search box. As more characters are entered, the API will return more relevant suggested search queries. For example, the suggestions the API might return for a single `s` are likely to be less relevant than ones for `sail`.
-
-The following example shows a drop-down search box with suggested query terms from the Bing Autosuggest API.
-
-![Autosuggest drop-down search box list](./media/cognitive-services-bing-autosuggest-api/bing-autosuggest-drop-down-list.PNG)
-
-When a user selects a suggestion from the drop-down list, you can use it to begin searching with one of the Bing Search APIs, or directly go to the Bing search results page.
-
-## Next steps
-
-To get started quickly with your first request, see [Making Your First Query](quickstarts/csharp.md).
-
-Familiarize yourself with the [Bing Autosuggest API v7](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference) reference. The reference contains the list of endpoints, headers, and query parameters that you'd use to request suggested query terms, and the definitions of the response objects.
-
-Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
--
-Learn how to search the web by using the [Bing Web Search API](../bing-web-search/overview.md), and explore the other [Bing Search APIs](../bing-web-search/index.yml).
-
-Be sure to read [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) so you don't break any of the rules about using the search results.
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/language-support.md
- Title: Language support - Bing Autosuggest API-
-description: A list of supported languages and regions for the Bing Autosuggest API.
------- Previously updated : 02/20/2019---
-# Language and region support for the Bing Autosuggest API
--
-The following lists the languages supported by Bing Autosuggest API.
-
-| Language | Language code |
-|:-- |:-:|
-| Arabic | `ar` |
-| Chinese (People's Republic of China) | `zh-CN` |
-| Chinese (Hong Kong SAR) | `zh-HK` |
-| Chinese (Taiwan) | `zh-TW` |
-| Danish | `da` |
-| Dutch (Belgium) | `nl-BE` |
-| Dutch (Netherlands) | `nl-NL` |
-| English (Australia) | `en-AU` |
-| English (Canada) | `en-CA` |
-| English (India) | `en-IN` |
-| English (Indonesia) | `en-ID` |
-| English (Malaysia) | `en-MY` |
-| English (New Zealand) | `en-NZ` |
-| English (Philippines) | `en-PH` |
-| English (South Africa) | `en-ZA` |
-| English (United Kingdom) | `en-GB` |
-| English (United States) | `en-US` |
-| Finnish | `fi` |
-| French (Belgium) | `fr-BE` |
-| French (Canada) | `fr-CA` |
-| French (France) | `fr-FR` |
-| French (Switzerland) | `fr-CH` |
-| German (Austria) | `de-AT` |
-| German (Germany) | `de-DE` |
-| German (Switzerland) | `de-CH` |
-| Italian | `it` |
-| Japanese | `ja` |
-| Korean | `ko` |
-| Norwegian | `no` |
-| Polish | `pl` |
-| Portuguese (Brazil) | `pt-BR`|
-| Portuguese (Portugal) | `pt-PT`|
-| Russian | `ru` |
-| Spanish (Argentina) | `es-AR` |
-| Spanish (Chile) | `es-CL` |
-| Spanish (Mexico) | `es-MX` |
-| Spanish (Spain) | `es-ES` |
-| Spanish (United States) | `es-US` |
-| Swedish | `sv` |
-| Turkish | `tr` |
-
-## See also
--- [Azure AI services documentation](../../ai-services/index.yml)-- [Azure AI services product information](https://azure.microsoft.com/services/cognitive-services/)
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing Autosuggest client library'-
-description: The Autosuggest API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-fifteen
--- Previously updated : 04/06/2020---
-# Quickstart: Use the Bing Autosuggest client library
-------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/csharp.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and C#"-
-description: "Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and C#."
------ Previously updated : 05/06/2020---
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and C#
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple C# application sends a partial search query to the API, and returns suggestions for searches. While this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
-* If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
--
-## Create a Visual Search Solution
-
-1. Create a new console solution in Visual Studio. Then, add the following namespaces into the main code file.
-
- ```csharp
- using System;
- using System.Collections.Generic;
- using System.Net.Http;
- using System.Net.Http.Headers;
- using System.Text;
- ```
-
-2. In a new class, create variables for your API host and path, [market code](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a partial search query. Use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- static string host = "https://api.cognitive.microsoft.com";
- static string path = "/bing/v7.0/Suggestions";
- static string market = "en-US";
- static string key = "your-api-key";
-
- static string query = "sail";
- ```
--
-## Create and send an API request
-
-1. Create a function called `Autosuggest()` to send a request to the API. Create a new `HttpClient()`, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```csharp
- async static void Autosuggest()
- {
- HttpClient client = new HttpClient();
- client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", key);
- //..
- }
- ```
-
-2. In the same function above, create a request URI by combining your API host and path. Append your market to the `mkt=` parameter, and your query to the `query=` parameter. Be sure to URL-encode your query.
-
- ```csharp
- string uri = host + path + "?mkt=" + market + "&query=" + System.Net.WebUtility.UrlEncode (query);
- ```
-
-3. Send the request to the uri constructed above, and print the response.
-
- ```csharp
- HttpResponseMessage response = await client.GetAsync(uri);
-
- string contentString = await response.Content.ReadAsStringAsync();
- Console.WriteLine(contentString);
- ```
-
-4. In the main method of your program, call `Autosuggest()`.
-
- ```csharp
- static void Main(string[] args)
- {
- Autosuggest();
- Console.ReadLine();
- }
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Autosuggest tutorial](../tutorials/autosuggest.md)
-
-## See also
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/java.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Java"-
-description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and Java.
------ Previously updated : 05/06/2020----
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Java
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Java application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Java, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingAutosuggestv7.java)
-
-## Prerequisites
-
-* The [Java Development Kit(JDK)](https://www.oracle.com/technetwork/java/javase/downloads/)
-* The [Gson library](https://github.com/google/gson)
--
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries.
-
- ```java
- import java.io.*;
- import java.net.*;
- import java.util.*;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. Create variables for your subscription key, the API host and path, your [market code](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search query. Use the global endpoint below, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- static String subscriptionKey = "enter key here";
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/Suggestions";
- static String mkt = "en-US";
- static String query = "sail";
- ```
--
-## Format the response
-
-Create a method named `prettify()` to format the response returned from the Bing Video API. Use the Gson library's `JsonParser` to take in a JSON string and convert it into an object. Then, use `GsonBuilder()` and `toJson()` to create the formatted string.
-
-```java
-// pretty-printer for JSON; uses GSON parser to parse and re-serialize
-public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
-}
-```
-
-## Construct and send the search request
-
-1. Create a new method named `get_suggestions()` and perform the following steps:
-
- 1. Construct the URL for your request by combining your API host, path, and encoding your search query. Be sure to url-encode the query before appending it. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `q=` parameter.
-
- ```java
-
- public static String get_suggestions () throws Exception {
- String encoded_query = URLEncoder.encode (query, "UTF-8");
- String params = "?mkt=" + mkt + "&q=" + encoded_query;
- //...
- }
- ```
-
- 2. Create a new URL for the request with the API host, path, and parameters that you created in the previous step.
-
- ```java
- //...
- URL url = new URL (host + path + params);
- //...
- ```
-
- 3. Create a `HttpsURLConnection` object, and use `openConnection()` to create a connection. Set the request method to `GET`, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```java
- //...
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
- connection.setDoOutput(true);
- //...
- ```
-
- 4. Store the API response in `StringBuilder`. After the response has been captured, close the `InputStreamReader` stream, and return the response.
-
- ```java
- //...
- StringBuilder response = new StringBuilder ();
- BufferedReader in = new BufferedReader(
- new InputStreamReader(connection.getInputStream()));
- String line;
- while ((line = in.readLine()) != null) {
- response.append(line);
- }
- in.close();
-
- return response.toString();
- ```
-
-2. In the main function of your application, call `get_suggestions()`, and print the response by using `prettify()`.
-
- ```java
- public static void main(String[] args) {
- try {
- String response = get_suggestions ();
- System.out.println (prettify (response));
- }
- catch (Exception e) {
- System.out.println (e);
- }
- }
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/autosuggest.md)
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/nodejs.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Node.js"-
-description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and Node.js.
------ Previously updated : 05/06/2020----
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Node.js
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Node.js application sends a partial search query to the API, and returns suggestions for searches. While this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingAutosuggestv7.js)
-
-## Prerequisites
-
-* [Node.js 6](https://nodejs.org/en/download/) or later
--
-## Create a new application
-
-1. Create a new JavaScript file in your favorite IDE or editor, and set the strictness and https requirements.
-
- ```javascript
- 'use strict';
-
- let https = require ('https');
- ```
-
-2. Create variables for the API endpoint host and path, your subscription key, [market code](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search term. Use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- // Replace the subscriptionKey string value with your valid subscription key.
- let subscriptionKey = 'enter key here';
-
- let host = 'api.cognitive.microsoft.com';
- let path = '/bing/v7.0/Suggestions';
-
- let mkt = 'en-US';
- let query = 'sail';
- ```
-
-## Construct the search request and query.
-
-1. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `q=` parameter.
-
- ```javascript
- let params = '?mkt=' + mkt + '&q=' + query;
- ```
-
-2. Create a function called `get_suggestions()`. Use the variables from the last steps to format a search URL for the API request. Your search term must be URL-encoded before being sent to the API.
-
- ```javascript
- let get_suggestions = function () {
- let request_params = {
- method : 'GET',
- hostname : host,
- path : path + params,
- headers : {
- 'Ocp-Apim-Subscription-Key' : subscriptionKey,
- }
- };
- //...
- }
- ```
-
- 1. In the same function, use the request library to send your query to the API. `response_handler` is defined in the next section.
-
- ```javascript
- //...
- let req = https.request(request_params, response_handler);
- req.end();
- ```
-
-## Create a search handler
-
-1. Define a function named `response_handler` that takes an HTTP call, `response`, as a parameter.
-Do the following steps within this function:
-
- 1. Define a variable to contain the body of the JSON response.
-
- ```javascript
- let response_handler = function (response) {
- let body = '';
- };
- ```
-
- 2. Store the body of the response when the `data` flag is called
-
- ```javascript
- response.on ('data', function (d) {
- body += d;
- });
- ```
-
- 3. When an `end` flag is signaled, use `JSON.parse()` and `JSON.stringify()` to print the response.
-
- ```javascript
- response.on ('end', function () {
- let body_ = JSON.parse (body);
- let body__ = JSON.stringify (body_, null, ' ');
- console.log (body__);
- });
- response.on ('error', function (e) {
- console.log ('Error: ' + e.message);
- });
- ```
-
-2. Call `get_suggestions()` to send the request to the Bing Autosuggest API.
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/autosuggest.md)
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/php.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and PHP"-
-description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and PHP.
------ Previously updated : 05/06/2020----
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and PHP
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple PHP application sends a partial search query to the API, and returns suggestions for searches. While this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [PHP 5.6.x](https://php.net/downloads.php) or later
--
-## Get Autosuggest results
-
-1. Create a new PHP project in your favorite IDE.
-2. Add the code provided below.
-3. Replace the `subscriptionKey` value with an access key that's valid for your subscription.
-4. Use the global endpoint in the code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-5. Run the program.
-
-```php
-<?php
-
-// NOTE: Be sure to uncomment the following line in your php.ini file.
-// ;extension=php_openssl.dll
-
-// **********************************************
-// *** Update or verify the following values. ***
-// **********************************************
-
-// Replace the subscriptionKey string value with your valid subscription key.
-$subscriptionKey = 'enter key here';
-
-$host = "https://api.cognitive.microsoft.com";
-$path = "/bing/v7.0/Suggestions";
-
-$mkt = "en-US";
-$query = "sail";
-
-function get_suggestions ($host, $path, $key, $mkt, $query) {
-
- $params = '?mkt=' . $mkt . '&q=' . $query;
-
- $headers = "Content-type: text/json\r\n" .
- "Ocp-Apim-Subscription-Key: $key\r\n";
-
- // NOTE: Use the key 'http' even if you are making an HTTPS request. See:
- // https://php.net/manual/en/function.stream-context-create.php
- $options = array (
- 'http' => array (
- 'header' => $headers,
- 'method' => 'GET'
- )
- );
- $context = stream_context_create ($options);
- $result = file_get_contents ($host . $path . $params, false, $context);
- return $result;
-}
-
-$result = get_suggestions ($host, $path, $subscriptionKey, $mkt, $query);
-
-echo json_encode (json_decode ($result), JSON_PRETTY_PRINT);
-?>
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Autosuggest tutorial](../tutorials/autosuggest.md)
-
-## See also
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/python.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Python"-
-description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and Python.
------ Previously updated : 05/06/2020---
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Python
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Python application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Python, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingAutosuggestv7.py)
-
-## Prerequisites
-
-* [Python 3.x](https://www.python.org/downloads/)
--
-## Create a new application
-
-1. Create a new Python file in your favorite IDE or editor. Add the following imports:
-
- ```python
- import http.client, urllib.parse, json
- ```
-
-2. Create variables for your API host and path, [market code](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and partial search query. Use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- subscriptionKey = 'enter key here'
- host = 'api.cognitive.microsoft.com'
- path = '/bing/v7.0/Suggestions'
- mkt = 'en-US'
- query = 'sail'
- ```
-
-3. Create a parameters string by appending your market code to the `mkt=` parameter, and appending your query to the `q=` parameter.
-
- ```python
- params = '?mkt=' + mkt + '&q=' + query
- ```
-
-## Create and send an API request
-
-1. Add your subscription key to a `Ocp-Apim-Subscription-Key` header.
-
- ```python
- headers = {'Ocp-Apim-Subscription-Key': subscriptionKey}
- ```
-
-2. Connect to the API using `HTTPSConnection()`, and send the `GET` request containing your request parameters.
-
- ```python
- conn = http.client.HTTPSConnection(host)
- conn.request ("GET", path + params, None, headers)
- response = conn.getresponse ()
- return response.read ()
- ```
-
-3. Get and print the JSON response.
-
- ```python
- result = get_suggestions ()
- print (json.dumps(json.loads(result), indent=4))
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/autosuggest.md)
-
-## See also
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/quickstarts/ruby.md
- Title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Ruby"-
-description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API and Ruby.
------ Previously updated : 05/06/2020----
-# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Ruby
--
-Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Ruby application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages.
--
-## Prerequisites
-
-* [Ruby 2.4](https://www.ruby-lang.org/en/downloads/) or later.
--
-## Create a new application
-
-1. Create a new Ruby file in your favorite IDE or editor. Add the following requirements:
-
- ```ruby
- require 'net/https'
- require 'uri'
- require 'json'
- ```
-
-2. Create variables for your API host and path, [market code](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and partial search query. Use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```ruby
- subscriptionKey = 'enter your key here'
- host = 'https://api.cognitive.microsoft.com'
- path = '/bing/v7.0/Suggestions'
- mkt = 'en-US'
- query = 'sail'
- ```
-
-3. Create a parameters string by appending your market code to the `mkt=` parameter, and appending your query to the `q=` parameter. Then, construct your request URI by combining the API host, path, and the parameters string.
-
- ```ruby
- params = '?mkt=' + mkt + '&q=' + query
- uri = URI (host + path + params)
- ```
-
-## Create and send an API request
-
-1. Create a request with your URI, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```ruby
- request = Net::HTTP::Get.new(uri)
- request['Ocp-Apim-Subscription-Key'] = subscriptionKey
- ```
-
-2. Send the request, and store the response.
-
- ```ruby
- response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request (request)
- end
- ```
-
-3. Print the JSON response.
-
- ```ruby
- puts JSON::pretty_generate (JSON (response.body))
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dgvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI\u0026p\u003dDevEx,5003.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dBTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5004.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dc0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI\u0026p\u003dDevEx,5005.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dmnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI\u0026p\u003dDevEx,5006.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dWLFO-B1GG5qtBGnoU1Bizz02YKkg5fgAQtHwhXn4z8I\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailpoint%26FORM%3dUSBAPI\u0026p\u003dDevEx,5007.1",
- "displayText": "sailpoint",
- "query": "sailpoint",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003dquBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI\u0026p\u003dDevEx,5008.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003d0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI\u0026p\u003dDevEx,5009.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG\u003d2ACC4FE8B02F4AACB9182A6502B0E556\u0026CID\u003d1D546424A4CB64AF2D386F26A5CD6583\u0026rd\u003d1\u0026h\u003deSSt0MRSbl2V0RFPSuVd-gC7fGOT4717pz55EBUgPec\u0026v\u003d1\u0026r\u003dhttps%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2b2025%26FORM%3dUSBAPI\u0026p\u003dDevEx,5010.1",
- "displayText": "sailor 2025",
- "query": "sailor 2025",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/autosuggest.md)
-
-## See also
--- [What is Bing Autosuggest?](../get-suggested-search-terms.md)-- [Bing Autosuggest API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference)
cognitive-services Autosuggest https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Autosuggest/tutorials/autosuggest.md
- Title: "Tutorial: Getting Automatic suggestions Results using Bing Autosuggest API"-
-description: In this tutorial, you will build a web page that allows users to query the Bing Autosuggest API and displays the query results.
------- Previously updated : 03/05/2019---
-# Tutorial: Get search suggestions on a web page
--
-In this tutorial, we'll build a Web page that allows users to query the Bing Autosuggest API.
-
-This tutorial shows you how to:
-
-> [!div class="checklist"]
-> - Make a simple query to the Bing Autosuggest API
-> - Display query results
-
-## Prerequisites
-
-To follow along with the tutorial, you need a subscription key for the Bing Autosuggest API. If you don't have one, [create a Bing Autosuggest resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesBingAutosuggest-v7) in the Azure portal.
-
-## Create a new Web page
-
-Open a text editor. Create a new file named, for example, autosuggest.html.
-
-## HTML header
-
-Add the HTML header information and begin the script section as follows.
-
-```html
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Bing Autosuggest</title>
-
-<style type="text/css">
- html, body, div, p, h1, h2 {font-family: Verdana, "Lucida Sans", sans-serif;}
-
- html, body, div, p {font-weight: normal;}
- h1, h2 {font-weight: bold;}
- sup {font-weight: normal;}
-
- html, body, div, p {font-size: 12px;}
- h1 {font-size: 20px;}
- h2 {font-size: 16px;}
- h1, h2 {clear: left;}
-
- img#logo {float: right;
-</style>
-
-<script type="text/javascript">
-```
-
-## getSubscriptionKey function
-
-The getSubscriptionKey function returns the Bing Autosuggest API key. It either retrieves it from
-local storage (that is, a cookie) or prompts the user for if needed.
-
-Begin the getSubscriptionKey function and declare the cookie name as follows.
-
-```html
-getSubscriptionKey = function() {
-
- var COOKIE = "bing-autosuggest-api-key"; // name used to store API key in key/value storage
-```
-
-The findCookie helper function returns the value of the specified cookie; if the cookie is not
-found, it returns an empty string.
-
-```html
- function findCookie(name) {
- var cookies = document.cookie.split(";");
- for (var i = 0; i < cookies.length; i++) {
- var keyvalue = cookies[i].split("=");
- if (keyvalue[0].trim() === name) {
- return keyvalue[1];
- }
- }
- return "";
- }
-```
-
-The getSubscriptionKeyCookie helper function prompts the user for the value of the Bing
-Autosuggest API key, and returns the key value.
-
-```html
- function getSubscriptionKeyCookie() {
- var key = findCookie(COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Autosuggest API subscription key:", "").trim();
- var expiry = new Date();
- expiry.setFullYear(expiry.getFullYear() + 2);
- document.cookie = COOKIE + "=" + key.trim() + "; expires=" + expiry.toUTCString();
- }
- return key;
- }
-```
-
-The getSubscriptionKeyLocalStorage helper function first tries to retrieve the Bing Autosuggest
-API key by looking up the appropriate cookie. If the cookie is not found, it prompts the user for
-the key value. It then returns the key value.
-
-```html
- function getSubscriptionKeyLocalStorage() {
- var key = localStorage.getItem(COOKIE) || "";
- while (key.length !== 32)
- key = prompt("Enter Bing Autosuggest API subscription key:", "").trim();
- localStorage.setItem(COOKIE, key)
- return key;
- }
-```
-
-The getSubscriptionKey helper function takes one parameter, **invalidate**. If **invalidate** is
-**true**, getSubscriptionKey deletes the cookie that contains the Bing Autosuggest API key. If
-**invalidate** is **false**, getSubscriptionKey returns the value of the Bing Autosuggest API key.
-
-```html
- function getSubscriptionKey(invalidate) {
- if (invalidate) {
- try {
- localStorage.removeItem(COOKIE);
- } catch (e) {
- document.cookie = COOKIE + "=";
- }
- } else {
- try {
- return getSubscriptionKeyLocalStorage();
- } catch (e) {
- return getSubscriptionKeyCookie();
- }
- }
- }
-```
-
-Return the getSubscriptionKey helper function as the result of the outer getSubscriptionKey
-function. Close the definition of the outer getSubscriptionKey function.
-
-```html
- return getSubscriptionKey;
-
-}();
-```
-
-## Helper functions
-
-The pre helper function returns the specified text preformatted with the [pre](https://www.w3schools.com/tags/tag_pre.asp)
-HTML tag.
-
-```html
-function pre(text) {
- return "<pre>" + text.replace(/&/g, "&amp;").replace(/</g, "&lt;") + "</pre>"
-}
-```
-
-The renderSearchResults function displays the specified results from the Bing Autosuggest API, using JSON pretty printing.
-
-```html
-function renderSearchResults(results) {
- document.getElementById("results").innerHTML = pre(JSON.stringify(results, null, 2));
-}
-```
-
-The renderErrorMessage function displays the specified error message and error code.
-
-```html
-function renderErrorMessage(message, code) {
- if (code)
- document.getElementById("results").innerHTML = "<pre>Status " + code + ": " + message + "</pre>";
- else
- document.getElementById("results").innerHTML = "<pre>" + message + "</pre>";
-}
-```
-
-## bingAutosuggest function
-
-The bingAutosuggest function is called each time the user enters text in the HTML form field.
-It takes two parameters: the contents of the HTML form field, and the Bing Autosuggest API key.
-
-```html
-function bingAutosuggest(query, key) {
-```
-
-Specify the Bing Autosuggest API endpoint and declare an XMLHttpRequest object, which we will
-use to send requests. You can use the global endpoint below, or the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```html
- var endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/Suggestions";
-
- var request = new XMLHttpRequest();
-
- try {
- request.open("GET", endpoint + "?q=" + encodeURIComponent(query));
- }
- catch (e) {
- renderErrorMessage("Bad request");
- return false;
- }
-```
-
-Set the **Ocp-Apim-Subscription-Key** header to the value of the Bing Autosuggest API key.
-
-```html
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
-```
-
-Handle the response from the endpoint. If the status is 200 (OK), display the results; otherwise,
-display the error information.
-
-```html
- request.addEventListener("load", function() {
- if (this.status === 200) {
- renderSearchResults(JSON.parse(this.responseText));
- }
- else {
- if (this.status === 401) getSubscriptionKey(true);
- renderErrorMessage(this.statusText, this.status);
- }
- });
-```
-
-Also handle possible error events from the XMLHttpRequest object.
-
-```html
- request.addEventListener("error", function() {
- renderErrorMessage("Network error");
- });
-
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-```
-
-Send the request. Close the bingAutosuggest function, the **script** tag, and the **head** tag.
-
-```html
- request.send();
- return false;
-}
-// --></script>
-
-</head>
-```
-
-## HTML body
-
-When the Web page loads, make sure we have the Bing Autosuggest API key, prompting the user for it if needed.
-
-```html
-<body onload="document.forms.bing.query.focus(); getSubscriptionKey();">
-```
-
-Display the Bing logo.
-
-```html
-<img id="logo" align=base src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAyCAIAAAAYxYiPAAAAA3NCSVQICAjb4U/gAAARMElEQVR42u2bCVRUV5rHi8VxaeNuOumYTs706aTTZrp7TqbTk5g+9kn3OZN0pjudpZM5SfdJzEzPyZmO1gbIJhmNmijy6hUFsisCgsqigoCt7IoKgoDgUgXILntR+/aWzHfvfQUFFEURsU8cKe/hFFL16r3f++53/9//uyXSWUwjZgPDshzHcy4PnuMXHvP4EJ1qufpPyRHby3Iv93XqbDY7y7IC9QU48wr6RMtVEb1NpJAvoeQvpVF7L5c0jQ6ZHAwJcH6B+HyBzm6pEymkIlomouUiWiqiJCvpwDdOxCdfr+nV6x0Mwy+gnqeIJqAxa3iikJDhEyX5fmx4eZcGJ+yFxz2DPg6pQwA9eQBuSnJC3bCQPe4/6ChxjqbxAVQgnHM8OKBzW5s4lucfsOSxAHoWPh4eggRy/ubprQzL6a1Wo83KfZuWl5lBU39v0CDeQcDbGQa0PB7jT4RfHawDJD562bTzERiznI1l4xurX0yNfCVdcUbTAtAXQE+PSnbEYgkoyfmkOGNL8dEtxZkwPhFGFjz/tCR7b+35su5WrcXCuq1gOa5ZO7Q6eruIBuEk/WH8zj6LaQH0dNB8t8X03dgIqJ6cQyainENBhmSJQvxi2v4j12tMqIydFN3wy8XuO0sOSNEVUZI1ypA23cgCaDegewTQAlYfGNTEQCWVQkrO1l8h+eu5E2M2m+u5AfRBq+Xf0unFlHSxUv5BQZqRcSyAdg/60dgd+NPFf8hPiaotPQCjpnR/bWnExcI/5h96KmmXHyqsUGbwo+S7Lp2zu0Y0immuR6/NbLqSc7NhxGb59qyGXoMm6/59Bt0rgEYcY+svsOz4IscxHJhdXK/REFRZsISENiX9fkx4q0E3nqnRKxFrbIux5I3fnhL8Rp038o77u2iluxbjo7Fh+HwkqmvVnBt1wVoZ9rPibB8KQCPc6Tfr3cmQb6HX4QH0gW0ENATIHe2gwW5lp4rb+wZaKVE2uAWNgraqp2OJkqRsyb7qc+OgJ+tuMhG5mWS6kGsEhc4730TeJ/zXN1X9bh4zg4bhAlpSfPS149Gqa1U3RgeMdlCraCqji55f0GZIHeEkoqMbqqdXd/j3r2/ptd+JDhQpUbLec6GYnQyaQY46KlsQLpfcgZx2koI4IScRSQ6vtzIM1DhjVovJbnOgtCOkHo+qH+t+JPAdAERvMessZrPdzuBqYNLxcQ3lFWh4Y2mnelmU2EcpWR8T+ubJ5JTmq61jWjPjmF683V/QuLRuHBlcCuKPkvlFSVKba3ERw5HbAJjKutU5rU25msbmgT7X0zE5HPmtzdmaxhx1Y59eR25Jl24sqeHynwozXj2m2pRJv5EXF1p++lJfp4VhZpy1+H/hzzqrtayrNbQ8/628xFcyqV8di34vL2XfxfMtw/1WtEywl3o7cjXXc2431fZ2zgI6D0CjIzN6u+Pl1AOiaCJRpb5Rkqfid/65MCNPfb3PqIeIwPGN/t1X0CwSFmx6S70f0nmyNcqgOu0AClyeJbcB5N4v0ykQLT6UJLAkx/XG95j0j0YH+dAS36itJ243WR3M0VsNG5N2+0fB2itGKzC6amQRr1WGhFadGXWmymmzioPbWdvf87vchOWwTlBEO4iJePc/INkQu2NfXaXWbn8//7Nsr17X0N9T1aWBErSkSwNlt2Z0SG+DpOCm8fJ/b7k8gBQkHh4AAAAASUVORK5CYII=">
-```
-
-Create an HTML form with a text field. Handle the `oninput` event and call the `bingAutosuggest()`
-function, passing the contents of the text field and the Bing Autosuggest API key.
-
-```html
-<form name="bing" oninput="return bingAutosuggest(this.query.value, getSubscriptionKey())">
- <h2>Autosuggest</h2>
- <input type="text" name="query" size="80" placeholder="Autosuggest" autocomplete=off>
-</form>
-```
-
-Add the HTML **div** tag that we use to display the results. The JavaScript we defined
-previously refers to this **div** tag.
-
-```html
-<h2>Results</h2>
-<div id="results">
-<p>None yet.</p>
-
-</div>
-
-</body>
-</html>
-```
-
-Save the file.
-
-## Display results
-
-Open the Web page in your browser. At the prompt, enter your Bing Autosuggest API subscription key. Then enter a query (for example, "sail") in the **Autosuggest** text box. As you type, the Web page automatically updates to display the Autosuggest results.
-
-```json
-{
- "_type": "Suggestions",
- "queryContext": {
- "originalQuery": "sail"
- },
- "suggestionGroups": [
- {
- "name": "Web",
- "searchSuggestions": [
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=vheQSvKZylM3dlX_B9bQ8-hQEsEJo8zDD2y7H1nsBjE&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2bbrinkley%2bcook%26FORM%3dUSBAPI&p=DevEx,5003.1",
- "displayText": "sailor brinkley cook",
- "query": "sailor brinkley cook",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=EStLqAfxGCa44Ur3jEMXBv-Qp-lXUSFJbkBfnUdKKDg&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailor%2bbrinkley%26FORM%3dUSBAPI&p=DevEx,5004.1",
- "displayText": "sailor brinkley",
- "query": "sailor brinkley",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=gvtP9TS9NwhajSapY2Se6y1eCbP2fq_GiP2n-cxi6OY&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailrite%26FORM%3dUSBAPI&p=DevEx,5005.1",
- "displayText": "sailrite",
- "query": "sailrite",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=c0QOA_j6swCZJy9FxqOwke2KslJE7ZRmMooGClAuCpY&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboats%2bfor%2bsale%26FORM%3dUSBAPI&p=DevEx,5006.1",
- "displayText": "sailboats for sale",
- "query": "sailboats for sale",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=mnMdREUH20SepmHQH1zlh9Hy_w7jpOlZFm3KG2R_BoA&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailing%2banarchy%26FORM%3dUSBAPI&p=DevEx,5007.1",
- "displayText": "sailing anarchy",
- "query": "sailing anarchy",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=0udadFl0gCTKCp0QmzQTXS3_y08iO8FpwsoKPHPS6kw&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailboatdata%26FORM%3dUSBAPI&p=DevEx,5008.1",
- "displayText": "sailboatdata",
- "query": "sailboatdata",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=BTS0G6AakxntIl9rmbDXtk1n6rQpsZZ99aQ7ClE7dTY&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsail%2bsand%2bpoint%26FORM%3dUSBAPI&p=DevEx,5009.1",
- "displayText": "sail sand point",
- "query": "sail sand point",
- "searchKind": "WebSearch"
- },
- {
- "url": "https://www.bing.com/cr?IG=30C49D910FAE478288D54A8DBC5D66F1&CID=122B759B00966D02199C7E9001906C30&rd=1&h=quBMwmKlGwqC5wAU0K7n416plhWcR8zQCi7r-Fw9Y0w&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dsailflow%26FORM%3dUSBAPI&p=DevEx,5010.1",
- "displayText": "sailflow",
- "query": "sailflow",
- "searchKind": "WebSearch"
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Use and display requirements](../../bing-web-search/use-display-requirements.md)
cognitive-services Call Endpoint Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/call-endpoint-csharp.md
- Title: "Quickstart: Call your Bing Custom Search endpoint using C# | Microsoft Docs"-
-description: "Use this quickstart to begin requesting search results from your Bing Custom Search instance in C#. "
------ Previously updated : 05/08/2020----
-# Quickstart: Call your Bing Custom Search endpoint using C#
--
-Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in C#, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingCustomSearchv7.cs).
-
-## Prerequisites
--- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).-- [Microsoft .NET Core](https://dotnet.microsoft.com/download).-- Any edition of [Visual Studio 2019 or later](https://www.visualstudio.com/downloads/).-- If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).-- The [Bing Custom Search](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomSearch/2.0.0) NuGet package. -
- To install this package in Visual Studio:
- 1. Right-click your project in **Solution Explorer**, and then select **Manage NuGet Packages**.
- 2. Search for and select *Microsoft.Azure.CognitiveServices.Search.CustomSearch*, and then install the package.
-
- When you install the Bing Custom Search NuGet package, Visual Studio also installs the following packages:
- - **Microsoft.Rest.ClientRuntime**
- - **Microsoft.Rest.ClientRuntime.Azure**
- - **Newtonsoft.Json**
---
-## Create and initialize the application
-
-1. Create a new C# console application in Visual Studio. Then, add the following packages to your project:
-
- ```csharp
- using System;
- using System.Net.Http;
- using System.Web;
- using Newtonsoft.Json;
- ```
-
-2. Create the following classes to store the search results returned by the Bing Custom Search API:
-
- ```csharp
- public class BingCustomSearchResponse {
- public string _type{ get; set; }
- public WebPages webPages { get; set; }
- }
-
- public class WebPages {
- public string webSearchUrl { get; set; }
- public int totalEstimatedMatches { get; set; }
- public WebPage[] value { get; set; }
- }
-
- public class WebPage {
- public string name { get; set; }
- public string url { get; set; }
- public string displayUrl { get; set; }
- public string snippet { get; set; }
- public DateTime dateLastCrawled { get; set; }
- public string cachedPageUrl { get; set; }
- }
- ```
-
-3. In the main method of your project, create the following variables for your Bing Custom Search API subscription key, search instance's custom configuration ID, and search term:
-
- ```csharp
- var subscriptionKey = "YOUR-SUBSCRIPTION-KEY";
- var customConfigId = "YOUR-CUSTOM-CONFIG-ID";
- var searchTerm = args.Length > 0 ? args[0]:"microsoft";
- ```
-
-4. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). For the `url` variable value, you can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- var url = "https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?" +
- "q=" + searchTerm + "&" +
- "customconfig=" + customConfigId;
- ```
-
-## Send and receive a search request
-
-1. Create a request client, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```csharp
- var client = new HttpClient();
- client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
- ```
-
-2. Perform the search request and get the response as a JSON object.
-
- ```csharp
- var httpResponseMessage = client.GetAsync(url).Result;
- var responseContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
- BingCustomSearchResponse response = JsonConvert.DeserializeObject<BingCustomSearchResponse>(responseContent);
- ```
-## Process and view the results
--- Iterate over the response object to display information about each search result, including its name, url, and the date the webpage was last crawled.-
- ```csharp
- for(int i = 0; i < response.webPages.value.Length; i++) {
- var webPage = response.webPages.value[i];
-
- Console.WriteLine("name: " + webPage.name);
- Console.WriteLine("url: " + webPage.url);
- Console.WriteLine("displayUrl: " + webPage.displayUrl);
- Console.WriteLine("snippet: " + webPage.snippet);
- Console.WriteLine("dateLastCrawled: " + webPage.dateLastCrawled);
- Console.WriteLine();
- }
- Console.WriteLine("Press any key to exit...");
- Console.ReadKey();
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Custom Search web app](./tutorials/custom-search-web-page.md)
cognitive-services Call Endpoint Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/call-endpoint-java.md
- Title: "Quickstart: Call your Bing Custom Search endpoint using Java | Microsoft Docs"-
-description: Use this quickstart to begin requesting search results from your Bing Custom Search instance in Java.
------ Previously updated : 05/08/2020----
-# Quickstart: Call your Bing Custom Search endpoint using Java
--
-Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in Java, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingCustomSearchv7.java).
-
-## Prerequisites
--- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).--- The latest [Java Development Kit](https://www.oracle.com/technetwork/java/javase/downloads/https://docsupdatetracker.net/index.html).--- The [Gson library](https://github.com/google/gson).--
-## Create and initialize the application
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.io.InputStream;
- import java.net.URL;
- import java.net.URLEncoder;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.Scanner;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. Create a class named `CustomSrchJava`, and then create variables for your subscription key, custom search endpoint, and search instance's custom configuration ID. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
- ```java
- public class CustomSrchJava {
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bingcustomsearch/v7.0/search";
- static String subscriptionKey = "YOUR-SUBSCRIPTION-KEY";
- static String customConfigId = "YOUR-CUSTOM-CONFIG-ID";
- static String searchTerm = "Microsoft";
- ...
- ```
-
-3. Create another class named `SearchResults` to contain the response from your Bing Custom Search instance.
-
- ```java
- class SearchResults {
- HashMap<String, String> relevantHeaders;
- String jsonResponse;
- SearchResults(HashMap<String, String> headers, String json) {
- relevantHeaders = headers;
- jsonResponse = json;
- }
- }
- ```
-
-4. Create a function named `prettify()` to format the JSON response from the Bing Custom Search API.
-
- ```java
- // pretty-printer for JSON; uses GSON parser to parse and re-serialize
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
- ```
-
-## Send and receive a search request
-
-1. Create a function named `SearchWeb()` that sends a request and returns a `SearchResults` object. Create the request url by combining your custom configuration ID, query, and endpoint information. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```java
- public class CustomSrchJava {
- ...
- public static SearchResults SearchWeb (String searchQuery) throws Exception {
- // construct the URL for your search request (endpoint + query string)
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchTerm, "UTF-8") + "&CustomConfig=" + customConfigId);
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
- ...
- ```
-
-2. Create a stream and store the JSON response in a `SearchResults` object.
-
- ```java
- public class CustomSrchJava {
- ...
- public static SearchResults SearchWeb (String searchQuery) throws Exception {
- ...
- // receive the JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
-
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
-
- stream.close();
- return results;
- }
- ```
-
-3. Print the JSON response.
-
- ```java
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(result.jsonResponse));
- ```
-
-4. Run the program.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Custom Search web app](./tutorials/custom-search-web-page.md)
cognitive-services Call Endpoint Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/call-endpoint-nodejs.md
- Title: "Quickstart: Call your Bing Custom Search endpoint using Node.js | Microsoft Docs"-
-description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Node.js.
------ Previously updated : 05/08/2020----
-# Quickstart: Call your Bing Custom Search endpoint using Node.js
--
-Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in JavaScript, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingCustomSearchv7.js).
-
-## Prerequisites
--- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).--- [The Node.js JavaScript runtime](https://www.nodejs.org/).--- The [JavaScript request library](https://github.com/request/request).--
-## Create and initialize the application
--- Create a new JavaScript file in your favorite IDE or editor, and add a `require()` statement for the requests library. Create variables for your subscription key, custom configuration ID, and search term.-
- ```javascript
- var request = require("request");
-
- var subscriptionKey = 'YOUR-SUBSCRIPTION-KEY';
- var customConfigId = 'YOUR-CUSTOM-CONFIG-ID';
- var searchTerm = 'microsoft';
- ```
-
-## Send and receive a search request
-
-1. Create a variable to store the information being sent in your request. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- var info = {
- url: 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?' +
- 'q=' + searchTerm + "&" +
- 'customconfig=' + customConfigId,
- headers: {
- 'Ocp-Apim-Subscription-Key' : subscriptionKey
- }
- }
- ```
-
-1. Use the JavaScript request library to send a search request to your Bing Custom Search instance and print information about the results, including its name, url, and the date the webpage was last crawled.
-
- ```javascript
- request(info, function(error, response, body){
- var searchResponse = JSON.parse(body);
- for(var i = 0; i < searchResponse.webPages.value.length; ++i){
- var webPage = searchResponse.webPages.value[i];
- console.log('name: ' + webPage.name);
- console.log('url: ' + webPage.url);
- console.log('displayUrl: ' + webPage.displayUrl);
- console.log('snippet: ' + webPage.snippet);
- console.log('dateLastCrawled: ' + webPage.dateLastCrawled);
- console.log();
- }
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Custom Search web app](./tutorials/custom-search-web-page.md)
cognitive-services Call Endpoint Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/call-endpoint-python.md
- Title: "Quickstart: Call your Bing Custom Search endpoint using Python | Microsoft Docs"-
-description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Python.
------ Previously updated : 05/08/2020----
-# Quickstart: Call your Bing Custom Search endpoint using Python
--
-Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in Python, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingCustomSearchv7.py).
-
-## Prerequisites
--- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).-- [Python](https://www.python.org/) 2.x or 3.x.---
-## Create and initialize the application
--- Create a new Python file in your favorite IDE or editor, and add the following import statements. Create variables for your subscription key, custom configuration ID, and search term.-
- ```python
- import json
- import requests
-
- subscriptionKey = "YOUR-SUBSCRIPTION-KEY"
- customConfigId = "YOUR-CUSTOM-CONFIG-ID"
- searchTerm = "microsoft"
- ```
-
-## Send and receive a search request
-
-1. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?' + 'q=' + searchTerm + '&' + 'customconfig=' + customConfigId
- ```
-
-2. Send the request to your Bing Custom Search instance, and print the returned search results.
-
- ```python
- r = requests.get(url, headers={'Ocp-Apim-Subscription-Key': subscriptionKey})
- print(r.text)
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Custom Search web app](./tutorials/custom-search-web-page.md)
cognitive-services Define Custom Suggestions https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/define-custom-suggestions.md
- Title: Define Custom Autosuggest suggestions - Bing Custom Search-
-description: Custom Autosuggest returns a list of suggested search query strings that are relevant to your search experience.
------- Previously updated : 02/12/2019---
-# Configure your custom autosuggest experience
--
-Custom Autosuggest returns a list of suggested search query strings that are relevant to your search experience. The suggested query strings are based on a partial query string that the user provides in the search box. The list will contain a maximum of 10 suggestions.
-
-You specify whether to return only custom suggestions or to also include Bing suggestions. If you include Bing suggestions, custom suggestions appear before the Bing suggestions. If you provide enough relevant suggestions, it's possible that the returned list of suggestions will not include Bing suggestions. Bing suggestions are always in the context of your Custom Search instance.
-
-To configure search query suggestions for your instance, click the **Autosuggest** tab.
-
-> [!NOTE]
-> To use this feature, you must subscribe to Custom Search at the appropriate level (see [pricing](https://azure.microsoft.com/pricing/details/cognitive-services/bing-custom-search/)).
-
-It can take up to 24 hours for suggestions to be reflected in the serving endpoint (API or hosted UI).
-
-## Enable Bing suggestions
-
-To enable Bing suggestions, toggle the **Automatic Bing suggestions** slider to the on position. The slider becomes blue.
-
-## Add your own suggestions
-
-To add your own query string suggestions, add them to the list under **User-defined suggestions**. After adding a suggestion in the list, press the enter key or click the **+** icon. You can specify the suggestion in any language. You can add a maximum of 5,000 query string suggestions.
-
-## Upload suggestions
-
-As an option, you can upload a list of suggestions from a file. The file must contain one search query string per line. To upload the file, click the upload icon and select the file to upload. The service extracts the suggestions from the file and adds them to the list.
-
-## Remove suggestions
-
-To remove a query string suggestion, click the remove icon next to the suggestion you want to remove.
-
-## Block suggestions
-
-If you include Bing suggestions, you can add a list of search query strings you don't want Bing to return. To add blocked query strings, click **Show blocked suggestions**. Add the query string to the list and press the enter key or click the **+** icon. You can add a maximum of 50 blocked query strings.
----
->[!NOTE]
->It may take up to 24 hours for Custom Autosuggest configuration changes to take effect.
--
-## Enabling Autosuggest in Hosted UI
-
-To enable query string suggestions for your hosted UI, click **Hosted UI**. Scroll down to the **Additional Configuration** section. Under **Web search**, select **On** for **Enable autosuggest**. To enable Autosuggest, you must select a layout that includes a search box.
--
-## Calling the Autosuggest API
-
-To get suggested query strings using the Bing Custom Search API, send a `GET` request to the following endpoint.
-
-```
-GET https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/Suggestions
-```
-
-The response contains a list of `SearchAction` objects that contain the suggested query strings.
-
-```
- {
- "displayText" : "sailing lessons seattle",
- "query" : "sailing lessons seattle",
- "searchKind" : "CustomSearch"
- },
-```
-
-Each suggestion includes a `displayText` and `query` field. The `displayText` field contains the suggested query string that you use to populate your search box's dropdown list.
-
-If the user selects a suggested query string from the dropdown list, use the query string in the `query` field when calling the [Bing Custom Search API](overview.md).
--
-## Next steps
--- [Get custom suggestions]()-- [Search your custom instance](./search-your-custom-view.md)-- [Configure and consume custom hosted UI](./hosted-ui.md)
cognitive-services Define Your Custom View https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/define-your-custom-view.md
- Title: Configure your Bing Custom Search experience | Microsoft Docs-
-description: The portal lets you create a search instance that specifies the slices of the web; domains, subpages, and webpages.
------- Previously updated : 02/12/2019---
-# Configure your Bing Custom Search experience
--
-A Custom Search instance lets you tailor the search experience to include content only from websites that your users care about. Instead of performing a web-wide search, Bing searches only the slices of the web that interest you. To create your custom view of the web, use the Bing Custom Search [portal](https://www.customsearch.ai).
-
-The portal lets you create a search instance that specifies the slices of the web: domains, subpages, and webpages, that you want Bing to search, and those that you donΓÇÖt want it to search. The portal can also suggest content that you may want to include.
-
-Use the following when defining your slices of the web:
-
-| Slice name | Description |
-|||
-| Domain | A domain slice includes all content found within an internet domain. For example, `www.microsoft.com`. Omitting `www.` causes Bing to also search the domainΓÇÖs subdomains. For example, if you specify `microsoft.com`, Bing also returns results from `support.microsoft.com` or `technet.microsoft.com`. |
-| Subpage | A subpage slice includes all content found in the subpage and paths below it. You may specify a maximum of two subpages in the path. For example, `www.microsoft.com/en-us/windows/` |
-| Webpage | A webpage slice can include only that webpage in a custom search. You can optionally specify whether to include subpages. |
-
-> [!IMPORTANT]
-> All domains, subpages, and webpages that you specify must be public and indexed by Bing. If you own a public site that you want to include in the search, and Bing hasnΓÇÖt indexed it, see the Bing [webmaster documentation](https://www.bing.com/webmaster/help/webmaster-guidelines-30fba23a) for details about getting Bing to index it. Also, see the webmaster documentation for details about getting Bing to update your crawled site if the index is out of date.
-
-## Add slices of the web to your custom search instance
-
-When you create your custom search instance, you can specify the slices of the web: domains, subpages, and webpages, that you want to have included or blocked from your search results.
-
-If you know the slices you want to include in your custom search instance, add them to your instanceΓÇÖs **Active** list.
-
-If youΓÇÖre not sure which slices to include, you can send search queries to Bing in the **Preview** pane and select the slices that you want. To do this:
-
-1. select "Bing" from the dropdown list in the Preview pane, and enter a search query
-
-2. Click **Add site** next to the result you want to include. Then click OK.
-
->[!NOTE]
-> [!INCLUDE[publish or revert](./includes/publish-revert.md)]
-
-<a name="active-and-blocked-lists"></a>
-
-### Customize your search experience with Active and Blocked lists
-
-You can access the list of active and blocked slices by clicking on the **Active** and **Blocked** tabs in your custom search instance. Slices added to the active list will be included in your custom search. Blocked slices won't be searched, and won't appear in your search results.
-
-To specify the slices of the web you want Bing to search, click the **Active** tab and add one or more URLs. To edit or delete URLs, use the options under the **Controls** column.
-
-When adding URLs to the **Active** list you can add single URLs, or multiple URLs at once by uploading a text file using the upload icon.
-
-![The Bing Custom Search Active tab](media/file-upload-icon.png)
-
-To upload a file, create a text file and specify a single domain, subpage, or webpage per line. Your file will be rejected if it isn't formatted correctly.
-
-> [!NOTE]
-> * You can only upload a file to the **Active** list. You cannot use it to add slices to the **Blocked** list.
-> * If the **Blocked** list contains a domain, subpage, or webpage that you specified in the upload file, it will be removed from the **Blocked** list, and added to the **Active** list.
-> * Duplicate entries in your upload file will be ignored by Bing Custom Search.
-
-### Get website suggestions for your search experience
-
-After adding web slices to the **Active** list, the Bing Custom Search portal will generate website and subpage suggestions at the bottom of the tab. These are slices that Bing Custom Search thinks you might want to include. Click **Refresh** to get updated suggestions after updating your custom search instance's settings. This section is only visible if suggestions are available.
-
-## Search for images and videos
-
-You can search for images and videos similarly to web content by using the [Bing Custom Image Search API](/rest/api/cognitiveservices-bingsearch/bing-custom-images-api-v7-reference) or the [Bing Custom Video Search API](/rest/api/cognitiveservices-bingsearch/bing-custom-videos-api-v7-reference). You can display these results with the [hosted UI](hosted-ui.md), or the APIs.
-
-These APIs are similar to the non-custom [Bing Image Search](../bing-image-search/overview.md) and [Bing Video Search](../bing-video-search/overview.md) APIs, but search the entire web, and do not require the `customConfig` query parameter. See these documentation sets for more information on working with images and videos.
-
-## Test your search instance with the Preview pane
-
-You can test your search instance by using the preview pane on the portal's right side to submit search queries and view the results.
-
-1. Below the search box, select **My Instance**. You can compare the results from your search experience to Bing, by selecting **Bing**.
-2. Select a safe search filter and which market to search (see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#query-parameters)).
-3. Enter a query and press enter or click the search icon to view the results from the current configuration. You can change your search type you perform by clicking **Web**, **Image**, or **Video** to get corresponding results.
-
-<a name="adjustrank"></a>
-
-## Adjust the rank of specific search results
-
-The portal enables you to adjust the search ranking of content from specific domains, subpages, and webpages. After sending a search query in the preview pane, each search result contains a list of adjustments you can make for it:
-
-| Adjustment | Description |
-||-|
-| Block | Moves the domain, subpage, or webpage to the Blocked list. Bing will exclude content from the selected site from appearing in the search results. |
-| Boost | Boosts content from the domain or subpage to be higher in the search results. |
-| Demote | Demotes content from the domain or subpage lower in the search results. You select whether to demote content from the domain or subpage that the webpage belongs to. |
-| Pin to top | Moves the domain, subpage, or webpage to the **Pinned** list. This Forces the webpage to appear as the top search result for a given search query. |
-
-Adjusting rank is not available for image or video searches.
-
-### Boosting and demoting search results
-
-You can super boost, boost, or demote any domain or subpage in the **Active** list. By default, all slices are added with no ranking adjustments. Slices of the web that are Super boosted or Boosted are ranked higher in the search results (with super boost ranking higher than boost). Items that are demoted are ranked lower in the search results.
-
-You can super boost, boost, or demote items by using the **Ranking Adjust** controls in the **Active** list, or by using the Boost and Demote controls in the Preview pane. The service adds the slice to your Active list and adjusts the ranking accordingly.
-
-> [!NOTE]
-> Boosting and demoting domains and subpages is one of many methods Bing Custom Search uses to determine the order of search results. Because of other factors influencing the ranking of different web content, the effects of adjusting rank may vary. Use the Preview pane to test the effects of adjusting the rank of your search results.
-
-Super boost, boost, and demote are not available for the image and video searches.
-
-## Pin slices to the top of search results
-
-The portal also lets you pin URLs to the top of search results for specific search terms, using the **Pinned** tab. Enter a URL and query to specify the webpage that will appear as the top result. Note that you can pin a maximum of one webpage per search query, and only indexed webpages will be displayed in searches. Pinning results is not available for image or video searches.
-
-You can pin a webpage to the top in two ways:
-
-* In the **Pinned** tab, enter the URL of the webpage to pin to the top, and its corresponding query.
-
-* In the **Preview** pane, enter a search query and click search. Find the webpage you want to pin for your query, and click **Pin to top**. the webpage and query will be added to the **Pinned** list.
-
-### Specify the pin's match condition
-
-By default, webpages are only pinned to the top of search results when a user's query string exactly matches one listed in the **Pinned** list. You can change this behavior by specifying one of the following match conditions:
-
-> [!NOTE]
-> All comparisons between the user's search query, and the pin's search query are case insensitive.
-
-| Value | Description |
-||-|
-| Starts with | The pin is a match if the user's query string starts with the pin's query string |
-| Ends with | The pin is a match if the user's query string ends with the pin's query string. |
-| Contains | The pin is a match if the user's query string contains the pin's query string. |
--
-To change the pin's match condition, click the pin's edit icon. In the **Query match condition** column, click the dropdown list and select the new condition to use. Then, click the save icon to save the change.
-
-### Change the order of your pinned sites
-
-To change the order of your pins, you can drag-and-drop the them, or edit their order number by clicking the "edit" icon in the **Controls** Column of the **Pinned** list.
-
-If multiple pins satisfy a match condition, Bing Custom Search will use the one highest in the list.
-
-## View statistics
-
-If you subscribed to Custom Search at the appropriate level (see the [pricing pages](https://azure.microsoft.com/pricing/details/cognitive-services/bing-custom-search/)), a **Statistics** tab is added to your production instances. The statistics tab shows details about how your Custom Search endpoints are used, including call volume, top queries, geographic distribution, response codes, and safe search. You can filter details using the provided controls.
-
-## Usage guidelines
--- For each custom search instance, the maximum number of ranking adjustments that you may make to **Active** and **Blocked** slices is limited to 400.-- Adding a slice to the Active or Blocked tabs counts as one ranking adjustment.-- Boosting and demoting count as two ranking adjustments.-- For each custom search instance, the maximum number of pins that you may make is limited to 200.-
-## Next steps
--- [Call your custom search](./search-your-custom-view.md)-- [Configure your hosted UI experience](./hosted-ui.md)-- [Use decoration markers to highlight text](../bing-web-search/hit-highlighting.md)-- [Page webpages](../bing-web-search/paging-search-results.md)
cognitive-services Endpoint Custom https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/endpoint-custom.md
- Title: Bing Custom Search endpoint-
-description: Create tailored search experiences for topics that you care about. Users see search results tailored to the content they care about.
------- Previously updated : 03/04/2019---
-# Custom Search
-
-Bing Custom Search enables you to create tailored search experiences for topics that you care about. Your users see search results tailored to the content they care about instead of having to page through search results that have irrelevant content.
-
-## Custom Search Endpoint
-To get results using the Bing Custom Search API, send a `GET` request to the following endpoint. Use the headers and URL parameters to define further specifications.
-
-Endpoint: Returns search suggestions as JSON results that are relevant to the user's input defined by `?q=""`.
-```
- GET https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search
-```
-
-For examples that describe how to set up Custom Search sources, see the [tutorial](./tutorials/custom-search-web-page.md). For details about headers, parameters, market codes, response objects, errors, etc., see the [Bing Custom Search API v7](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference) reference.
-
-## Custom Search Response JSON
-A custom search request returns results as JSON objects, see [Response objects](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#response-objects).
-
-## Custom Autosuggest
-The Custom Autosuggest API lets you send a partial search query term to Bing and get back a list of suggested queries that you can configure. With Custom Autosuggest, you add suggestions returned by the API and optionally specify whether to include suggestions generated by Bing.
-
-## Custom Autosuggest Endpoint
-To request custom query suggestions, send a GET request to:
-
-```
-https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/Suggestions
-```
-
-For information about defining custom suggestions, see [Define custom search suggestions](define-custom-suggestions.md).
-
-## Custom Image Search
-The Custom Image Search API lets you send a search query to Bing and get back a list of relevant images from your Custom Search instance.
-
-## Custom Image Search Endpoint
-To request images from your Custom Search instance, send a GET request to the following URL:
-
-```
-https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/images/search
-```
-
-For information about configuring a Custom Search instance, see [Configure your custom search experience](./define-your-custom-view.md).
-
-## Next steps
-The **Bing** APIs support search actions that return results according to their type. All search endpoints return results as JSON response objects.  All endpoints support queries that return a specific language and/or location by longitude, latitude, and search radius.
-
-For complete information about the parameters supported by each endpoint, see the reference pages for each type.
-For examples of basic requests using the Custom Search API, see [Custom Search Quick-starts](/azure/cognitive-services/bing-custom-search/quick-start)
cognitive-services Get Images From Instance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/get-images-from-instance.md
- Title: Get images from your custom view - Bing Custom Search-
-description: High-level overview about using Bing Custom Search to get images from your custom view of the Web.
------- Previously updated : 09/10/2018---
-# Get images from your custom view
--
-Bing Custom Images Search lets you enrich your custom search experience with images. Similar to web results, custom search supports searching for images in your instance's list of websites. You can get the images using the Bing Custom Images Search API or through the Hosted UI feature. Using the Hosted UI feature is simple to use and recommended for getting your search experience up and running in short order. For information about configuring your Hosted UI to include images, see [Configure your hosted UI experience](hosted-ui.md).
-
-If you want more control over displaying the search results, you can use the Bing Custom Images Search API. Because calling the API is similar to calling the Bing Image Search API, checkout [Bing Image Search](../bing-image-search/overview.md) for examples calling the API. But before you do that, familiarize yourself with the [Custom Images Search API reference](/rest/api/cognitiveservices-bingsearch/bing-custom-images-api-v7-reference) content. The main differences are the supported query parameters (you must include the customConfig query parameter) and the endpoint you send requests to.
-
-<!--
-## Next steps
-
-[Call your custom view](search-your-custom-view.md)
>
cognitive-services Get Videos From Instance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/get-videos-from-instance.md
- Title: Get videos from your custom view - Bing Custom Search-
-description: High-level overview about using Bing Custom Search to get videos from your custom view of the Web.
------- Previously updated : 09/10/2018---
-# Get videos from your custom view
--
-Bing Custom Videos Search lets you enrich your custom search experience with videos. Similar to web results, custom search supports searching for videos in your instance's list of websites. You can get the videos using the Bing Custom Videos Search API or through the Hosted UI feature. Using the Hosted UI feature is simple to use and recommended for getting your search experience up and running in short order. For information about configuring your Hosted UI to include videos, see [Configure your hosted UI experience](hosted-ui.md).
-
-If you want more control over displaying the search results, you can use the Bing Custom Videos Search API. Because calling the API is similar to calling the Bing Video Search API, checkout [Bing Video Search](../bing-video-search/overview.md) for examples calling the API. But before you do that, familiarize yourself with the [Custom Videos Search API reference](/rest/api/cognitiveservices-bingsearch/bing-custom-videos-api-v7-reference) content. The main differences are the supported query parameters (you must include the customConfig query parameter) and the endpoint you send requests to.
-
-<!--
-## Next steps
-
-[Call your custom view](search-your-custom-view.md)
>
cognitive-services Hosted Ui https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/hosted-ui.md
- Title: Configure a hosted UI for Bing Custom Search | Microsoft Docs-
-description: Use this article to configure and integrate a hosted UI for Bing Custom Search.
------- Previously updated : 02/12/2019----
-# Configure your hosted UI experience
--
-Bing Custom Search provides a hosted UI that you can easily integrate into your webpages and web applications as a JavaScript code snippet. Using the Bing Custom Search portal, you can configure the layout, color, and search options of the UI.
---
-## Configure the custom hosted UI
-
-To configure a hosted UI for your web applications, follow these steps. As you make changes, the pane on the right will give you a preview of your UI. The displayed search results are not actual results for your instance.
-
-1. Sign in to Bing Custom Search [portal](https://customsearch.ai).
-
-2. Select your Bing Custom Search instance.
-
-3. Click the **Hosted UI** tab.
-
-4. Select a layout.
-
- - Search bar and results (default): Displays a search box with search results below it.
- - Results only: Displays search results only, without a search box. When using this layout, you must provide the search query (`&q=<query string>`). Add the query parameter to the request URL in the JavaScript snippet, or the HTML endpoint link.
- - Pop-over: Provides a search box and displays the search results in a sliding overlay.
-
-5. Select a color theme. You can customize the colors to fit your application by clicking **Customize theme**. To change a color, either enter the color's RGB HEX value (for example, `#366eb8`), or click on the color preview.
-
- You can preview your changes on the right side of the portal. Clicking **Reset to default** will revert your changes to the default colors for the selected theme.
-
- > [!NOTE]
- > Consider accessibility when choosing colors.
-
-6. Under **Additional Configurations**, provide values as appropriate for your app. These settings are optional. To see the effect of applying or removing them, see the preview pane on the right. Available configuration options are:
-
-7. Enter the search subscription key or choose one from the dropdown list. The dropdown list is populated with keys from your Azure account's subscriptions. See [Azure AI services API account](../cognitive-services-apis-create-account.md).
-
-8. If you enabled autosuggest, enter the autosuggest subscription key or choose one from the dropdown list. The dropdown list is populated with keys from your Azure account's subscriptions. Custom Autosuggest requires a specific subscription tier, see the [pricing](https://azure.microsoft.com/pricing/details/cognitive-services/bing-custom-search/).
--
-## Consume custom UI
-
-To consume the hosted UI, either:
--- Include the script in your web page
-
- ```html
- <html>
- <body>
- <script type="text/javascript"
- id="bcs_js_snippet"
- src="https://ui.customsearch.ai /api/ux/rendering-js?customConfig=<YOUR-CUSTOM-CONFIG-ID>&market=en-US&safeSearch=Moderate&version=latest&q=">
- </script>
- </body>
- </html>
- ```
--- Or, use the following URL in a Web browser.
-
- `https://ui.customsearch.ai/hosted?customConfig=YOUR-CUSTOM-CONFIG-ID`
-
- > [!NOTE]
- > Add the following query parameters to the URL as needed. For information about these parameters, see [Custom Search API](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#query-parameters) reference.
- >
- > - q
- > - mkt
- > - safesearch
- > - setlang
-
- > [!IMPORTANT]
- > The page cannot display your privacy statement or other notices and terms. Suitability for your use may vary.
-
-For additional information, including your Custom Configuration ID, go to **Endpoints** under the **Production** tab.
-
-## Configuration options
-
-You can configure the behavior of your hosted UI by clicking **Additional Configurations**, and providing values. These settings are optional. To see the effect of applying or removing them, see the preview pane on the right.
-
-### Web search configurations
--- Web results enabled: Determines if web search is enabled (you will see a Web tab at the top of the page)-- Enable autosuggest: Determines if custom autosuggest is enabled (see [pricing](https://azure.microsoft.com/pricing/details/cognitive-services/bing-custom-search/) for additional cost).-- Web results per page: Number of web search results to display at a time (the maximum is 50 results per page).-- Image caption: Determines if images are displayed with search results.-
-The following configurations are shown if you click **Show advanced configurations**:
--- Highlight words: Determines if results are displayed with search terms in bold.-- Link target: Determines if the webpage opens in a new browser tab (Blank) or the same browser tab (self) when the user clicks a search result.-
-### Image search configurations
--- Image results enabled: Determines if image search is enabled (you will see an Images tab at the top of the page).-- Image results per page: Number of image search results to display at a time (the maximum is 150 results per page).-
-The following configuration is shown if you click **Show advanced configurations**.
-
-- Enable filters: Adds filters that the user can use to filter the images that Bing returns. For example, the user can filter the results for only animated GIFs.-
-### Video search configurations
--- Video results enabled: Determines if video search is enabled (you will see a Videos tab at the top of the page).-- Video results per page: Number of video search results to display at a time (the maximum is 150 results per page).-
-The following configuration is shown if you click **Show advanced configurations**.
-
-- Enable filters: Adds filters that the user can use to filter the videos that Bing returns. For example, the user can filter the results for videos with a specific resolution or videos discovered in the last 24 hours.-
-### Miscellaneous configurations
--- Page Title: Text displayed in the title area of the search results page (not for pop-over layout).-- Toolbar theme: Determines the background color of the title area of the search results page.-
-The following configurations are shown if you click **Show advanced configurations**.
-
-|Column1 |Column2 |
-|||
-|Search box text placeholder | Text displayed in the search box prior to input. |
-|Title link url |Target for the title link. |
-|Logo URL | Image displayed next to the title. |
-|Favicon | Icon displayed in the browser's title bar. |
-
-The following configurations apply only if you consume the Hosted UI through the HTML endpoint (they don't apply if you use the JavaScript snippet).
--- Page title-- Toolbar theme-- Title link URL-- Logo URL-- Faviicon URL -
-## Next steps
--- [Use decoration markers to highlight text](../bing-web-search/hit-highlighting.md)-- [Page webpages](../bing-web-search/paging-search-results.md)
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/language-support.md
- Title: Language support - Bing Custom Search API-
-description: A list of supported languages and regions for the Bing Custom Search API.
------- Previously updated : 09/25/2018---
-# Language and region support for the Bing Custom Search API
--
-The Bing Custom Search API supports more than three dozen countries/regions, many with more than one language.
-
-Although it's optional, the request should specify the [mkt](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters, see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#query-parameters)
-
-You can specify a country/region using the `cc` query parameter. If you specify a country/region, you must also specify one or more language codes using the `Accept-Language` header. The supported languages vary by country/region; they are given for each country/region in the **Markets** table.
-
-The `Accept-Language` header and the `setLang` query parameter are mutually exclusiveΓÇödo not specify both. For details, see [Accept-Language](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#acceptlanguage).
-
-## Countries/Regions
-
-|Country/region|Code|
-|-|-|
-|Argentina|AR|
-|Australia|AU|
-|Austria|AT|
-|Belgium|BE|
-|Brazil|BR|
-|Canada|CA|
-|Chile|CL|
-|Denmark|DK|
-|Finland|FI|
-|France|FR|
-|Germany|DE|
-|Hong Kong SAR|HK|
-|India|IN|
-|Indonesia|ID|
-|Italy|IT|
-|Japan|JP|
-|Korea|KR|
-|Malaysia|MY|
-|Mexico|MX|
-|Netherlands|NL|
-|New Zealand|NZ|
-|Norway|NO|
-|China|CN|
-|Poland|PL|
-|Portugal|PT|
-|Philippines|PH|
-|Russia|RU|
-|Saudi Arabia|SA|
-|South Africa|ZA|
-|Spain|ES|
-|Sweden|SE|
-|Switzerland|CH|
-|Taiwan|TW|
-|T├╝rkiye|TR|
-|United Kingdom|GB|
-|United States|US|
--
-## Markets
-
-|Country/region|Language|Market Code|
-|-|--|--|
-|Argentina|Spanish|es-AR|
-|Australia|English|en-AU|
-|Austria|German|de-AT|
-|Belgium|Dutch|nl-BE|
-|Belgium|French|fr-BE|
-|Brazil|Portuguese|pt-BR|
-|Canada|English|en-CA|
-|Canada|French|fr-CA|
-|Chile|Spanish|es-CL|
-|Denmark|Danish|da-DK|
-|Finland|Finnish|fi-FI|
-|France|French|fr-FR|
-|Germany|German|de-DE|
-|Hong Kong SAR|Traditional Chinese|zh-HK|
-|India|English|en-IN|
-|Indonesia|English|en-ID|
-|Italy|Italian|it-IT|
-|Japan|Japanese|ja-JP|
-|Korea|Korean|ko-KR|
-|Malaysia|English|en-MY|
-|Mexico|Spanish|es-MX|
-|Netherlands|Dutch|nl-NL|
-|New Zealand|English|en-NZ|
-|Norway|Norwegian|no-NO|
-|China|Chinese|zh-CN|
-|Poland|Polish|pl-PL|
-|Portugal|Portuguese|pt-PT|
-|Philippines|English|en-PH|
-|Russia|Russian|ru-RU|
-|Saudi Arabia|Arabic|ar-SA|
-|South Africa|English|en-ZA|
-|Spain|Spanish|es-ES|
-|Sweden|Swedish|sv-SE|
-|Switzerland|French|fr-CH|
-|Switzerland|German|de-CH|
-|Taiwan|Traditional Chinese|zh-TW|
-|T├╝rkiye|Turkish|tr-TR|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|United States|Spanish|es-US|
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/overview.md
- Title: What is the Bing Custom Search API?-
-description: The Bing Custom Search API enables you to create tailored search experiences for topics that you care about.
------- Previously updated : 12/18/2019---
-# What is the Bing Custom Search API?
--
-The Bing Custom Search API enables you to create tailored ad-free search experiences for topics that you care about. You can specify the domains and webpages for Bing to search, as well as pin, boost, or demote specific content to create a custom view of the web and help your users quickly find relevant search results.
-
-## Features
-
-|Feature |Description |
-|||
-|[Custom real-time search suggestions](define-custom-suggestions.md) | Provide search suggestions that can be displayed as a dropdown list as your users type. |
-|[Custom image search experiences](get-images-from-instance.md) | Enable your users to search for images from the domains and websites specified in your custom search instance. |
-|[Custom video search experiences](get-videos-from-instance.md) | Enable your users to search for videos from the domains and sites specified in your custom search instance. |
-|[Share your custom search instance](share-your-custom-search.md) | Collaboratively edit and test your search instance by sharing it with members of your team. |
-|[Configure a UI for your applications and websites](hosted-ui.md) | Provides a hosted UI that you can easily integrate into your webpages and web applications as a JavaScript code snippet. |
-## Workflow
-
-You can create a customized search instance by using the [Bing Custom Search portal](https://customsearch.ai). The portal enables you to create a custom search instance that specifies the domains, websites, and webpages that you want Bing to search, along with the ones that you donΓÇÖt want it to search. You can also use the portal to: preview the search experience, adjust the search rankings that the API provides, and optionally configure a searchable user interface to be rendered in your websites and applications.
-
-After creating your search instance, you can integrate it (and optionally, a user interface) into your website or application by calling the Bing Custom Search API:
-
-![Image showing that you can connect to Bing custom search via the API](media/BCS-Overview.png "How Bing Custom Search works.")
--
-## Next steps
-
-To get started quickly, see [Create your first Bing Custom Search instance](quick-start.md).
-
-For details about customizing your search instance, see [Define a custom search instance](define-your-custom-view.md).
-
-Be sure to read [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) for using search results in your services and applications.
-
-Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
-
-Familiarize yourself with the reference content for each of the custom search endpoints. The reference contains the endpoints, headers, and query parameters that you'd use to request search results. It also includes definitions of the response objects.
---- [Custom Search API](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference)-- [Custom Image API](/rest/api/cognitiveservices-bingsearch/bing-custom-images-api-v7-reference)-- [Custom Video API](/rest/api/cognitiveservices-bingsearch/bing-custom-videos-api-v7-reference)-- [Custom Autosuggest API](/rest/api/cognitiveservices-bingsearch/bing-custom-autosuggest-api-v7-reference)
cognitive-services Quick Start https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/quick-start.md
- Title: "Quickstart: Create a first Bing Custom Search instance"-
-description: Use this quickstart to create a custom Bing instance that can search domains and webpages that you define.
------ Previously updated : 03/24/2020----
-# Quickstart: Create your first Bing Custom Search instance
--
-To use Bing Custom Search, you need to create a custom search instance that defines your view or slice of the web. This instance contains the public domains, websites, and webpages that you want to search, along with any ranking adjustments you may want.
-
-To create the instance, use the [Bing Custom Search portal](https://customsearch.ai).
-
-![A picture of the Bing Custom Search portal](media/blockedCustomSrch.png)
-
-## Prerequisites
--
-## Create a custom search instance
-
-To create a Bing Custom Search instance:
-
-1. Click **Get Started** on the [Bing Custom Search portal](https://customsearch.ai) webpage, and sign in with your Microsoft account.
-
-2. Click **New Instance**, and enter a descriptive name. You can change the name of your instance at any time.
-
-3. On the **Active** tab under **Search Experience**, enter the URL of one or more websites you want to include in your search.
-
- > [!NOTE]
- > Bing Custom Search instances will only return results for domains, and webpages that are public and have been indexed by Bing.
-
-4. You can use the right side of the Bing Custom Search portal to enter a query and examine the search results returned by your search instance. If no results are returned, try entering a different URL.
-
-5. Click **Publish** to publish your changes to the production environment, and update the instance's endpoints.
-
-6. Click on the **Production** tab under **Endpoints**, and copy your **Custom Configuration ID**. You need this ID to call the Custom Search API by appending it to the `customconfig=` query parameter in your calls.
--
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Quickstart: Call your Bing Custom Search endpoint](./call-endpoint-csharp.md)
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/quickstarts/client-libraries.md
- Title: "Quickstart: Use the Bing Custom Search client library"-
-description: The Custom Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-eleven
--- Previously updated : 02/27/2020---
-# Quickstart: Use the Bing Custom Search client library
----------
cognitive-services Search Your Custom View https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/search-your-custom-view.md
- Title: Search a custom view - Bing Custom Search-
-description: After you've configured your custom search experience, you can test it from within the Bing Custom Search portal.
------- Previously updated : 02/03/2020---
-# Call your Bing Custom Search instance from the Portal
--
-After you've configured your custom search experience, you can test it from within the Bing Custom Search [portal](https://customsearch.ai).
-
-![a screenshot of the Bing custom search portal](media/portal-search-screen.png)
-## Create a search query
-
-After you've signed into the Bing Custom Search [portal](https://customsearch.ai), select your search instance and click the **Production** tab. Under **Endpoints**, select an API endpoint (for example, Web API). Your subscription determines what endpoints are shown.
-
-To create a search query, enter the parameter values for your endpoint. Note that the parameters displayed in the portal may change depending on the endpoint you choose. See the [Custom Search API reference](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference#query-parameters) for more information. To change the subscription your search instance uses, add the appropriate subscription key, and update the appropriate market and/or language parameters.
-
-Some important parameters are below:
--
-|Parameter |Description |
-|||
-|Query | The search term to search for. Only available for Web, Image, Video, and Autosuggest endpoints |
-|Custom Configuration ID | The configuration ID of the selected Custom Search instance. This field is read only. |
-|Market | The market that results will originate from. Only available for the Web, Image, Video, and Hosted UI endpoints. |
-|Subscription Key | The subscription key to test with. You can select a key from the dropdown list or enter one manually. |
-
-Clicking **Additional Parameters** reveals the following parameters:
-
-|Parameter |Description |
-|||
-|Safe Search | A filter used to filter webpages for adult content. Only available for the Web, Image, Video, and Hosted UI endpoints. Note that Bing Custom Video Search only supports two values: `moderate` and `strict`. |
-|User Interface Language | The language used for user interface strings. For example, if you enable images and videos in Hosted UI, the **Image** and **Video** tabs use the specified language. |
-|Count | The number of search results to return in the response. Available only for Web, Image, and Video endpoints. |
-|Offset | The number of search results to skip before returning results. Available only for Web, Image, and Video endpoints. |
-
-After you've specified all required options, click **Call** to view the JSON response in the right pane. If you select the Hosted UI endpoint, you can test the search experience in the bottom pane.
-
-## Change your Bing Custom Search subscription
-
-You can change the subscription associated with your Bing Custom Search instance without creating a new instance. To have API calls sent and charged to a new subscription, create a new Bing Custom Search resource in the Azure portal. Use the new subscription key in your API requests, along with your instance's custom configuration ID.
-
-## Next steps
--- [Call your custom view with C#](./call-endpoint-csharp.md)-- [Call your custom view with Java](./call-endpoint-java.md)-- [Call your custom view with NodeJs](./call-endpoint-nodejs.md)-- [Call your custom view with Python](./call-endpoint-python.md)--- [Call your custom view with the C# SDK](./quickstarts/client-libraries.md?pivots=programming-language-csharp%253fpivots%253dprogramming-language-csharp)
cognitive-services Share Your Custom Search https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/share-your-custom-search.md
- Title: Share your custom search - Bing Custom Search-
-description: Easily allow collaborative editing and testing of your instance by sharing it with members of your team.
------- Previously updated : 03/04/2019---
-# Share your Custom Search instance
--
-You can easily allow collaborative editing and testing of your instance by sharing it with members of your team. You can share your instance with anyone using just their email address. To share an instance:
--- Sign in to [Custom Search](https://customsearch.ai)-- Select a Custom Search instance-- Click the settings icon (appears as a gear). -- Under **Share Your Instance**, enter the email address of the person to share your instance with and click **Share**. -
-After adding the email address, it's added to the **Instance shared with** list. Repeat the process for each person you want to share your instance with.
-
-To add someone's email to the list, it isn't necessary for them to have a Custom Search account. They will need to sign up for Custom Search before they make configuration changes though. After you share an instance with someone, they'll see it in their list of Custom Search instances. Only one person can modify an instance at a time. If you try to modify an instance that someone else is editing, a warning is shown. An instance can be shared with a maximum of 10 users.
-
-## Stop sharing
-
-To stop sharing an instance with someone, use the remove icon to remove their email address from the list. This also removes the instance from their list of instances.
-
-## Next steps
--- [Configure your Custom Autosuggest experience](define-custom-suggestions.md)
cognitive-services Custom Search Web Page https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Custom-Search/tutorials/custom-search-web-page.md
- Title: "Tutorial: Create a custom search web page - Bing Custom Search"-
-description: Learn how to configure a custom Bing search instance and integrate it into a web page with this tutorial.
------- Previously updated : 03/05/2019---
-# Tutorial: Build a Custom Search web page
--
-Bing Custom Search enables you to create tailored search experiences for topics that you care about. For example, if you own a martial arts website that provides a search experience, you can specify the domains, sub-sites, and webpages that Bing searches. Your users see search results tailored to the content they care about instead of paging through general search results that may contain irrelevant content.
-
-This tutorial demonstrates how to configure a custom search instance and integrate it into a new web page.
-
-The tasks covered are:
-
-> [!div class="checklist"]
-> - Create a custom search instance
-> - Add active entries
-> - Add blocked entries
-> - Add pinned entries
-> - Integrate custom search into a web page
-
-## Prerequisites
--- To follow along with the tutorial, you need a subscription key for the Bing Custom Search API. To get a key, [Create a Bing Custom Search resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesBingCustomSearch) in the Azure portal.-- If you don't already have Visual Studio 2017 or later installed, you can download and use the **free** [Visual Studio 2019 Community Edition](https://www.visualstudio.com/downloads/).-
-## Create a custom search instance
-
-To create a Bing Custom Search instance:
-
-1. Open an internet browser.
-
-2. Navigate to the custom search [portal](https://customsearch.ai).
-
-3. Sign in to the portal using a Microsoft account (MSA). If you don't have an MSA, click **Create a Microsoft account**. If it's your first time using the portal, it will ask for permissions to access your data. Click **Yes**.
-
-4. After signing in, click **New custom search**. In the **Create a new custom search instance** window, enter a name that's meaningful and describes the type of content the search returns. You can change the name at any time.
-
- ![Screenshot of the Create a new custom search instance box](../media/newCustomSrch.png)
-
-5. Click OK, specify a URL and whether to include subpages of the URL.
-
- ![Screenshot of URL definition page](../media/newCustomSrch1-a.png)
--
-## Add active entries
-
-To include results from specific websites or URLs, add them to the **Active** tab.
-
-1. On the **Configuration** page, click the **Active** tab and enter the URL of one or more websites you want to include in your search.
-
- ![Screenshot of the Definition Editor active tab](../media/customSrchEditor.png)
-
-2. To confirm that your instance returns results, enter a query in the preview pane on the right. Bing returns only results for public websites that it has indexed.
-
-## Add blocked entries
-
-To exclude results from specific websites or URLs, add them to the **Blocked** tab.
-
-1. On the **Configuration** page, click the **Blocked** tab and enter the URL of one or more websites you want to exclude from your search.
-
- ![Screenshot of the Definition Editor blocked tab](../media/blockedCustomSrch.png)
--
-2. To confirm that your instance doesn't return results from the blocked websites, enter a query in the preview pane on the right.
-
-## Add pinned entries
-
-To pin a specific webpage to the top of the search results, add the webpage and query term to the **Pinned** tab. The **Pinned** tab contains a list of webpage and query term pairs that specify the webpage that appears as the top result for a specific query. The webpage is pinned only if the user's query string matches the pin's query string based on pin's match condition. Only indexed webpages will be displayed in searches. For more information, see [Define your custom view](../define-your-custom-view.md#pin-slices-to-the-top-of-search-results).
-
-1. On the **Configuration** page, click the **Pinned** tab and enter the webpage and query term of the webpage that you want returned as the top result.
-
-2. By default, the user's query string must exactly match your pin's query string for Bing to return the webpage as the top result. To change the match condition, edit the pin (click the pencil icon), click Exact in the **Query match condition** column, and select the match condition that's right for your application.
-
- ![Screenshot of the Definition Editor pinned tab](../media/pinnedCustomSrch.png)
-
-3. To confirm that your instance returns the specified webpage as the top result, enter the query term you pinned in the preview pane on the right.
-
-## Configure Hosted UI
-
-Custom Search provides a hosted UI to render the JSON response of your custom search instance. To define your UI experience:
-
-1. Click the **Hosted UI** tab.
-
-2. Select a layout.
-
- ![Screenshot of the Hosted UI select layout step](./media/custom-search-hosted-ui-select-layout.png)
-
-3. Select a color theme.
-
- ![Screenshot of the Hosted UI select color theme](./media/custom-search-hosted-ui-select-color-theme.png)
-
- If you need to fine-tune the color theme to better integrate with your web app, click **Customize theme**. Not all color configurations apply to all layout themes. To change a color, enter the color's RGB HEX value (for example, #366eb8) in the corresponding text box. Or, click the color button and then click the shade that works for you. Always think about accessibility when selecting colors.
-
- ![Screenshot of the Hosted UI customize color theme](./media/custom-search-hosted-ui-customize-color-theme.png)
-
-
-4. Specify additional configuration options.
-
- ![Screenshot of the Hosted UI additional configurations step](./media/custom-search-hosted-ui-additional-configurations.png)
-
- To get advanced configurations, click **Show advanced configurations**. This adds configurations such as *Link target* to Web search options, *Enable filters* to Image and Video options, and *Search box text placeholder* to Miscellaneous options.
-
- ![Screenshot of the Hosted UI advanced configurations step](./media/custom-search-hosted-ui-advanced-configurations.png)
-
-5. Select your subscription keys from the dropdown lists. Or, you can enter the subscription key manually.
-
- ![Screenshot of the Hosted UI subscription key](./media/custom-search-hosted-ui-subscription-key.png)
--
-<a name="consuminghostedui"></a>
-## Consuming Hosted UI
-
-There are two ways to consume the hosted UI.
--- Option 1: Integrate the provided JavaScript snippet into your application.-- Option 2: Use the HTML Endpoint provided.-
-The remainder of this tutorial illustrates **Option 1: JavaScript snippet**.
-
-## Set up your Visual Studio solution
-
-1. Open **Visual Studio** on your computer.
-
-2. On the **File** menu, select **New**, and then choose **Project**.
-
-3. In the **New Project** window, select **Visual C# / Web / ASP.NET Core Web Application**, name your project, and then click **OK**.
-
- ![Screenshot of new project window](./media/custom-search-new-project.png)
-
-4. In the **New ASP.NET Core Web Application** window, select **Web Application** and click **OK**.
-
- ![Screenshot of new webapp window](./media/custom-search-new-webapp.png)
-
-## Edit index.cshtml
-
-1. In the **Solution Explorer**, expand **Pages** and double-click **index.cshtml** to open the file.
-
- ![Screenshot of solution explorer with pages expanded and index.cshtml selected](./media/custom-search-visual-studio-webapp-solution-explorer-index.png)
-
-2. In index.cshtml, delete everything starting from line 7 and below.
-
- ```razor
- @page
- @model IndexModel
- @{
- ViewData["Title"] = "Home page";
- }
- ```
-
-3. Add a line break element and a div to act as a container.
-
- ```html
- @page
- @model IndexModel
- @{
- ViewData["Title"] = "Home page";
- }
- <br />
- <div id="customSearch"></div>
- ```
-
-4. In the **Hosted UI** page, scroll down to the section titled **Consuming the UI**. Click the *Endpoints* to access the JavaScript snippet. You can also get to the snippet by clicking **Production** and then the **Hosted UI** tab.
-
- <!-- Get new screenshot after prod gets new bits
- ![Screenshot of the Hosted UI save button](./media/custom-search-hosted-ui-consuming-ui.png)
- -->
-
-5. Paste the script element into the container you added.
-
- ``` html
- @page
- @model IndexModel
- @{
- ViewData["Title"] = "Home page";
- }
- <br />
- <div id="customSearch">
- <script type="text/javascript"
- id="bcs_js_snippet"
- src="https://ui.customsearch.ai /api/ux/rendering-js?customConfig=<YOUR-CUSTOM-CONFIG-ID>&market=en-US&safeSearch=Moderate&version=latest&q=">
- </script>
- </div>
- ```
-
-6. In the **Solution Explorer**, right click on **wwwroot** and click **View in Browser**.
-
- ![Screenshot of solution explorer selecting View in Browser from the wwwroot context menu](./media/custom-search-webapp-view-in-browser.png)
-
-Your new custom search web page should look similar to this:
-
-![Screenshot of custom search web page](./media/custom-search-webapp-browse-index.png)
-
-Performing a search renders results like this:
-
-![Screenshot of custom search results](./media/custom-search-webapp-results.png)
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Call Bing Custom Search endpoint (C#)](../call-endpoint-csharp.md)
cognitive-services Search For Entities https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/concepts/search-for-entities.md
- Title: Search for entities with the Bing Entity Search API-
-description: Use the Bing Entity Search API to extract and search for entities and places from search queries.
------ Previously updated : 02/01/2019---
-# Searching for entities with the Bing Entity API
--
-## Suggest search terms with the Bing Autosuggest API
-
-If you provide a search box where the user enters their search term, use the [Bing Autosuggest API](../../bing-autosuggest/get-suggested-search-terms.md) to improve the experience. The API returns suggested query strings based on partial search terms as the user types.
-
-After the user enters their search term, URL encode the term before setting the [q](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#query) query parameter. For example, if the user enters *Marcus Appel*, set `q` to *Marcus+Appel* or *Marcus%20Appel*.
-
-If the search term contains a spelling mistake, the search response includes a [QueryContext](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#querycontext) object. The object shows the original spelling and the corrected spelling that Bing used for the search.
-
-```json
-"queryContext": {
- "originalQuery": "hollo wrld",
- "alteredQuery": "hello world",
- "alterationOverrideQuery": "+hollo wrld",
- "adultIntent": false
-}
-```
-
-## The Bing Entity Search API response
-
-The API response contains a [SearchResponse](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#searchresponse) object. If Bing finds an entity or place that's relevant, the object includes the `entities` field, `places` field, or both. Otherwise, the response object does not include either field.
-> [!NOTE]
-> Entity responses support multiple markets, but the Places response supports only US Business locations.
-
-The `entities` field is an [EntityAnswer](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference) object that contains a list of [Entity](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entity) objects (see the `value` field). The list may contain a single dominant entity, multiple disambiguation entities, or both.
-
-A dominant entity is returned when Bing believes it to be the only entity that satisfies the request (there is no ambiguity as to which entity satisfies the request). If multiple entities could satisfy the request, the list contains more than one disambiguation entity. For example, if the request uses the generic title of a movie franchise, the list likely contains disambiguation entities. But, if the request specifies a specific title from the franchise, the list likely contains a single dominant entity.
-
-Entities include well-known personalities such as singers, actors, athletes, models, etc.; places and landmarks such as Mount Rainier or Lincoln Memorial; and things such as a banana, goldendoodle, book, or movie title. The [entityPresentationInfo](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entitypresentationinfo) field contains hints that identify the entity's type. For example, if it's a person, movie, animal, or attraction. For a list of possible types, see [Entity Types](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entity-types)
-
-```json
-"entityPresentationInfo": {
- "entityScenario": "DominantEntity",
- "entityTypeHints": ["Attraction"],
- "entityTypeDisplayHint": "Mountain"
-}, ...
-```
-
-The following shows a response that includes a dominant and disambiguation entity.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Mount Rainier"
- },
- "entities": {
- "value": [{
- "contractualRules": [{
- "_type": "ContractualRules/LicenseAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "license": {
- "name": "CC-BY-SA",
- "url": "https://creativecommons.org/licenses/by-sa/3.0/"
- },
- "licenseNotice": "Text under CC-BY-SA license"
- },
- {
- "_type": "ContractualRules/LinkAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "text": "contoso.com",
- "url": "http://contoso.com/mount_rainier"
- },
- {
- "_type": "ContractualRules/MediaAttribution",
- "targetPropertyName": "image",
- "mustBeCloseToContent": true,
- "url": "http://contoso.com/mount-rainier"
- }],
- "webSearchUrl": "https://www.bing.com/search?q=Mount%20Rainier...",
- "name": "Mount Rainier",
- "url": "http://www.northwindtraders.com/",
- "image": {
- "name": "Mount Rainier",
- "thumbnailUrl": "https://www.bing.com/th?id=A4ae343983daa4...",
- "provider": [{
- "_type": "Organization",
- "url": "http://contoso.com/mount_rainier"
- }],
- "hostPageUrl": "http://contoso.com/commons/7/72/mount_rain...",
- "width": 110,
- "height": 110
- },
- "description": "Mount Rainier is 14,411 ft tall and the highest mountain...",
- "entityPresentationInfo": {
- "entityScenario": "DominantEntity",
- "entityTypeHints": ["Attraction"]
- },
- "bingId": "38b9431e-cf91-93be-0584-c42a3ecbfdc7"
- },
- {
- "contractualRules": [{
- "_type": "ContractualRules/MediaAttribution",
- "targetPropertyName": "image",
- "mustBeCloseToContent": true,
- "url": "http://contoso.com/mount_rainier_national_park"
- }],
- "webSearchUrl": "https://www.bing.com/search?q=Mount%20Rainier%20National...",
- "name": "Mount Rainier National Park",
- "url": "http://worldwideimporters.com/",
- "image": {
- "name": "Mount Rainier National Park",
- "thumbnailUrl": "https://www.bing.com/th?id=A91bdc5a1b648a695a39...",
- "provider": [{
- "_type": "Organization",
- "url": "http://contoso.com/mount_rainier_national_park"
- }],
- "hostPageUrl": "http://contoso.com/en/7/7a...",
- "width": 50,
- "height": 50
- },
- "description": "Mount Rainier National Park is a United States National Park...",
- "entityPresentationInfo": {
- "entityScenario": "DisambiguationItem",
- "entityTypeHints": ["Organization"]
- },
- "bingId": "29d4b681-227a-3924-7bb1-8a54e8666b8c"
- }]
- }
-}
-```
-
-The entity includes a `name`, `description`, and `image` field. When you display these fields in your user experience, you must attribute them. The `contractualRules` field contains a list of attributions that you must apply. The contractual rule identifies the field that the attribution applies to. For information about applying attribution, see [Attribution](#data-attribution).
-
-```json
-"contractualRules": [{
- "_type": "ContractualRules/LicenseAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "license": {
- "name": "CC-BY-SA",
- "url": "https://creativecommons.org/licenses/by-sa/3.0/"
- },
- "licenseNotice": "Text under CC-BY-SA license"
-},
-{
- "_type": "ContractualRules/LinkAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "text": "contoso.com",
- "url": "http://contoso.com/wiki/Mount_Rainier"
-},
-{
- "_type": "ContractualRules/MediaAttribution",
- "targetPropertyName": "image",
- "mustBeCloseToContent": true,
- "url": "http://contoso.com/wiki/Mount_Rainier"
-}], ...
-```
-
-When you display the entity information (name, description, and image), you must also use the URL in the `webSearchUrl` field to link to the Bing search results page that contains the entity.
-
-## Find places
-
-The `places` field is a [LocalEntityAnswer](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference) object that contains a list of [Place](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#place) objects (see the [Entity Types](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entity-types) for more information). The list contains one or more local entities that satisfy the request.
-
-Places include restaurant, hotels, or local businesses. The [entityPresentationInfo](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entitypresentationinfo) field contains hints that identify the local entity's type. The list contains a list of hints such as Place, LocalBusiness, Restaurant. Each successive hint in the array narrows the entity's type. For a list of possible types, see [Entity Types](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#entity-types)
-
-```json
-"entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": ["Place",
- "LocalBusiness",
- "Restaurant"]
-}, ...
-```
-> [!NOTE]
-> Entity responses support multiple markets, but the Places response supports only US Business locations.
-
-Local aware entity queries such as *restaurant near me* require the user's location to provide accurate results. Your requests should always use the X-Search-Location and X-MSEdge-ClientIP headers to specify the user's location. If Bing thinks the query would benefit from the user's location, it sets the `askUserForLocation` field of [QueryContext](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#querycontext) to **true**.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Sinful Bakery and Cafe",
- "askUserForLocation": true
- },
- ...
-}
-```
-
-A place result includes the place's name, address, telephone number, and URL to the entity's website. When you display the entity information, you must also use the URL in the `webSearchUrl` field to link to the Bing search results page that contains the entity.
-
-```json
-"places": {
- "value": [{
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Sinful%20Bakery...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "http://libertysdelightfulsinfulbakeryandcafe.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": ["Place",
- "LocalBusiness",
- "Restaurant"]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- }]
-}
-```
-
-> [!NOTE]
-> You, or a third party on your behalf, may not use, retain, store, cache, share, or distribute any data from the Entities API for the purpose of testing, developing, training, distributing or making available any non-Microsoft service or feature.
-
-## Data attribution
-
-Bing Entity API responses contain information owned by third parties. You are responsible to ensure your use is appropriate, for example by complying with any creative commons license your user experience may rely on.
-
-If an answer or result includes the `contractualRules`, `attributions`, or `provider` fields, you must attribute the data. If the answer does not include any of these fields, no attribution is required. If the answer includes the `contractualRules` field and the `attributions` and/or `provider` fields, you must use the contractual rules to attribute the data.
-
-The following example shows an entity that includes a MediaAttribution contractual rule and an Image that includes a `provider` field. The MediaAttribution rule identifies the image as the target of the rule, so you'd ignore the image's `provider` field and instead use the MediaAttribution rule to provide attribution.
-
-```json
-"value": [{
- "contractualRules": [
- ...
- {
- "_type": "ContractualRules/MediaAttribution",
- "targetPropertyName": "image",
- "mustBeCloseToContent": true,
- "url": "http://contoso.com/mount_rainier"
- }
- ],
- ...
- "image": {
- "name": "Mount Rainier",
- "thumbnailUrl": "https://www.bing.com/th?id=A46378861201...",
- "provider": [{
- "_type": "Organization",
- "url": "http://contoso.com/mount_rainier"
- }],
- "hostPageUrl": "http://www.graphicdesigninstitute.com/Uploaded...",
- "width": 110,
- "height": 110
- },
- ...
-}]
-```
-
-If a contractual rule includes the `targetPropertyName` field, the rule applies only to the targeted field. Otherwise, the rule applies to the parent object that contains the `contractualRules` field.
-
-In the following example, the `LinkAttribution` rule includes the `targetPropertyName` field, so the rule applies to the `description` field. For rules that apply to specific fields, you must include a line immediately following the targeted data that contains a hyperlink to the provider's website. For example, to attribute the description, include a line immediately following the description text that contains a hyperlink to the data on the provider's website, in this case create a link to contoso.com.
-
-```json
-"entities": {
- "value": [{
- ...
- "description": "Marcus Appel is a former American....",
- ...
- "contractualRules": [{
- "_type": "ContractualRules/LinkAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "text": "contoso.com",
- "url": "http://contoso.com/cr?IG=B8AD73..."
- },
- ...
-
-```
-
-### License attribution
-
-If the list of contractual rules includes a [LicenseAttribution](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#licenseattribution) rule, you must display the notice on the line immediately following the content that the license applies to. The `LicenseAttribution` rule uses the `targetPropertyName` field to identify the property that the license applies to.
-
-The following shows an example that includes a `LicenseAttribution` rule.
-
-![License attribution](../media/cognitive-services-bing-entities-api/licenseattribution.png)
-
-The license notice that you display must include a hyperlink to the website that contains information about the license. Typically, you make the name of the license a hyperlink. For example, if the notice is **Text under CC-BY-SA license** and CC-BY-SA is the name of the license, you would make CC-BY-SA a hyperlink.
-
-### Link and text attribution
-
-The [LinkAttribution](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#linkattribution) and [TextAttribution](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#textattribution) rules are typically used to identify the provider of the data. The `targetPropertyName` field identifies the field that the rule applies to.
-
-To attribute the providers, include a line immediately following the content that the attributions apply to (for example, the targeted field). The line should be clearly labeled to indicate that the providers are the source of the data. For example, "Data from: contoso.com". For `LinkAttribution` rules, you must create a hyperlink to the provider's website.
-
-The following shows an example that includes `LinkAttribution` and `TextAttribution` rules.
-
-![Link text attribution](../media/cognitive-services-bing-entities-api/linktextattribution.png)
-
-### Media attribution
-
-If the entity includes an image and you display it, you must provide a click-through link to the provider's website. If the entity includes a [MediaAttribution](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#mediaattribution) rule, use the rule's URL to create the click-through link. Otherwise, use the URL included in the image's `provider` field to create the click-through link.
-
-The following shows an example that includes an image's `provider` field and contractual rules. Because the example includes the contractual rule, you ignore the image's `provider` field and apply the `MediaAttribution` rule.
-
-![Media attribution](../media/cognitive-services-bing-entities-api/mediaattribution.png)
-
-### Search or search-like experience
-
-Just like with Bing Web Search API, the Bing Entity Search API may only be used as a result of a direct user query or search, or as a result of an action within an app or experience that logically can be interpreted as a userΓÇÖs search request. For illustration purposes, the following are some examples of acceptable search or search-like experiences.
--- User enters a query directly into a search box in an app-- User selects specific text or image and requests ΓÇ£more informationΓÇ¥ or ΓÇ£additional informationΓÇ¥-- User asks a search bot about a particular topic-- User dwells on a particular object or entity in a visual search type scenario-
-If you are not sure if your experience can be considered a search-like experience, it is recommended that you check with Microsoft.
-
-## Throttling requests
--
-## Next steps
-
-* Try a [Quickstart](../quickstarts/csharp.md) to get started searching for entities with the Bing Entity Search API.
cognitive-services Sending Requests https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/concepts/sending-requests.md
- Title: "Sending search requests to the Bing Entity Search API"-
-description: The Bing Entity Search API sends a search query to Bing and gets results that include entities and places.
------ Previously updated : 06/27/2019---
-# Sending search requests to the Bing Entity Search API
--
-The Bing Entity Search API sends a search query to Bing and gets results that include entities and places. Place results include restaurants, hotel, or other local businesses. For places, the query can specify the name of the local business or it can ask for a list (for example, restaurants near me). Entity results include persons, places, or things. Place in this context is tourist attractions, states, countries/regions, etc.
-
-## The endpoint
-
-To get entity and place search results, send a GET request to the following endpoint:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/entities
-```
-
-Requests must use the HTTPS protocol.
-
-We recommend that all requests originate from a server. Distributing the key as part of a client application provides more opportunity for a malicious third party to access it. Also, making calls from a server provides a single upgrade point for future versions of the API.
-
-## Specifying query parameters and headers
-
-The request must specify the [q](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#query) query parameter, which contains the user's search term. The request must also specify the [mkt](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters, see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#query-parameters). URL encode all query parameters.
-
-The request must specify the [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#subscriptionkey) header. Although optional, you are encouraged to also specify the following headers:
-
-- [User-Agent](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#useragent) -- [X-MSEdge-ClientID](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#clientid) -- [X-MSEdge-ClientIP](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#clientip) -- [X-Search-Location](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#location) -
-The client IP and location headers are important for returning location aware content.
-
-For a list of all request and response headers, see [Headers](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#headers).
-
-## The request
-
-The following shows an entities request that includes all the suggested query parameters and headers.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/entities?q=mount+rainier&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-## The response
-
-The following shows the response to the previous request. The example also shows the Bing-specific response headers. For information about the response object, see [SearchResponse](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#searchresponse).
--
-```json
-BingAPIs-TraceId: 76DD2C2549B94F9FB55B4BD6FEB6AC
-X-MSEdge-ClientID: 1C3352B306E669780D58D607B96869
-BingAPIs-Market: en-US
-
-{
- "_type" : "SearchResponse",
- "queryContext" : {
- "originalQuery" : "mount rainier"
- },
- "entities" : {
- "queryScenario" : "DominantEntity",
- "value" : [{
- "contractualRules" : [{
- "_type" : "ContractualRules\/LicenseAttribution",
- "targetPropertyName" : "description",
- "mustBeCloseToContent" : true,
- "license" : {
- "name" : "CC-BY-SA",
- "url" : "http:\/\/creativecommons.org\/licenses\/by-sa\/3.0\/"
- },
- "licenseNotice" : "Text under CC-BY-SA license"
- },
- {
- "_type" : "ContractualRules\/LinkAttribution",
- "targetPropertyName" : "description",
- "mustBeCloseToContent" : true,
- "text" : "en.wikipedia.org",
- "url" : "http:\/\/en.wikipedia.org\/wiki\/Mount_Rainier"
- },
- {
- "_type" : "ContractualRules\/MediaAttribution",
- "targetPropertyName" : "image",
- "mustBeCloseToContent" : true,
- "url" : "http:\/\/en.wikipedia.org\/wiki\/Mount_Rainier"
- }],
- "webSearchUrl" : "https:\/\/www.bing.com\/search?q=Mount%20Rainier...",
- "name" : "Mount Rainier",
- "image" : {
- "name" : "Mount Rainier",
- "thumbnailUrl" : "https:\/\/www.bing.com\/th?id=A21890c0e1f...",
- "provider" : [{
- "_type" : "Organization",
- "url" : "http:\/\/en.wikipedia.org\/wiki\/Mount_Rainier"
- }],
- "hostPageUrl" : "http:\/\/upload.wikimedia.org\/wikipedia...",
- "width" : 110,
- "height" : 110
- },
- "description" : "Mount Rainier, Mount Tacoma, or Mount Tahoma is the highest...",
- "entityPresentationInfo" : {
- "entityScenario" : "DominantEntity",
- "entityTypeHints" : ["Attraction"],
- "entityTypeDisplayHint" : "Mountain"
- },
- "bingId" : "9ae3e6ca-81ea-6fa1-ffa0-42e1d78906"
- }]
- }
-}
-```
--
-## Next steps
-
-* [Searching for entities with the Bing Entity API](search-for-entities.md)
-* [Bing API Use and Display Requirements](../../bing-web-search/use-display-requirements.md)
cognitive-services Entity Search Endpoint https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/entity-search-endpoint.md
- Title: The Bing Entity Search API endpoint-
-description: The Bing Entity Search API has one endpoint that returns entities from the Web based on a query. These search results are returned in JSON.
------- Previously updated : 02/01/2019---
-# Bing Entity Search API endpoint
---
-The Bing Entity Search API has one endpoint that returns entities from the Web based on a query. These search results are returned in JSON.
-
-## Get entity results from the endpoint
-
-To get entity results using the **Bing API**, send a `GET` request to the following endpoint. Use [headers](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#headers) and [query parameters](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference#query-parameters) to customize your search request. Search requests can be sent using the `?q=` parameter.
-
-```cURL
- GET https://api.cognitive.microsoft.com/bing/v7.0/entities
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [What is the Bing Entity Search API?](overview.md)
-
-## See also
-
-For more information about headers, parameters, market codes, response objects, errors and more, see the [Bing Entity Search API v7](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference) reference article.
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/overview.md
- Title: What is the Bing Entity Search API?-
-description: Learn details about the Bing Entity Search API and how to extract and search for entities and places from search queries.
------- Previously updated : 12/18/2019---
-# What is Bing Entity Search API?
--
-The Bing Entity Search API sends a search query to Bing and gets results that include entities and places. Place results include restaurants, hotel, or other local businesses. Bing returns places if the query specifies the name of the local business or asks for a type of business (for example, restaurants near me). Bing returns entities if the query specifies well-known people, places (tourist attractions, states, countries/regions, etc.), or things.
-
-|Feature |Description |
-|||
-|[Real-time search suggestions](concepts/search-for-entities.md#suggest-search-terms-with-the-bing-autosuggest-api) | Provide search suggestions that can be displayed as a dropdown list as your users type. |
-| [Entity disambiguation](concepts/search-for-entities.md#the-bing-entity-search-api-response) | Get multiple entities for queries with multiple possible meanings. |
-| [Find places](concepts/search-for-entities.md#find-places) | Search for and return information on local businesses and entities |
-
-## Workflow
-
-The Bing Entity Search API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON. You can use the service using either the REST API, or the SDK.
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-2. Send a request to the API, with a valid search query.
-3. Process the API response by parsing the returned JSON message.
-
-## Next steps
-
-* Try the [interactive demo](https://azure.microsoft.com/services/cognitive-services/Bing-entity-search-api/) for the Bing Entity Search API.
-* To get started quickly with your first request, try a [Quickstart](quickstarts/csharp.md).
-* The [Bing Entity Search API v7](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference) reference section.
-* The [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
-* Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing Entity Search client library'-
-description: The Entity Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 03/06/2020---
-# Quickstart: Use the Bing Entity Search client library
-------------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/csharp.md
- Title: "Quickstart: Send a search request to the REST API using C# - Bing Entity Search"-
-description: "Use this quickstart to send a request to the Bing Entity Search REST API using C#, and receive a JSON response."
------ Previously updated : 10/19/2020----
-# Quickstart: Send a search request to the Bing Entity Search REST API using C#
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple C# application sends a news search query to the API, and displays the response. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingEntitySearchv7.cs).
-
-Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages.
--
-## Prerequisites
--- Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).-- Or if you're using Linux or MacOS, you can follow this quickstart using [Visual Studio Code](https://code.visualstudio.com/) and [.NET Core](/dotnet/core/install/macos)-- [Free Azure account](https://azure.microsoft.com/free/dotnet)---
-## Create and initialize a project
-
-1. Create a new C# console solution in Visual Studio.
-1. Add the [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/) NuGet package.
- 1. Right-click your project in **Solution Explorer**.
- 2. Select **Manage NuGet Packages**.
- 3. Search for and select *Newtonsoft.Json*, and then install the package.
-1. Then, add the following namespaces into the main code file:
-
- ```csharp
- using Newtonsoft.Json;
- using System;
- using System.Net.Http;
- using System.Text;
- ```
-
-2. Create a new class, and add variables for the API endpoint, your subscription key, and the query you want to search. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- namespace EntitySearchSample
- {
- class Program
- {
- static string host = "https://api.bing.microsoft.com";
- static string path = "/v7.0/search";
-
- static string market = "en-US";
-
- // NOTE: Replace this example key with a valid subscription key.
- static string key = "ENTER YOUR KEY HERE";
-
- static string query = "italian restaurant near me";
- //...
- }
- }
- ```
-
-## Send a request and get the API response
-
-1. Within the class, create a function called `Search()`. Within this function, create a new `HttpClient` object, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
-2. Construct the URI for your request by combining the host and path. Then, add your market and URL-encode your query.
-
-3. Await `client.GetAsync()` to get an HTTP response, and then store the JSON response by awaiting `ReadAsStringAsync()`.
-
-4. Format the JSON string with `JsonConvert.DeserializeObject()` and print it to the console.
-
- ```csharp
- async static void Search()
- {
- //...
- HttpClient client = new HttpClient();
- client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", key);
-
- string uri = host + path + "?mkt=" + market + "&q=" + System.Net.WebUtility.UrlEncode(query);
-
- HttpResponseMessage response = await client.GetAsync(uri);
-
- string contentString = await response.Content.ReadAsStringAsync();
- dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
- Console.WriteLine(parsedJson);
- }
- ```
-
-5. In the `Main()` method of your application, call the `Search()` function.
-
- ```csharp
- static void Main(string[] args)
- {
- Search();
- Console.ReadLine();
- }
- ```
--
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/java.md
- Title: "Quickstart: Send a search request to the REST API using Java - Bing Entity Search"-
-description: Use this quickstart to send a request to the Bing Entity Search REST API using Java, and receive a JSON response.
------ Previously updated : 05/08/2020---
-# Quickstart: Send a search request to the Bing Entity Search REST API using Java
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple Java application sends a news search query to the API, and displays the response.
-
-Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* The [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/).
-* The [Gson library](https://github.com/google/gson).
---
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.io.*;
- import java.net.*;
- import java.util.*;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. In a new class, create variables for the API endpoint, your subscription key, and a search query. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- public class EntitySearch {
-
- static String subscriptionKey = "ENTER KEY HERE";
-
- static String host = "https://api.bing.microsoft.com";
- static String path = "/v7.0/search";
-
- static String mkt = "en-US";
- static String query = "italian restaurant near me";
- //...
-
- ```
-
-## Construct a search request string
-
-1. Create a function called `search()` that returns a JSON `String`. url-encode your search query, and add it to a parameters string with `&q=`. Add your market to the parameter string with `?mkt=`.
-
-2. Create a URL object with your host, path, and parameters strings.
-
- ```java
- //...
- public static String search () throws Exception {
- String encoded_query = URLEncoder.encode (query, "UTF-8");
- String params = "?mkt=" + mkt + "&q=" + encoded_query;
- URL url = new URL (host + path + params);
- //...
- ```
-
-## Send a search request and receive a response
-
-1. In the `search()` function created above, create a new `HttpsURLConnection` object with `url.openCOnnection()`. Set the request method to `GET`, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```java
- //...
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
- connection.setDoOutput(true);
- //...
- ```
-
-2. Create a new `StringBuilder`. Use a new `InputStreamReader` as a parameter when instantiating `BufferedReader` to read the API response.
-
- ```java
- //...
- StringBuilder response = new StringBuilder ();
- BufferedReader in = new BufferedReader(
- new InputStreamReader(connection.getInputStream()));
- //...
- ```
-
-3. Create a `String` object to store the response from the `BufferedReader`. Iterate through it, and append each line to the string. Then, close the reader and return the response.
-
- ```java
- String line;
-
- while ((line = in.readLine()) != null) {
- response.append(line);
- }
- in.close();
-
- return response.toString();
- ```
-
-## Format the JSON response
-
-1. Create a new function called `prettify` to format the JSON response. Create a new `JsonParser`, call `parse()` on the JSON text, and then store it as a JSON object.
-
-2. Use the Gson library to create a new `GsonBuilder()`, use `setPrettyPrinting().create()` to format the JSON, and then return it.
-
- ```java
- //...
- public static String prettify (String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
- //...
- ```
-
-## Call the search function
--- From the main method of your project, call `search()`, and use `prettify()` to format the text.-
- ```java
- public static void main(String[] args) {
- try {
- String response = search ();
- System.out.println (prettify (response));
- }
- catch (Exception e) {
- System.out.println (e);
- }
- }
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/nodejs.md
- Title: "Quickstart: Send a search request to the REST API using Node.js - Bing Entity Search"-
-description: Use this quickstart to send a request to the Bing Entity Search REST API using Node.js and receive a JSON response.
------ Previously updated : 05/08/2020----
-# Quickstart: Send a search request to the Bing Entity Search REST API using Node.js
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple JavaScript application sends a news search query to the API, and displays the response. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingEntitySearchv7.js).
-
-Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* The latest version of [Node.js](https://nodejs.org/en/download/).
-
-* The [JavaScript Request Library](https://github.com/request/request).
--
-## Create and initialize the application
-
-1. Create a new JavaScript file in your favorite IDE or editor, and set the strictness and HTTPS requirements.
-
- ```javaScript
- 'use strict';
- let https = require ('https');
- ```
-
-2. Create variables for the API endpoint, your subscription key, and search query. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- let subscriptionKey = 'ENTER YOUR KEY HERE';
- let host = 'api.bing.microsoft.com';
- let path = '/v7.0/search';
-
- let mkt = 'en-US';
- let q = 'italian restaurant near me';
- ```
-
-3. Append your market and query parameters to a string called `query`. Be sure to url-encode your query with `encodeURI()`.
- ```javascript
- let query = '?mkt=' + mkt + '&q=' + encodeURI(q);
- ```
-
-## Handle and parse the response
-
-1. Define a function named `response_handler()` that takes an HTTP call, `response`, as a parameter.
-
-2. Within this function, define a variable to contain the body of the JSON response.
- ```javascript
- let response_handler = function (response) {
- let body = '';
- };
- ```
-
-3. Store the body of the response when the `data` flag is called.
- ```javascript
- response.on('data', function (d) {
- body += d;
- });
- ```
-
-4. When an `end` flag is signaled, parse the JSON, and print it.
-
- ```javascript
- response.on ('end', function () {
- let json = JSON.stringify(JSON.parse(body), null, ' ');
- console.log (json);
- });
- ```
-
-## Send a request
-
-1. Create a function called `Search()` to send a search request. In it, perform the following steps:
-
-2. Within this function, create a JSON object containing your request parameters. Use `Get` for the method, and add your host and path information. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
-3. Use `https.request()` to send the request with the response handler created previously, and your search parameters.
-
- ```javascript
- let Search = function () {
- let request_params = {
- method : 'GET',
- hostname : host,
- path : path + query,
- headers : {
- 'Ocp-Apim-Subscription-Key' : subscriptionKey,
- }
- };
-
- let req = https.request (request_params, response_handler);
- req.end ();
- }
- ```
-
-2. Call the `Search()` function.
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/php.md
- Title: "Quickstart: Send a search request to the REST API using PHP - Bing Entity Search"-
-description: Use this quickstart to send a request to the Bing Entity Search REST API using PHP, and receive a JSON response.
------ Previously updated : 05/08/2020----
-# Quickstart: Send a search request to the Bing Entity Search REST API using PHP
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple PHP application sends a news search query to the API, and displays the response.
-
-Although this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [PHP 5.6.x](https://php.net/downloads.php) or later
--
-## Search entities
-
-To run this application, follow these steps:
-
-1. Create a new PHP project in your favorite IDE.
-2. Add the code provided below.
-3. Replace the `key` value with an access key valid for your subscription.
-4. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-5. Run the program.
-
-```php
-<?php
-
-// NOTE: Be sure to uncomment the following line in your php.ini file.
-// ;extension=php_openssl.dll
-
-// **********************************************
-// *** Update or verify the following values. ***
-// **********************************************
-
-// Replace the subscriptionKey string value with your valid subscription key.
-$subscriptionKey = 'ENTER KEY HERE';
-
-$host = "https://api.bing.microsoft.com";
-$path = "/v7.0/search";
-
-$mkt = "en-US";
-$query = "italian restaurants near me";
-
-function search ($host, $path, $key, $mkt, $query) {
-
- $params = '?mkt=' . $mkt . '&q=' . urlencode ($query);
-
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
-
- // NOTE: Use the key 'http' even if you are making an HTTPS request. See:
- // https://php.net/manual/en/function.stream-context-create.php
- $options = array (
- 'http' => array (
- 'header' => $headers,
- 'method' => 'GET'
- )
- );
- $context = stream_context_create ($options);
- $result = file_get_contents ($host . $path . $params, false, $context);
- return $result;
-}
-
-$result = search ($host, $path, $subscriptionKey, $mkt, $query);
-
-echo json_encode (json_decode ($result), JSON_PRETTY_PRINT);
-?>
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/python.md
- Title: "Quickstart: Send a search request to the REST API using Python - Bing Entity Search"-
-description: Use this quickstart to send a request to the Bing Entity Search REST API using Python, and receive a JSON response.
------ Previously updated : 05/08/2020----
-# Quickstart: Send a search request to the Bing Entity Search REST API using Python
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple Python application sends a news search query to the API, and displays the response. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingEntitySearchv7.py).
-
-Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [Python](https://www.python.org/downloads/) 2.x or 3.x
--
-## Create and initialize the application
-
-1. Create a new Python file in your favorite IDE or editor, and add the following imports. Create variables for your subscription key, endpoint, market, and search query. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- import http.client, urllib.parse
- import json
-
- subscriptionKey = 'ENTER YOUR KEY HERE'
- host = 'api.bing.microsoft.com'
- path = '/v7.0/search'
- mkt = 'en-US'
- query = 'italian restaurants near me'
- ```
-
-2. Create a request url by appending your market variable to the `?mkt=` parameter. Url-encode your query and append it to the `&q=` parameter.
-
- ```python
- params = '?mkt=' + mkt + '&q=' + urllib.parse.quote (query)
- ```
-
-## Send a request and get a response
-
-1. Create a function called `get_suggestions()`.
-
-2. In this function, add your subscription key to a dictionary with `Ocp-Apim-Subscription-Key` as a key.
-
-3. Use `http.client.HTTPSConnection()` to create an HTTPS client object. Send a `GET` request using `request()` with your path and parameters, and header information.
-
-4. Store the response with `getresponse()`, and return `response.read()`.
-
- ```python
- def get_suggestions ():
- headers = {'Ocp-Apim-Subscription-Key': subscriptionKey}
- conn = http.client.HTTPSConnection (host)
- conn.request ("GET", path + params, None, headers)
- response = conn.getresponse ()
- return response.read()
- ```
-
-5. Call `get_suggestions()`, and print the JSON response.
-
- ```python
- result = get_suggestions ()
- print (json.dumps(json.loads(result), indent=4))
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/quickstarts/ruby.md
- Title: "Quickstart: Send a search request to the REST API using Ruby - Bing Entity Search"-
-description: Use this quickstart to send a request to the Bing Entity Search REST API using Ruby, and receive a JSON response.
------ Previously updated : 05/08/2020----
-# Quickstart: Send a search request to the Bing Entity Search REST API using Ruby
--
-Use this quickstart to make your first call to the Bing Entity Search API and view the JSON response. This simple Ruby application sends a news search query to the API, and displays the response. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/ruby/Search/BingEntitySearchv7.rb).
-
-Although this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [Ruby 2.4](https://www.ruby-lang.org/en/downloads/) or later.
--
-## Create and initialize the application
-
-1. In your favorite IDE or code editor, create a news Ruby file and import the following packages:
-
- ```ruby
- require 'net/https'
- require 'cgi'
- require 'json'
- ```
-
-2. Create variables for your API endpoint, News search URL, your subscription key, and search query. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```ruby
- host = 'https://api.bing.microsoft.com'
- path = '/v7.0/search'
-
- mkt = 'en-US'
- query = 'italian restaurants near me'
- ```
-
-## Format and make an API request
-
-1. Create the parameters string for your request by appending your market variable to the `?mkt=` parameter. Encode your query and append it to the `&q=` parameter. Combine your API host, path, and the parameters for your request, and cast them as a URI object.
-
- ```ruby
- params = '?mkt=' + mkt + '&q=' + CGI.escape(query)
- uri = URI (host + path + params)
- ```
-
-2. Use the variables from the last step to create the request. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```ruby
- request = Net::HTTP::Get.new(uri)
- request['Ocp-Apim-Subscription-Key'] = subscriptionKey
- ```
-
-3. Send the request, and print the response.
-
- ```ruby
- response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request (request)
- end
-
- puts JSON::pretty_generate (JSON (response.body))
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "italian restaurant near me",
- "askUserForLocation": true
- },
- "places": {
- "value": [
- {
- "_type": "LocalBusiness",
- "webSearchUrl": "https://www.bing.com/search?q=sinful+bakery&filters=local...",
- "name": "Liberty's Delightful Sinful Bakery & Cafe",
- "url": "https://www.contoso.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98112",
- "addressCountry": "US",
- "neighborhood": "Madison Park"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- {
- "_type": "Restaurant",
- "webSearchUrl": "https://www.bing.com/search?q=Pickles+and+Preserves...",
- "name": "Munson's Pickles and Preserves Farm",
- "url": "https://www.princi.com/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness",
- "Restaurant"
- ]
- },
- "address": {
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "Capitol Hill"
- },
- "telephone": "(800) 555-1212"
- },
-
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-entities-search-single-page-app.md)
-
-* [What is the Bing Entity Search API?](../overview.md)
-* [Bing Entity Search API reference](/rest/api/cognitiveservices-bingsearch/bing-entities-api-v7-reference).
cognitive-services Rank Results https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/rank-results.md
- Title: Using ranking to display answers - Bing Entity Search-
-description: Learn how to use ranking to display the answers that the Bing Entity Search API returns.
------- Previously updated : 02/01/2019---
-# Using ranking to display entity search results
--
-Each entity search response includes a [RankingResponse](/rest/api/cognitiveservices/bing-web-api-v7-reference#rankingresponse) answer that specifies how you must display search results returned by the Bing Entity Search API. The ranking response groups results into pole, mainline, and sidebar content. The pole result is the most important or prominent result and should be displayed first. If you do not display the remaining results in a traditional mainline and sidebar format, you must provide the mainline content higher visibility than the sidebar content.
-
-Within each group, the [Items](/rest/api/cognitiveservices/bing-web-api-v7-reference#rankinggroup-items) array identifies the order that the content must appear in. Each item provides two ways to identify the result within an answer.
-
-
-|Field | Description |
-|||
-|`answerType` and `resultIndex` | `answerType` identifies the answer (either Entity or Place) and `resultIndex` identifies a result within that answer (for example, an entity). The index starts at 0.|
-|`value` | `value` Contains an ID that matches the ID of either an answer or a result within the answer. Either the answer or the results contain the ID but not both. |
-
-Using the `answerType` and `resultIndex` is a two-step process. First, use `answerType` to identify the answer that contains the results to display. Then use `resultIndex` to index into that answer's results to get the result to display. (The `answerType` value is the name of the field in the [SearchResponse](/rest/api/cognitiveservices/bing-web-api-v7-reference#searchresponse) object.) If you're supposed to display all the answer's results together, the ranking response item doesn't include the `resultIndex` field.
-
-Using the ID requires you to match the ranking ID with the ID of an answer or one of its results. If an answer object includes an `id` field, display all the answer's results together. For example, if the `Entities` object includes the `id` field, display all the entities articles together. If the `Entities` object does not include the `id` field, then each entity contains an `id` field and the ranking response mixes the entities with the Places results.
-
-## Ranking response example
-
-The following shows an example [RankingResponse](/rest/api/cognitiveservices/bing-web-api-v7-reference#rankingresponse).
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Jimi Hendrix"
- },
- "entities": { ... },
- "rankingResponse": {
- "sidebar": {
- "items": [
- {
- "answerType": "Entities",
- "resultIndex": 0,
- "value": {
- "id": "https://www.bingapis.com/api/v7/#Entities.0"
- }
- },
- {
- "answerType": "Entities",
- "resultIndex": 1,
- "value": {
- "id": "https://www.bingapis.com/api/v7/#Entities.1"
- }
- }
- ]
- }
- }
-}
-```
-
-Based on this ranking response, the sidebar would display the two entity results related to Jimi Hendrix.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-entities-search-single-page-app.md)
cognitive-services Tutorial Bing Entities Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Entities-Search/tutorial-bing-entities-search-single-page-app.md
- Title: "Tutorial: Bing Entity Search single-page web app"-
-description: This tutorial shows how to use the Bing Entity Search API in a single-page Web application.
---- Previously updated : 03/05/2020---
-# Tutorial: Single-page web app
--
-The Bing Entity Search API lets you search the Web for information about *entities* and *places.* You may request either kind of result, or both, in a given query. The definitions of places and entities are provided below.
-
-| Result | Description |
-|-|-|
-|Entities|Well-known people, places, and things that you find by name|
-|Places|Restaurants, hotels, and other local businesses that you find by name *or* by type (Italian restaurants)|
-
-In this tutorial, we build a single-page Web application that uses the Bing Entity Search API to display search results right in the page. The application includes HTML, CSS, and JavaScript components.
-
-The API lets you prioritize results by location. In a mobile app, you can ask the device for its own location. In a Web app, you can use the `getPosition()` function. But this call works only in secure contexts, and it may not provide a precise location. Also, the user may want to search for entities near a location other than their own.
-
-Our app therefore calls upon the Bing Maps service to obtain latitude and longitude from a user-entered location. The user can then enter the name of a landmark ("Space Needle") or a full or partial address ("New York City"), and the Bing Maps API provides the coordinates.
-
-<!-- Remove until we can replace with a sanitized version.
-![[Single-page Bing Entity Search app]](media/entity-search-spa-demo.png)
>-
-> [!NOTE]
-> The JSON and HTTP headings at the bottom of the page reveal the JSON response and HTTP request information when clicked. These details are useful when exploring the service.
-
-The tutorial app illustrates how to:
-
-> [!div class="checklist"]
-> * Perform a Bing Entity Search API call in JavaScript
-> * Perform a Bing Maps `locationQuery` API call in JavaScript
-> * Pass search options to the API calls
-> * Display search results
-> * Handle the Bing client ID and API subscription keys
-> * Deal with any errors that might occur
-
-The tutorial page is entirely self-contained; it does not use any external frameworks, style sheets, or even image files. It uses only widely supported JavaScript language features and works with current versions of all major Web browsers.
-
-In this tutorial, we discuss only selected portions of the source code. The full source code is available [on a separate page](). Copy and paste this code into a text editor and save it as `bing.html`.
-
-> [!NOTE]
-> This tutorial is substantially similar to the [single-page Bing Web Search app tutorial](../bing-web-search/tutorial-bing-web-search-single-page-app.md), but deals only with entity search results.
-
-## Prerequisites
-
-To follow along with the tutorial, you need subscription keys for the Bing Search API, and Bing Maps API.
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription:
- * <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">Create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
- * <a href="https://www.microsoft.com/maps/create-a-bing-maps-key.aspx" title="Create a Computer Vision resource" target="_blank">Create a Bing Maps resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-## App components
-
-Like any single-page Web app, the tutorial application includes three parts:
-
-> [!div class="checklist"]
-> * HTML - Defines the structure and content of the page
-> * CSS - Defines the appearance of the page
-> * JavaScript - Defines the behavior of the page
-
-This tutorial doesn't cover most of the HTML or CSS in detail, as they are straightforward.
-
-The HTML contains the search form in which the user enters a query and chooses search options. The form is connected to the JavaScript that actually performs the search by the `<form>` tag's `onsubmit` attribute:
-
-```html
-<form name="bing" onsubmit="return newBingEntitySearch(this)">
-```
-
-The `onsubmit` handler returns `false`, which keeps the form from being submitted to a server. The JavaScript code actually does the work of collecting the necessary information from the form and performing the search.
-
-The search is done in two phases. First, if the user has entered a location restriction, a Bing Maps query is done to convert it into coordinates. The callback for this query then kicks off the Bing Entity Search query.
-
-The HTML also contains the divisions (HTML `<div>` tags) where the search results appear.
-
-## Managing subscription keys
-
-> [!NOTE]
-> This app requires subscription keys for both the Bing Search API and the Bing Maps API.
-
-To avoid having to include the Bing Search and Bing Maps API subscription keys in the code, we use the browser's persistent storage to store them. If either key has not been stored, we prompt for it and store it for later use. If the key is later rejected by the API, we invalidate the stored key so the user is asked for it upon their next search.
-
-We define `storeValue` and `retrieveValue` functions that use either the `localStorage` object (if the browser supports it) or a cookie. Our `getSubscriptionKey()` function uses these functions to store and retrieve the user's key. You can use the global endpoint below, or the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```javascript
-// cookie names for data we store
-SEARCH_API_KEY_COOKIE = "bing-search-api-key";
-MAPS_API_KEY_COOKIE = "bing-maps-api-key";
-CLIENT_ID_COOKIE = "bing-search-client-id";
-
-// API endpoints
-SEARCH_ENDPOINT = "https://api.cognitive.microsoft.com/bing/v7.0/entities";
-MAPS_ENDPOINT = "https://dev.virtualearth.net/REST/v1/Locations";
-
-// ... omitted definitions of storeValue() and retrieveValue()
-
-// get stored API subscription key, or prompt if it's not found
-function getSubscriptionKey(cookie_name, key_length, api_name) {
- var key = retrieveValue(cookie_name);
- while (key.length !== key_length) {
- key = prompt("Enter " + api_name + " API subscription key:", "").trim();
- }
- // always set the cookie in order to update the expiration date
- storeValue(cookie_name, key);
- return key;
-}
-
-function getMapsSubscriptionKey() {
- return getSubscriptionKey(MAPS_API_KEY_COOKIE, 64, "Bing Maps");
-}
-
-function getSearchSubscriptionKey() {
- return getSubscriptionKey(SEARCH_API_KEY_COOKIE, 32, "Bing Search");
-}
-```
-
-The HTML `<body>` tag includes an `onload` attribute that calls `getSearchSubscriptionKey()` and `getMapsSubscriptionKey()` when the page has finished loading. These calls serve to immediately prompt the user for their keys if they haven't yet entered them.
-
-```html
-<body onload="document.forms.bing.query.focus(); getSearchSubscriptionKey(); getMapsSubscriptionKey();">
-```
-
-## Selecting search options
-
-![[Bing Entity Search form]](media/entity-search-spa-form.png)
-
-The HTML form includes the following controls:
-
-| Control | Description |
-|-|-|
-|`where`|A drop-down menu for selecting the market (location and language) used for the search.|
-|`query`|The text field in which to enter the search terms.|
-|`safe`|A checkbox indicating whether SafeSearch is turned on (restricts "adult" results)|
-|`what`|A menu for choosing to search for entities, places, or both.|
-|`mapquery`|The text field in which the user may enter a full or partial address, a landmark, etc. to help Bing Entity Search return more relevant results.|
-
-> [!NOTE]
-> Places results are currently available only in the United States. The `where` and `what` menus have code to enforce this restriction. If you choose a non-US market while Places is selected in the `what` menu, `what` changes to Anything. If you choose Places while a non-US market is selected in the `where` menu, `where` changes to the US.
-
-Our JavaScript function `bingSearchOptions()` converts these fields to a partial query string for the Bing Search API.
-
-```javascript
-// build query options from the HTML form
-function bingSearchOptions(form) {
-
- var options = [];
- options.push("mkt=" + form.where.value);
- options.push("SafeSearch=" + (form.safe.checked ? "strict" : "off"));
- if (form.what.selectedIndex) options.push("responseFilter=" + form.what.value);
- return options.join("&");
-}
-```
-
-For example, the SafeSearch feature can be `strict`, `moderate`, or `off`, with `moderate` being the default. But our form uses a checkbox, which has only two states. The JavaScript code converts this setting to either `strict` or `off` (we don't use `moderate`).
-
-The `mapquery` field isn't handled in `bingSearchOptions()` because it is used for the Bing Maps location query, not for Bing Entity Search.
-
-## Obtaining a location
-
-The Bing Maps API offers a [`locationQuery` method](//msdn.microsoft.com/library/ff701711.aspx), which we use to find the latitude and longitude of the location the user enters. These coordinates are then passed to the Bing Entity Search API with the user's request. The search results prioritize entities and places that are close to the specified location.
-
-We can't access the Bing Maps API using an ordinary `XMLHttpRequest` query in a Web app because the service does not support cross-origin queries. Fortunately, it supports JSONP (the "P" is for "padded"). A JSONP response is an ordinary JSON response wrapped in a function call. The request is made by inserting using a `<script>` tag into the document. (Loading scripts is not subject to browser security policies.)
-
-The `bingMapsLocate()` function creates and inserts the `<script>` tag for the query. The `jsonp=bingMapsCallback` segment of the query string specifies the name of the function to be called with the response.
-
-```javascript
-function bingMapsLocate(where) {
-
- where = where.trim();
- var url = MAPS_ENDPOINT + "?q=" + encodeURIComponent(where) +
- "&jsonp=bingMapsCallback&maxResults=1&key=" + getMapsSubscriptionKey();
-
- var script = document.getElementById("bingMapsResult")
- if (script) script.parentElement.removeChild(script);
-
- // global variable holds reference to timer that will complete the search if the maps query fails
- timer = setTimeout(function() {
- timer = null;
- var form = document.forms.bing;
- bingEntitySearch(form.query.value, "", bingSearchOptions(form), getSearchSubscriptionKey());
- }, 5000);
-
- script = document.createElement("script");
- script.setAttribute("type", "text/javascript");
- script.setAttribute("id", "bingMapsResult");
- script.setAttribute("src", url);
- script.setAttribute("onerror", "BingMapsCallback(null)");
- document.body.appendChild(script);
-
- return false;
-}
-```
-
-> [!NOTE]
-> If the Bing Maps API does not respond, the `bingMapsCallBack()` function is never called. Ordinarily, that would mean that `bingEntitySearch()` isn't called, and the entity search results do not appear. To avoid this scenario, `bingMapsLocate()` also sets a timer to call `bingEntitySearch()` after five seconds. There is logic in the callback function to avoid performing the entity search twice.
-
-When the query completes, the `bingMapsCallback()` function is called, as requested.
-
-```javascript
-function bingMapsCallback(response) {
-
- if (timer) { // we beat the timer; stop it from firing
- clearTimeout(timer);
- timer = null;
- } else { // the timer beat us; don't do anything
- return;
- }
-
- var location = "";
- var name = "";
- var radius = 1000;
-
- if (response) {
- try {
- if (response.statusCode === 401) {
- invalidateMapsKey();
- } else if (response.statusCode === 200) {
- var resource = response.resourceSets[0].resources[0];
- var coords = resource.point.coordinates;
- name = resource.name;
-
- // the radius is the largest of the distances between the location and the corners
- // of its bounding box (in case it's not in the center) with a minimum of 1 km
- try {
- var bbox = resource.bbox;
- radius = Math.max(haversineDistance(bbox[0], bbox[1], coords[0], coords[1]),
- haversineDistance(coords[0], coords[1], bbox[2], bbox[1]),
- haversineDistance(bbox[0], bbox[3], coords[0], coords[1]),
- haversineDistance(coords[0], coords[1], bbox[2], bbox[3]), 1000);
- } catch(e) { }
- var location = "lat:" + coords[0] + ";long:" + coords[1] + ";re:" + Math.round(radius);
- }
- }
- catch (e) { } // response is unexpected. this isn't fatal, so just don't provide location
- }
-
- var form = document.forms.bing;
- if (name) form.mapquery.value = name;
- bingEntitySearch(form.query.value, location, bingSearchOptions(form), getSearchSubscriptionKey());
-
-}
-```
-
-Along with latitude and longitude, the Bing Entity Search query requires a *radius* that indicates the precision of the location information. We calculate the radius using the *bounding box* provided in the Bing Maps response. The bounding box is a rectangle that surrounds the entire location. For example, if the user enters `NYC`, the result contains roughly central coordinates of New York City and a bounding box that encompasses the city.
-
-We first calculate the distances from the primary coordinates to each of the four corners of the bounding box using the function `haversineDistance()` (not shown). We use the largest of these four distances as the radius. The minimum radius is a kilometer. This value is also used as a default if no bounding box is provided in the response.
-
-Having obtained the coordinates and the radius, we then call `bingEntitySearch()` to perform the actual search.
-
-## Performing the search
-
-Given the query, a location, an options string, and the API key, the `BingEntitySearch()` function makes the Bing Entity Search request.
-
-```javascript
-// perform a search given query, location, options string, and API keys
-function bingEntitySearch(query, latlong, options, key) {
-
- // scroll to top of window
- window.scrollTo(0, 0);
- if (!query.trim().length) return false; // empty query, do nothing
-
- showDiv("noresults", "Working. Please wait.");
- hideDivs("pole", "mainline", "sidebar", "_json", "_http", "error");
-
- var request = new XMLHttpRequest();
- var queryurl = SEARCH_ENDPOINT + "?q=" + encodeURIComponent(query) + "&" + options;
-
- // open the request
- try {
- request.open("GET", queryurl);
- }
- catch (e) {
- renderErrorMessage("Bad request (invalid URL)\n" + queryurl);
- return false;
- }
-
- // add request headers
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
- request.setRequestHeader("Accept", "application/json");
-
- var clientid = retrieveValue(CLIENT_ID_COOKIE);
- if (clientid) request.setRequestHeader("X-MSEdge-ClientID", clientid);
-
- if (latlong) request.setRequestHeader("X-Search-Location", latlong);
-
- // event handler for successful response
- request.addEventListener("load", handleBingResponse);
-
- // event handler for erorrs
- request.addEventListener("error", function() {
- renderErrorMessage("Error completing request");
- });
-
- // event handler for aborted request
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-
- // send the request
- request.send();
- return false;
-}
-```
-
-Upon successful completion of the HTTP request, JavaScript calls our `load` event handler, the `handleBingResponse()` function, to handle a successful HTTP GET request to the API.
-
-```javascript
-// handle Bing search request results
-function handleBingResponse() {
- hideDivs("noresults");
-
- var json = this.responseText.trim();
- var jsobj = {};
-
- // try to parse JSON results
- try {
- if (json.length) jsobj = JSON.parse(json);
- } catch(e) {
- renderErrorMessage("Invalid JSON response");
- }
-
- // show raw JSON and HTTP request
- showDiv("json", preFormat(JSON.stringify(jsobj, null, 2)));
- showDiv("http", preFormat("GET " + this.responseURL + "\n\nStatus: " + this.status + " " +
- this.statusText + "\n" + this.getAllResponseHeaders()));
-
- // if HTTP response is 200 OK, try to render search results
- if (this.status === 200) {
- var clientid = this.getResponseHeader("X-MSEdge-ClientID");
- if (clientid) retrieveValue(CLIENT_ID_COOKIE, clientid);
- if (json.length) {
- if (jsobj._type === "SearchResponse") {
- renderSearchResults(jsobj);
- } else {
- renderErrorMessage("No search results in JSON response");
- }
- } else {
- renderErrorMessage("Empty response (are you sending too many requests too quickly?)");
- }
- if (divHidden("pole") && divHidden("mainline") && divHidden("sidebar"))
- showDiv("noresults", "No results.<p><small>Looking for restaurants or other local businesses? Those currently areen't supported outside the US.</small>");
- }
-
- // Any other HTTP status is an error
- else {
- // 401 is unauthorized; force re-prompt for API key for next request
- if (this.status === 401) invalidateSearchKey();
-
- // some error responses don't have a top-level errors object, so gin one up
- var errors = jsobj.errors || [jsobj];
- var errmsg = [];
-
- // display HTTP status code
- errmsg.push("HTTP Status " + this.status + " " + this.statusText + "\n");
-
- // add all fields from all error responses
- for (var i = 0; i < errors.length; i++) {
- if (i) errmsg.push("\n");
- for (var k in errors[i]) errmsg.push(k + ": " + errors[i][k]);
- }
-
- // also display Bing Trace ID if it isn't blocked by CORS
- var traceid = this.getResponseHeader("BingAPIs-TraceId");
- if (traceid) errmsg.push("\nTrace ID " + traceid);
-
- // and display the error message
- renderErrorMessage(errmsg.join("\n"));
- }
-}
-```
-
-> [!IMPORTANT]
-> A successful HTTP request does *not* necessarily mean that the search itself succeeded. If an error occurs in the search operation, the Bing Entity Search API returns a non-200 HTTP status code and includes error information in the JSON response. Additionally, if the request was rate-limited, the API returns an empty response.
-
-Much of the code in both of the preceding functions is dedicated to error handling. Errors may occur at the following stages:
-
-|Stage|Potential error(s)|Handled by|
-|-|-|-|
-|Building JavaScript request object|Invalid URL|`try`/`catch` block|
-|Making the request|Network errors, aborted connections|`error` and `abort` event handlers|
-|Performing the search|Invalid request, invalid JSON, rate limits|tests in `load` event handler|
-
-Errors are handled by calling `renderErrorMessage()` with any details known about the error. If the response passes the full gauntlet of error tests, we call `renderSearchResults()` to display the search results in the page.
-
-## Displaying search results
-
-The Bing Entity Search API [requires you to display results in a specified order](../bing-web-search/use-display-requirements.md). Since the API may return two different kinds of responses, it is not enough to iterate through the top level `Entities` or `Places` collection in the JSON response and display those results. (If you want only one type of result, use the `responseFilter` query parameter.)
-
-Instead, we use the `rankingResponse` collection in the search results to order the results for display. This object refers to items in the `Entitiess` and/or `Places` collections.
-
-`rankingResponse` may contain up to three collections of search results, designated `pole`, `mainline`, and `sidebar`.
-
-`pole`, if present, is the most relevant search result and should be displayed prominently. `mainline` refers to the bulk of the search results. Mainline results should be displayed immediately after `pole` (or first, if `pole` is not present).
-
-Finally. `sidebar` refers to auxiliary search results. They may be displayed in an actual sidebar or simply after the mainline results. We have chosen the latter for our tutorial app.
-
-Each item in a `rankingResponse` collection refers to the actual search result items in two different, but equivalent, ways.
-
-| Item | Description |
-|-|-|
-|`id`|The `id` looks like a URL, but should not be used for links. The `id` type of a ranking result matches the `id` of either a search result item in an answer collection, *or* an entire answer collection (such as `Entities`).
-|`answerType`<br>`resultIndex`|The `answerType` refers to the top-level answer collection that contains the result (for example, `Entities`). The `resultIndex` refers to the result's index within that collection. If `resultIndex` is omitted, the ranking result refers to the entire collection.
-
-> [!NOTE]
-> For more information on this part of the search response, see [Rank Results](rank-results.md).
-
-You may use whichever method of locating the referenced search result item is most convenient for your application. In our tutorial code, we use the `answerType` and `resultIndex` to locate each search result.
-
-Finally, it's time to look at our function `renderSearchResults()`. This function iterates over the three `rankingResponse` collections that represent the three sections of the search results. For each section, we call `renderResultsItems()` to render the results for that section.
-
-```javascript
-// render the search results given the parsed JSON response
-function renderSearchResults(results) {
-
- // if spelling was corrected, update search field
- if (results.queryContext.alteredQuery)
- document.forms.bing.query.value = results.queryContext.alteredQuery;
-
- // for each possible section, render the results from that section
- for (section in {pole: 0, mainline: 0, sidebar: 0}) {
- if (results.rankingResponse[section])
- showDiv(section, renderResultsItems(section, results));
- }
-}
-```
-
-## Rendering result items
-
-In our JavaScript code is an object, `searchItemRenderers`, that contains *renderers:* functions that generate HTML for each kind of search result.
-
-```javascript
-searchItemRenderers = {
- entities: function(item) { ... },
- places: function(item) { ... }
-}
-```
-
-A renderer function may accept the following parameters:
-
-| Parameter | Description |
-|-|-|
-|`item`|The JavaScript object containing the item's properties, such as its URL and its description.|
-|`index`|The index of the result item within its collection.|
-|`count`|The number of items in the search result item's collection.|
-
-The `index` and `count` parameters can be used to number results, to generate special HTML for the beginning or end of a collection, to insert line breaks after a certain number of items, and so on. If a renderer does not need this functionality, it does not need to accept these two parameters. In fact, we do not use them in the renderers for our tutorial app.
-
-Let's take a closer look at the `entities` renderer:
-
-```javascript
- entities: function(item) {
- var html = [];
- html.push("<p class='entity'>");
- if (item.image) {
- var img = item.image;
- if (img.hostPageUrl) html.push("<a href='" + img.hostPageUrl + "'>");
- html.push("<img src='" + img.thumbnailUrl + "' title='" + img.name + "' height=" + img.height + " width= " + img.width + ">");
- if (img.hostPageUrl) html.push("</a>");
- if (img.provider) {
- var provider = img.provider[0];
- html.push("<small>Image from ");
- if (provider.url) html.push("<a href='" + provider.url + "'>");
- html.push(provider.name ? provider.name : getHost(provider.url));
- if (provider.url) html.push("</a>");
- html.push("</small>");
- }
- }
- html.push("<p>");
- if (item.entityPresentationInfo) {
- var pi = item.entityPresentationInfo;
- if (pi.entityTypeHints || pi.entityTypeDisplayHint) {
- html.push("<i>");
- if (pi.entityTypeDisplayHint) html.push(pi.entityTypeDisplayHint);
- else if (pi.entityTypeHints) html.push(pi.entityTypeHints.join("/"));
- html.push("</i> - ");
- }
- }
- html.push(item.description);
- if (item.webSearchUrl) html.push("&nbsp;<a href='" + item.webSearchUrl + "'>More</a>")
- if (item.contractualRules) {
- html.push("<p><small>");
- var rules = [];
- for (var i = 0; i < item.contractualRules.length; i++) {
- var rule = item.contractualRules[i];
- var link = [];
- if (rule.license) rule = rule.license;
- if (rule.url) link.push("<a href='" + rule.url + "'>");
- link.push(rule.name || rule.text || rule.targetPropertyName + " source");
- if (rule.url) link.push("</a>");
- rules.push(link.join(""));
- }
- html.push("License: " + rules.join(" - "));
- html.push("</small>");
- }
- return html.join("");
- }, // places renderer omitted
-```
-
-Our entity renderer function:
-
-> [!div class="checklist"]
-> * Builds the HTML `<img>` tag to display the image thumbnail, if any.
-> * Builds the HTML `<a>` tag that links to the page that contains the image.
-> * Builds the description that displays information about the image and the site it's on.
-> * Incorporates the entity's classification using the display hints, if any.
-> * Includes a link to a Bing search to get more information about the entity.
-> * Displays any licensing or attribution information required by data sources.
-
-## Persisting client ID
-
-Responses from the Bing search APIs may include a `X-MSEdge-ClientID` header that should be sent back to the API with successive requests. If multiple Bing Search APIs are being used, the same client ID should be used with all of them, if possible.
-
-Providing the `X-MSEdge-ClientID` header allows the Bing APIs to associate all of a user's searches, which have two important benefits.
-
-First, it allows the Bing search engine to apply past context to searches to find results that better satisfy the user. If a user has previously searched for terms related to sailing, for example, a later search for "docks" might preferentially return information about places to dock a sailboat.
-
-Second, Bing may randomly select users to experience new features before they are made widely available. Providing the same client ID with each request ensures that users that have been chosen to see a feature always see it. Without the client ID, the user might see a feature appear and disappear, seemingly at random, in their search results.
-
-Browser security policies (CORS) may prevent the `X-MSEdge-ClientID` header from being available to JavaScript. This limitation occurs when the search response has a different origin from the page that requested it. In a production environment, you should address this policy by hosting a server-side script that does the API call on the same domain as the Web page. Since the script has the same origin as the Web page, the `X-MSEdge-ClientID` header is then available to JavaScript.
-
-> [!NOTE]
-> In a production Web application, you should perform the request server-side anyway. Otherwise, your Bing Search API key must be included in the Web page, where it is available to anyone who views source. You are billed for all usage under your API subscription key, even requests made by unauthorized parties, so it is important not to expose your key.
-
-For development purposes, you can make the Bing Web Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that allow lists response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our tutorial app to access the client ID header. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then issue the following command in a command window:
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Entity Search API reference](/rest/api/cognitiveservices/bing-entities-api-v7-reference)
-
-> [!div class="nextstepaction"]
-> [Bing Maps API documentation](/bingmaps/)
cognitive-services Bing Image Search Resource Faq https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/bing-image-search-resource-faq.md
- Title: Frequently asked questions (FAQ) - Bing Image Search API-
-description: Find answers to commonly asked questions about concepts, code, and scenarios related to the Bing Image Search API.
------- Previously updated : 01/05/2022---
-# Frequently asked questions (FAQ) about the Bing Image Search API
--
-Find answers to commonly asked questions about concepts, code, and scenarios related to the Bing Image Search API for Azure AI services on Azure.
-
-## Response headers in JavaScript
-
-The following headers may occur in responses from the Bing Image Search API.
-
-| Attribute | Description |
-| - | - |
-| `X-MSEdge-ClientID` |The unique ID that Bing has assigned to the user |
-| `BingAPIs-Market` |The market that was used to fulfill the request |
-| `BingAPIs-TraceId` |The log entry on the Bing API server for this request (for support) |
-
-It is particularly important to persist the client ID and return it with subsequent requests. When you do this, the search will use past context in ranking search results and also provide a consistent user experience.
-
-However, when you call the Bing Image Search API from JavaScript, your browser's built-in security features (CORS) might prevent you from accessing the values of these headers.
-
-To gain access to the headers, you can make the Bing Image Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that filters response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our [tutorial app](tutorial-bing-image-search-single-page-app.md) to access the optional client headers. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then enter the following command at a command prompt.
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Image Search API endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Response headers in production
-
-The CORS proxy approach described in the previous answer is appropriate for development, testing, and learning.
-
-In a production environment, however, you should host a server-side script on the same domain as the Web page that uses the Bing Web Search API. This script should actually do the API calls upon request from the Web page JavaScript and pass all results, including headers, back to the client. Since the two resources (page and script) share an origin, CORS does not come into play and the special headers are accessible to the JavaScript on the Web page.
-
-This approach also protects your API key from exposure to the public, since only the server-side script needs it. The script can use another method (such as the HTTP referrer) to make sure the request is authorized.
-
-## Next steps
-
-Is your question about a missing feature or functionality? Consider requesting or voting for it using the [feedback tool](https://feedback.azure.com/d365community/forum/09041fae-0b25-ec11-b6e6-000d3a4f0858).
-
-## See also
-
- [Stack Overflow: Azure AI services](https://stackoverflow.com/questions/tagged/bing-api)
cognitive-services Bing Image Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/bing-image-upgrade-guide-v5-to-v7.md
- Title: Upgrade from Bing Image Search API v5 to v7-
-description: This upgrade guide describes changes between version 5 and version 7 of the Bing Image Search API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
------ Previously updated : 01/05/2022---
-# Bing Image Search API v7 upgrade guide
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing Image Search API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number changed from v5 to v7. For example, https:\//api.cognitive.microsoft.com/bing/\*\*v7.0**/images/search.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
---- Replaced the v5 error codes with the following possible `code` and `subCode` values.-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the sub-code conditions occur. The response includes these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
---
-### Query parameters
--- Renamed the `modulesRequested` query parameter to [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference). --- Renamed the Annotations to Tags. See [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference) query parameter to Tags. --- Changed the list of supported markets of the ShoppingSources filter value to en-US only. See [imageType](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagetype). --
-### Image insights changes
--- Renamed the `annotations` field of [ImagesInsights](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsightsresponse) to `imageTags`. --- Renamed the `AnnotationModule` object to [ImageTagsModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagetagsmodule). --- Renamed the `Annotation` object to [Tag](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#tag), and removed the `confidence` field. --- Renamed the `insightsSourcesSummary` field of the [Image](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#image) object to `insightsMetadata`. --- Renamed the `InsightsSourcesSummary` object to [InsightsMetadata](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightsmetadata). --- Added the `https://api.cognitive.microsoft.com/bing/v7.0/images/details` endpoint. Use this endpoint to request image insights instead of the /images/search endpoint. See [Image Insights](./image-insights.md).--- The following query parameters are now valid only with the `/images/details` endpoint. -
- - [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken)
- - [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
- - [imgUrl](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imgurl)
- - [cab](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cab)
- - [cal](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cal)
- - [car](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#car)
- - [cat](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cat)
- - [ct](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#ct)
--- Renamed the `ImageInsightsResponse` object to [ImageInsights](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsights). --- Changed the data types of the following fields in the [ImageInsights](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsights) object. -
- - Changed the type of the `relatedCollections` field from `ImageGallery[]` to [RelatedCollectionsModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#relatedcollectionsmodule).
-
- - Changed the type of the `pagesIncluding` field from `Image[]` to [ImagesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagesmodule).
-
- - Changed the type of the `relatedSearches` field from `Query[]` to [RelatedSearchesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#relatedsearchesmodule).
-
- - Changed the type of the `recipes` field from `Recipe[]` to [RecipesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#recipesmodule).
-
- - Changed the type of the `visuallySimilarImages` field from `Image[]` to [ImagesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagesmodule).
-
- - Changed the type of the `visuallySimilarProducts` field from `ProductSummaryImage[]` to [ImagesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagesmodule).
-
- - Removed the `ProductSummaryImage` object and moved the product-related fields into the [Image](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#image) object. The `Image` object includes the product-related fields only when the image is included as part of visually similar products in an image insight response.
-
- - Changed the type of the `recognizedEntityGroups` field from `RecognizedEntityGroup[]` to [RecognizedEntitiesModule](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#recognizedentitiesmodule).
--- Renamed the `categoryClassification` field of [ImageInsights](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsightsresponse) to `annotations`, and changed its type to `AnnotationsModule`. -
-### Images answer
--- Removed the displayShoppingSourcesBadges and displayRecipeSourcesBadges fields from [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images). --- Renamed the `nextOffsetAddCount` field of [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) to `nextOffset`. The way you use the offset has also changed. Previously, you set the [offset](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#offset) query parameter to the `nextOffsetAddCount` value plus the previous offset value plus the number of images in the result. Now, you set `offset` to the `nextOffset` value. --
-## Non-breaking changes
-
-### Query parameters
--- Added Transparent as a possible [imageType](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagetype) filter value. The Transparent filter returns only images with a transparent background.--- Added the Any as a possible [license](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#license) filter value. The Any filter returns only images that are under license.--- Added the [maxFileSize](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#maxfilesize) and [minFileSize](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#minfilesize) query parameters. Use these filters to return images within a range of file sizes. --- Added the [maxHeight](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#maxheight), [minHeight](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#minheight), [maxWidth](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#maxwidth), [minWidth](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#minwidth) query parameters. Use these filters to return images within a range of heights and widths. -
-### Object changes
--- Added the `description` and `lastUpdated` fields to the [Offer](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#offer) object. --- Added the `name` field to the [ImageGallery](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagegallery) object. --- Added `similarTerms` to the [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) object. This field contains a list of terms that are similar in meaning to the user's query string.
cognitive-services Bing Image Search Get Images https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/concepts/bing-image-search-get-images.md
- Title: Get images from the web - Bing Image Search API-
-description: Use the Bing Image Search API to search for and get relevant images from the web.
------ Previously updated : 01/05/2022---
-# Get images from the web with the Bing Image Search API
--
-When you use the Bing Image Search REST API, you can get images from the web that are related to your search term by sending the following GET request:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=sailing+dinghies&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-Use the [q](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#query) query parameter for your url-encoded search term. For example, if you enter *sailing dinghies*, set `q` to `sailing+dinghies` or `sailing%20dinghies`.
-
-> [!IMPORTANT]
-> * All requests must be made from a server, and not from a client.
-> * If it's your first time calling any of the Bing search APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API that returned a client ID for the user and device combination.
-
-## Get images from a specific web domain
-
-To get images from a specific domain, use the [site:](/previous-versions/bing/search/ff795613(v=msdn.10)) query operator.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=sailing+dinghies+site:contososailing.com&mkt=en-us HTTP/1.1
-```
-
-> [!NOTE]
-> Responses to queries using the `site:` operator might include adult content regardless of the [safeSearch](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#safesearch) setting. Only use `site:` if you're aware of the content on the domain.
-
-## Filter images
-
- By default, the Image Search API returns all images that are relevant to the query. If you want to filter the images that Bing returns (for example, to return only images with a transparent background or specific size), use the following query parameters:
-
-* [aspect](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#aspect)ΓÇöFilter images by aspect ratio (for example, standard or wide screen images).
-* [color](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#color)ΓÇöFilter images by dominant color or black and white.
-* [freshness](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#freshness)ΓÇöFilter images by age (for example, images discovered by Bing in the past week).
-* [height](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#height), [width](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#width)ΓÇöFilter images by width and height.
-* [imageContent](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagecontent)ΓÇöFilter images by content (for example, images that show only a person's face).
-* [imageType](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagetype)ΓÇöFilter images by type (for example, clip art, animated GIFs, or transparent backgrounds).
-* [license](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#license)ΓÇöFilter images by the type of license associated with the site.
-* [size](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#size)ΓÇöFilter images by size, such as small images up to 200x200 pixels.
-
-To get images from a specific domain, use the [site:](/previous-versions/bing/search/ff795613(v=msdn.10)) query operator.
-
-The following example shows how to get small images from ContosoSailing.com that Bing discovered in the past week.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=sailing+dinghies+site:contososailing.com&size=small&freshness=week&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Bing Image Search response format
-
-The response message from Bing contains an [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) answer that contains a list of images that Azure AI services determined to be relevant to the query. Each [Image](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#image) object in the list includes the following information about the image: the URL, its size, its dimensions, its encoding format, a URL to a thumbnail of the image, and the thumbnail's dimensions.
-
-> [!NOTE]
-> * Images must be displayed in the order provided in the response.
-> * Because URL formats and parameters are subject to change without notice, use all URLs as-is. You should not take dependencies on the URL format or parameters except where noted.
-
-```json
-{
- "name": "Rich Passage Sailing Dinghy",
- "webSearchUrl": "https:\/\/www.bing.com\/cr?IG=73118C8B4E3...",
- "thumbnailUrl": "https:\/\/tse1.mm.bing.net\/th?id=OIP.GNarK7m...",
- "datePublished": "2011-10-29T11:26:00",
- "contentUrl": "http:\/\/www.bing.com\/cr?IG=73118C8B4E3D4C3...",
- "hostPageUrl": "http:\/\/www.bing.com\/cr?IG=73118C8B4E3D4C3687...",
- "contentSize": "79239 B",
- "encodingFormat": "jpeg",
- "hostPageDisplayUrl": "en.contoso.org\/wiki\/File:Rich_Passage...",
- "width": 526,
- "height": 688,
- "thumbnail": {
- "width": 229,
- "height": 300
- },
- "imageInsightsToken": "ccid_GNarK7ma*mid_CCF85447ADA6...",
- "insightsSourcesSummary": {
- "shoppingSourcesCount": 0,
- "recipeSourcesCount": 0
- },
- "imageId": "CCF85447ADA6FFF9E96E7DF0B796F7A86E34593",
- "accentColor": "376094"
-},
-```
-
-When you call the Bing Image Search API, Bing returns a list of results. The list is a subset of the total number of results that are relevant to the query. The response's `totalEstimatedMatches` field contains an estimate of the number of images that are available to view. For details about how to page through the rest of the images, see [Paging Images](../../bing-web-search/paging-search-results.md).
-
-## Next steps
-
-If you haven't tried the Bing Image Search API before, try a [quickstart](../quickstarts/csharp.md). If you're looking for something more complex, try the tutorial to create a [single-page web app](../tutorial-bing-image-search-single-page-app.md).
cognitive-services Bing Image Search Sending Queries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/concepts/bing-image-search-sending-queries.md
- Title: Customize and suggest image search queries - Bing Image Search API-
-description: Learn about customizing the search queries you send to the Bing Image Search API.
------ Previously updated : 01/05/2022---
-# Customize and suggest image search queries
--
-Use this article to learn how to customize queries and suggest search terms to send to the Bing Image Search API.
-
-## Suggest search terms
-
-If your app has a search box where search terms are entered, you can use the [Bing Autosuggest API](../../bing-autosuggest/get-suggested-search-terms.md) to improve the experience. The API can display suggested search terms in real time. The API returns suggested query strings based on partial search terms and Azure AI services.
-
-## Pivot the query
-
-If Bing can segment the original search query, the returned [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) object contains `pivotSuggestions`. Pivot suggestions can be displayed as optional search terms to the user. For example, if the original query was *Microsoft Surface*, Bing might segment the query into *Microsoft* and *Surface* and provide suggested pivots for each. These suggestions can be displayed as optional query terms to the user.
-
-The following example shows the pivot suggestions for *Microsoft Surface*:
-
-```json
-{
- "_type": "Images",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=microsoft%20surface&FORM=OIIARP",
- "totalEstimatedMatches": 1000,
- "value": [...],
- "queryExpansions": [...],
- "pivotSuggestions": [{
- "pivot": "microsoft",
- "suggestions": [{
- "text": "Contoso Surface",
- "displayText": "Contoso",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=OtterBox+Surface&FORM=IRQBPS",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=Contoso...",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse3.mm.bing.net\/th?q=Contoso+Surface..."
- }
- },
- {
- "text": "Adatum Surface",
- "displayText": "Adatum",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Adatum+Surface&FORM=IRQBPS",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse3.mm.bing.net\/th?q=Adatum+Surface&pid=Ap..."
- }
- },
- ...
- ]
- },
- {
- "pivot": "surface",
- "suggestions": [{
- "text": "Microsoft Surface4",
- "displayText": "Surface4",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Microsoft+Surface...",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse4.mm.bing.net\/th?q=Microsoft..."
- }
- },
- {
- "text": "Microsoft Tablet",
- "displayText": "Tablet",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Microsoft+Tablet&FORM=IRQBPS",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse3.mm.bing.net\/th?q=Microsoft+Tablet..."
- }
- },
- ...
- ],
- "nextOffsetAddCount": 0
-}
-```
-
-The `pivotSuggestions` field contains the list of segments (pivots) that the original query was broken into. For each pivot, the response contains a list of [Query](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#query_obj) objects that contain suggested queries. The `text` field contains the suggested query. The `displayText` field contains the term that replaces the pivot in the original query. An example is Release Date of Surface.
-
-If the pivot query string is what the user is looking for, use the `text` and `thumbnail` fields to display the pivot query strings. Make the thumbnail and text clickable by using the `webSearchUrl` URL or the `searchLink` URL. Use `webSearchUrl` to send the user to the Bing search results. If you provide your own results page, use `searchLink`.
-
-<!-- Need a sanitized version of the image
-The following shows an example of the pivot queries.
-
-![Pivot suggestions](./media/cognitive-services-bing-images-api/bing-image-pivotsuggestion.GIF)
>-
-## Expand the query
-
-If Bing can expand the query to narrow the original search, the [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) object contains the `queryExpansions` field. For example, if the query was *Microsoft Surface*, the expanded queries might be:
-- Microsoft Surface **Pro 3**.-- Microsoft Surface **RT**.-- Microsoft Surface **Phone**.-- Microsoft Surface **Hub**.-
-The following example shows the expanded queries for *Microsoft Surface*.
-
-```json
-{
- "_type": "Images",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=microsoft%20surface...",
- "totalEstimatedMatches": 1000,
- "value": [...],
- "queryExpansions": [{
- "text": "Microsoft Surface Pro 3",
- "displayText": "Pro 3",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Microsoft+Surface+Pro+3...",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=Microsoft...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse4.mm.bing.net\/th?q=Microsoft+Surface+Pro+3..."
- }
- },
- {
- "text": "Microsoft Surface RT",
- "displayText": "RT",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Microsoft+Surface+RT...",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse4.mm.bing.net\/th?q=Microsoft+Surface+RT..."
- }
- },
- {
- "text": "Microsoft Surface Phone",
- "displayText": "Phone",
- "webSearchUrl": "https:\/\/www.bing.com\/images\/search?q=Microsoft+Surface+Phone",
- "searchLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=...",
- "thumbnail": {
- "thumbnailUrl": "https:\/\/tse4.mm.bing.net\/th?q=Microsoft+Surface+Phone..."
- }
- }],
- "pivotSuggestions": [...],
- "nextOffsetAddCount": 0
-}
-```
-
-The `queryExpansions` field contains a list of [Query](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#query_obj) objects. The `text` field contains the expanded query. The `displayText` field contains the expansion term. If the expanded query string is what the user is looking for, use the `text` and `thumbnail` fields to display the expanded query strings. Make the thumbnail and text clickable by using the `webSearchUrl` URL or the `searchLink` URL. Use `webSearchUrl` to send the user to the Bing search results. if you provide your own results page, use `searchLink`.
-
-<!-- Removing until we can replace with a sanitized image.
-The following shows an example Bing implementation that uses expanded queries. If the user clicks the Microsoft Surface Pro 3 link, they're taken to the Bing search results page, which shows them images of the Pro 3.
-
-![Query expansion suggestions](./media/cognitive-services-bing-images-api/bing-image-queryexpansion.GIF)
>--
-## Throttling requests
--
-## Next steps
-
-If you haven't tried the Bing Image Search API before, try a [quickstart](../quickstarts/csharp.md). If you're looking for something more complex, try the tutorial to create a [single-page web app](../tutorial-bing-image-search-single-page-app.md).
cognitive-services Gif Images https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/gif-images.md
- Title: Search for GIF images using the Bing Image Search API-
-description: The Bing Image Search API enables you to also search across the entire Web for the most relevant .gif images.
------ Previously updated : 04/24/2018----
-# Search for GIF images
--
-The Bing Image Search API enables you to also search across the entire Web for the most relevant .gif images.  Developers can integrate engaging gifs in various conversation scenarios. 
-
-The following URL is a query for animated .gif images.
-```
-https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=interesting&imageType=AnimatedGif&mkt=en-us
-```
-The [q](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#query) parameter specifies the search terms. The previous query also specifies `animatedGif` using the [imageType](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imagetype) filter parameter.
-
-To see examples of results, use the following URL to search bing.com.
-```
-https://www.bing.com/images/search?q=interesting&qft=%20filterui%3Aphoto-animatedgif
-
-```
-## Query parameters
-
-For more information about query parameters and options, see the [Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#query-parameters). An example follows under the heading [Example search for animated gif using Java](#gifExample).
-
-## Tips and suggestions
--- You can specify [maxFileSize](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#maxfilesize) and [minFileSize](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#minfilesize) parameters. We recommend setting the maxFileSize=2000000 as majority of gifs in our index are under 2MB. This also helps to control the data size if bandwidth is a concern, such as in mobile cellular scenarios.-- To help improve perceived performance, load the thumbnail first before loading the source url. -- For first-run or landing page experience where you don't have a user query yet, try using our trending gif searches to help from the [trending images API](trending-images.md).-- There are three settings for the [safeSearch](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#safesearch) parameter. The `strict` option blocks adult content.-- See [mkt](./language-support.md) for full list of languages and locations supported.-- *AnimatedGifHttps* only returns animated gif images that are from an https address. For security, many applications require connection to external web links over https. For example, the Apple App Store requires connection to web services over HTTPS, which encrypts user data secure while in transit.-
-<a name="gifExample"></a>
-
-## Example search for animated gif using Java
-
-The following URL searches for animated .gif images: `q=interesting`
-```
-https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=interesting&imageType=AnimatedGif&mkt=en-us
-
-```
-As shown in the following example, the URL query requires [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#headers) header.
-
-The following Java example builds and sends the request.
-
-```
-package gifSearch;
-import java.net.*;
-import java.util.*;
-import java.io.*;
-import javax.net.ssl.HttpsURLConnection;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-/*
- * Gson: https://github.com/google/gson
- * Maven info:
- * groupId: com.google.code.gson
- * artifactId: gson
- * version: 2.8.1
- *
- * Once you have compiled or downloaded gson-2.8.1.jar, assuming you have placed it in the
- * same folder as this file (BingImageSearch.java), you can compile and run this program at
- * the command line as follows.
- *
- * javac GIFsearch.java -classpath .;gson-2.8.1.jar -encoding UTF-8
- * java -cp .;gson-2.8.1.jar GIFsearch
- */
--
-public class GIFsearch {
-
- // Replace the subscriptionKey string value with your valid subscription key.
- static String subscriptionKey = "YOUR-ACCESS-KEY";
-
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/images/search";
-
- static String searchTerm = "interesting";
-
- public static SearchResults SearchImages (String searchQuery) throws Exception {
- // construct URL of search request (endpoint + query string)
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8") + "&imageType=AnimatedGif&mkt=en-us");
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
-
- // receive JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
-
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
-
- // extract Bing-related HTTP headers
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")) {
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
-
- stream.close();
- return results;
- }
-
- // pretty-printer for JSON; uses GSON parser to parse and re-serialize
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
-
- public static void main (String[] args) {
- if (subscriptionKey.length() != 32) {
- System.out.println("Invalid Bing Search API subscription key!");
- System.out.println("Please paste yours into the source code.");
- System.exit(1);
- }
-
- try {
- System.out.println("Searching the Web for: " + searchTerm);
-
- SearchResults result = SearchImages(searchTerm);
-
- System.out.println("\nRelevant HTTP Headers:\n");
- for (String header : result.relevantHeaders.keySet())
- System.out.println(header + ": " + result.relevantHeaders.get(header));
-
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(result.jsonResponse));
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
-}
-
-//Container class for search results encapsulates relevant headers and JSON data
-class SearchResults{
- HashMap<String, String> relevantHeaders;
- String jsonResponse;
- SearchResults(HashMap<String, String> headers, String json) {
- relevantHeaders = headers;
- jsonResponse = json;
- }
-}
-
-```
-
-## Results
-The code gets the following results as JSON objects:
-
-```json
- {
- "webSearchUrl": "https://www.bing.com/images/search?view\u003ddetai...",
- "name": "Very Interesting GIF - Thats Very Interesting - ...",
- "thumbnailUrl": "https://tse1.mm.bing.net/th?id\u003dOIP.yJX6Vz345JPK...",
- "datePublished": "2017-03-12T01:35:00.0000000Z",
- "contentUrl": "https://media.contoso.co/images/c895fa573df8e493ca8d0dec7d93b/raw",
- "hostPageUrl": "https://www.contoso.co/view/thats-very-interesting-christi...",
- "contentSize": "1295633 B",
- "encodingFormat": "animatedgif",
- "hostPageDisplayUrl": "https://www.contoso.co/view/thats-very-christian...",
- "width": 440,
- "height": 186,
- "thumbnail": {
- "width": 474,
- "height": 200
- },
- "imageInsightsToken": "ccid_yJX6Vz34*mid_9FF0FFA42AADA1357F042443D2103B40EA...",
- "insightsMetadata": {
- "recipeSourcesCount": 0,
- "bestRepresentativeQuery": {
- "text": "That\u0027s Very Interesting",
- "displayText": "That\u0027s Very Interesting",
- "webSearchUrl": "https://www.bing.com/images/search?q\u003dThat..."
- },
- "pagesIncludingCount": 19,
- "availableSizesCount": 2
- },
- "imageId": "9FF0FFA42AADA1357F042443D21030EAAA225F",
- "accentColor": "62452D"
- },
-
-```
-
-## Next steps
-- [C# quickstart](quickstarts/csharp.md)-- [Tutorial Image Search single-page application](tutorial-bing-image-search-single-page-app.md)
cognitive-services Image Insights https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/image-insights.md
- Title: Get image insights - Bing Image Search API-
-description: Learn how to use the Bing Image Search API to get more information about an image.
------ Previously updated : 01/05/2022---
-# Get image insights with the Bing Image Search API
--
-> [!IMPORTANT]
-> Instead of using the /images/details endpoint to get image insights, you should use [Visual Search](../bing-visual-search/overview.md) since it provides more comprehensive insights.
--
-Each image includes an insights token that you can use to get information about the image. For example, you can get a collection of related images, web pages that include the image, or a list of merchants where you can buy the product shown in the image.
-
-To get insights about an image, capture the image's [imageInsightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#image-imageinsightstoken) token in the response.
-
-```json
-"value" : [{
- . . .
- "name":"sailing dinghy.jpg",
- "imageInsightsToken" : "mid_D6426898706EC7..."
- "insightsSourcesSummary" : {
- "shoppingSourcesCount" : 9,
- "recipeSourcesCount" : 0
- },
- . . .
-}],
-```
-
-Next, call the Image Details endpoint and set the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) query parameter to the token in `imageInsightsToken`.
-
-To specify the insights that you want to get, set the `modules` query parameter. To get all insights, set `modules` to `All`. To get only the caption and collection insights, set `modules` to `Caption%2CCollection`. For a complete list of possible insights, see [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested). Not all insights are available for all images. The response includes all insights that you requested, if available.
-
-The following example requests all available insights for the preceding image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?q=sailing+dinghy&insightsToken=mid_D6426898706EC7...&modules=All&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Getting insights of a known image
-
-If you have the URL to an image that you want to get insights of, use the [imgUrl](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imgurl) query parameter instead of the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) parameter to specify the image. Or, if you have the image file, you may send the binary of the image in the body of a POST request. If you use a POST request, the `Content-Type` header must be set to `multipart/data-form`. With either option, the size of the image may not exceed 1 MB.
-
-If you have a URL to the image, the following example shows how to request insights of an image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?q=sailing+dinghy&imgUrl=https%3A%2F%2Fwww.mydomain.com%2Fimages%2Fsunflower.png&modules=All&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Getting all image insights
-
-To request all insights of an image, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested) query parameter to `All`. To get related searches, the request must include the user's query string. This example shows using the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) to specify the image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?q=sailing+dinghy&insightsToken=mid_68364D764J...&modules=All&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The top-level object is an [ImageInsightsResponse](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsightsresponse) object instead of an [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) object.
-
-```json
-{
- "_type" : "ImageInsights",
- "imageInsightsToken" : "bcid_3297E6A54E4787A5F51C49D9BA342B9A*ccid_Fe2Hx...",
- "bestRepresentativeQuery" : {
- "text" : "Sailing Dinghy",
- "displayText" : "Sailing Dinghy",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=Sailing+Dinghy...",
- },
- "pagesIncluding" : {
- "value" : [
- {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=...",
- "name" : "Powerboating Dublin, Dinghy Sailing Courses...",
- "thumbnailUrl" : "https:\/\/tse1.mm.bing.net\/th?id=OIP....",
- "datePublished" : "2017-01-20T00:41:00.0000000Z",
- "contentUrl" : "http:\/\/www.contoso.ie\/content...",
- "hostPageUrl" : "http:\/\/www.contoso.ie\/powerboating...",
- "contentSize" : "59063 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "www.contoso.ie\/powerboating...",
- "width" : 800,
- "height" : 600,
- "thumbnail" : {
- "width" : 300,
- "height" : 225
- },
- "imageInsightsToken" : "ccid_pHjQIA0x*mid_17F61B1316A39C92214...",
- "imageId" : "17F61B1316A39C922143FFDE9DFB5B0FB41171",
- "accentColor" : "0997C2"
- },
- . . .
- ]
- },
- "relatedSearches" : {
- "value" : [
- {
- "text" : "Sailing Fun",
- "displayText" : "Sailing Fun",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=Sailing...",
- "thumbnail" : {
- "url" : "https:\/\/tse1.mm.bing.net\/th?q=Sailing+Fun..."
- }
- },
- . . .
- ]
- },
- "visuallySimilarImages" : {
- "value" : [
- {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=...",
- "name" : "Weekend On the Water",
- "thumbnailUrl" : "https:\/\/tse2.mm.bing.net\/th?id=OIP...",
- "datePublished" : "2010-09-05T12:00:00.0000000Z",
- "contentUrl" : "http:\/\/1.bp.contoso.com\/_dc_6...",
- "hostPageUrl" : "http:\/\/contoso.com\/2010...",
- "contentSize" : "203806 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "contoso.com\/2010...",
- "width" : 1600,
- "height" : 1249,
- "thumbnail" : {
- "width" : 300,
- "height" : 234
- },
- "imageInsightsToken" : "ccid_Jg1Kwuc4*mid_5B7DA43976D3A422...",
- "imageId" : "5B7DA43976D3A422BA679A3AB019BB52C08DBC",
- "accentColor" : "0B2543"
- },
- . . .
- ]
- },
- "imageTags" : {
- "value" : [
- {
- "name" : "sail boat"
- },
- . . .
- ]
- }
-}
-```
-
-## Recognizing entities in an image
-
-The entity recognition feature identifies entities in an image, currently only people. To identify entities in an image, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested) query parameter to `RecognizedEntities`.
-
-> [!NOTE]
-> You may not specify this module with any other module. If you specify this module with other modules, the response does not include recognized entities.
-
-The following shows how to specify the image by using the [imgUrl](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imgurl) parameter. Remember to URL encode the query parameters.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?q=faith+hill&insightsToken=mid_68364D764J...&modules=RecognizedEntities&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following shows the response to the previous request. Because the image contains two people, the response identifies a region for each person. In this case, the people were recognized in the CelebrityAnnotations and CelebRecognitionAnnotations groups. Bing lists the people in each group based on the likelihood that they match the person in the original image. The list is in descending order of confidence. The CelebRecognitionAnnotations group provides the highest level of confidence that the match is correct.
-
-```json
-{
- "_type" : "ImageInsights",
- "imageInsightsToken" : "ccid_ldi5nX38*mid_29470780DE0E6F969...",
- "recognizedEntityGroups" : {
- "value" : [
- {
- "recognizedEntityRegions" : [...],
- "name" : "CelebRecognitionAnnotations"
- },
- {
- "recognizedEntityRegions" : [...],
- "name" : "CelebrityAnnotations"
- }
- ]
- }
-}
-```
-
-The `region` field identifies the area of the image where Bing recognized the entity. For people, the region represents the person's face.
-
-The values of the rectangle are relative to the width and height of the original image and are in the range 0.0 through 1.0. For example, if the image is 300x200, and the region's top, left corner is at point (10, 20) and the bottom, right corner is at point (290, 150), then the normalized rectangle is:
--- Left: 10 / 300 = 0.03333... -- Top: 20 / 200 = 0.1 -- Right: 290 / 300 = 0.9667... -- Bottom: 150 / 200 = 0.75 -
-You can use the region that Bing returns in subsequent insights calls. For example, to get visually similar images of the recognized entity. For more information, see Cropping Images to use with Visually Similar and Entity Recognition Modules. The following shows the mapping between the region fields and the query parameters that you'd use to crop images.
--- Left maps to [cal](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cal) -- Top maps to [cat](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cat) -- Right maps to [car](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#car) -- Bottom maps to [cab](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cab) -
-## Finding visually similar images
-
-To find images that are visually similar to the original image, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested) query parameter to SimilarImages.
-
-The following request shows how to get visually similar images. The request uses the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) query parameter to identify the original image. To improve relevance, you should include the user's query string.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?insightsToken=mid_68364D764J...&modules=SimilarImages&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
--
-The following shows the response to the previous request.
-
-```json
-{
- "_type" : "ImageInsights",
- "imageInsightsToken" : "ccid_ldi5nX38*mid_29470780DE0E6F969...",
- "visuallySimilarImages" : {
- "value" : [
- {
- "name" : "typical Hawaiian Sunset! :) | Scenes of Hawaii",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=detailv2...",
- "thumbnailUrl" : "https:\/\/tse1.mm.bing.net\/th?id=OIP.Mda2a86...",
- . . .
- }
- ]
- }
-```
-
-## Cropping images to use with visually similar and entity recognition modules
-
-To specify the region of the image that Bing uses to determine whether images are visually similar or to perform entity recognition, use the [cal](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cal), [cat](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cat), [cab](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#cab), and [car](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#car) query parameters. By default, Bing uses the entire image.
-
-The parameters specify the top, left corner and bottom, right corner of the region that Bing uses for comparison. Specify the values as fractions of the original image's width and height. The fractional values start with (0.0, 0.0) at the top, left corner and end with (1.0, 1.0) at the bottom right corner. For example, to specify that the top, left corner starts a quarter of the way down from the top and a quarter of the way in from the left side, set `cal` to 0.25 and `cat` 0.25.
-
-The following sequence of calls shows the effect of specifying the cropping region. The first call does not include cropping and Bing recognizes two people standing side by side in the middle of the image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?modules=RecognizedEntities&imgurl=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.M0cbee6fadb43f35b2344e53da7a23ec1o0%26pid%3DApi&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The response shows two recognized entities.
-
-```json
-{
- "_type" : "ImageInsights",
- "recognizedEntityGroups" : {
- "value": [
- . . .
- {
- "recognizedEntityRegions" : [{
- "region" : {
- "left" : 0.5066667,
- "top" : 0.1955556,
- "right" : 0.75,
- "bottom" : 0.52
- },
- "matchingEntities" : [{
- "entity" : {
- "_type" : "Person",
- "name" : "Charlene Whitney",
- . . .
- },
- "matchConfidence" : 0.9961388
- }]
- },
- {
- "region" : {
- "left" : 0.25,
- "top" : 0.2488889,
- "right" : 0.4466667,
- "bottom" : 0.5111111
- },
- "matchingEntities" : [{
- "entity" : {
- "_type" : "Person",
- "name" : "Marcus Appel",
- . . .
- },
- "matchConfidence" : 0.9961388
- }]
- }],
- "name" : "CelebRecognitionAnnotations"
- }]
- }
-}
-```
-
-The second call crops the image vertically down the middle and Bing recognized a single person on the right side of the image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?cal=0.5&cat=0.0&car=1.0&cab=1.0&modules=RecognizedEntities&imgurl=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.M0cbee6fadb43f35b2344e53da7a23ec1o0%26pid%3DApi&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The response shows one recognized entity.
-
-```json
-{
- "_type" : "ImageInsights",
- "recognizedEntityGroups" : {
- "value" : [
- . . .
- {
- "recognizedEntityRegions" : [{
- "region" : {
- "left" : 0.5066667,
- "top" : 0.1955556,
- "right" : 0.75,
- "bottom" : 0.52
- },
- "matchingEntities" : [{
- "entity" : {
- "_type" : "Person",
- "name" : "Charlene Whitney",
- . . .
- },
- "matchConfidence" : 0.9961388
- }]
- }],
- "name" : "CelebRecognitionAnnotations"
- }
- ]
- }
-}
-```
-
-## Finding visually similar products
-
-To find images that contain products that are visually similar to the products found in the original image, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested) query parameter to SimilarProducts.
-
-The following request shows how to get images of visually similar products. The request uses the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) query parameter to identify the original image that was returned in a previous request. To improve relevance, you should include the user's query string.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?q=anne+klein+dresses&modules=SimilarProducts&insightsToken=ccid_WOeyfoSp*mid_4B0A357&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following shows the response to the previous request. The response contains an image of a similar product and indicates how many merchants offer the product online, whether there are product ratings, and the lowest price found (see the `aggregateOffer` field).
-
-```json
-{
- "_type" : "ImageInsights",
- "imageInsightsToken" : "ccid_ldi5nX38*mid_29470780DE0E6F969...",
- "visuallySimilarProducts" : {
- "value" : [
- {
- "name" : "Sequin One-Shoulder Twist-Drape Dress",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=de...",
- "thumbnailUrl" : "https:\/\/tse2.mm.bing.net\/th?id=OIP.M85bdee...",
- . . .
- },
- . . .
- ]
- }
-}
-```
-
-To get a list of the merchants that offer the product online (see the [offerCount](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference) field), call the API again and set `modules` to ShoppingSources. Then, set the `insightsToken` query parameter to the token found in the product summary image.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/details?modules=ShoppingSources&insightsToken=ccid_hb3uRvUk*mid_BF5C252A47F2C765...&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following is the response to the previous request.
-
-```json
-{
- "_type" : "ImageInsights",
- "shoppingSources" : {
- "offers" : [{
- "url" : "http:\/\/www.contoso.com\/dp\/B00O...",
- "seller" : {
- "name" : "Contoso",
- "image" : {
- "url" : "https:\/\/tse3.mm.bing.net\/th?id=A10d50fe..."
- }
- },
- "price" : 126.87,
- "priceCurrency" : "USD",
- "availability" : "InStock"
- },
- {
- "url" : "http:\/\/www.adatum.com\/product\/heritage...\/",
- "seller" : {
- "name" : "fabrikam.com"
- },
- "price" : 495,
- "priceCurrency" : "USD",
- "availability" : "InStock"
- }]
- }
-}
-```
cognitive-services Image Search Endpoint https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/image-search-endpoint.md
- Title: Endpoints for the Bing Image Search API-
-description: The Image Search API includes three endpoints. Endpoint 1 returns images from the web. Endpoint 2 returns ImageInsights. Endpoint 3 returns trending images.
------ Previously updated : 01/05/2022---
-# Endpoints for the Bing Image Search API
--
-The **Image Search API** includes three endpoints. Endpoint 1 returns images from the Web based on a query. Endpoint 2 returns [ImageInsights](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#imageinsightsresponse). Endpoint 3 returns trending images.
-
-## Endpoints
-
-To get image results using the Bing API, send a request to one of the following endpoints. Use the headers and URL parameters to define further specifications.
-
-**Endpoint 1:** Returns images that are relevant to the user's search query defined by `?q=""`.
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/search
-```
-
-**Endpoint 2:** Returns insights about an image, using either `GET` or `POST`.
-```
- GET or POST https://api.cognitive.microsoft.com/bing/v7.0/images/details
-```
-A GET request returns insights about an image, such as Web pages that include the image. Include the [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#insightstoken) parameter with a `GET` request.
-
-Or, you can include a binary image in the body of a `POST` request and set the [modules](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#modulesrequested) parameter to `RecognizedEntities`. This will return an [insightsToken](/rest/api/cognitiveservices-bingsearch/bing-images-api-v5-reference#insightstoken) to use as a parameter in a subsequent `GET` request, which returns information about people in the image. Set `modules` to `All` to get all insights, except `RecognizedEntities` in the results of the `POST` without making another call using the `insightsToken`.
--
-**Endpoint 3:** Returns images that are trending based on search requests made by others. The images are separated into different categories, for example, based on noteworthy people or events.
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/trending
-```
-
-For a list of markets that support trending images, see [Trending Images](./trending-images.md).
-
-For details about headers, parameters, market codes, response objects, errors, etc., see the [Bing Image Search API v7](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference) reference.
-## Response JSON
-The response to an image search request includes results as JSON objects. For examples of parsing the results see the [tutorial](./tutorial-bing-image-search-single-page-app.md) and [source code](./tutorial-bing-image-search-single-page-app.md).
-
-## Next steps
-The **Bing** APIs support search actions that return results according to their type. All search endpoints return results as JSON response objects.  All endpoints support queries that return a specific language and/or location by longitude, latitude, and search radius.
-
-For complete information about the parameters supported by each endpoint, see the reference pages for each type.
-For examples of basic requests using the Image search API, see [Image Search Quick-starts](./overview.md).
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/language-support.md
- Title: Language support - Bing Image Search API-
-description: Find out which countries/regions and languages are supported by the Bing Image Search API.
------ Previously updated : 01/05/2022---
-# Language and region support for the Bing Image Search API
--
-The Bing Image Search API supports more than three dozen countries/regions, many with more than one language. Specifying a country/region with a query serves primarily to refine search results based on interests in that country/region. Additionally, the results may contain links to Bing, and these links may localize the Bing user experience according to the specified country/regions or language.
-
-To specify the country/region and language, set the `mkt` (market) query parameter to a code from the **Markets** table below. The market specifies both a country/region and language. If the user prefers to see display text in a different language, set `setLang` query parameter to the appropriate language code.
-
-Alternatively, you can specify the country/region using the `cc` query parameter. If you specify a country/region, you must also specify one or more language codes using the `Accept-Language` HTTP header. The supported languages vary by country/region; they are given for each country/region in the Markets table.
-
-> [!NOTE]
-> The Trending Images API currently supports only the following markets:
-> - en-US (English, United States)
-> - en-CA (English, Canada)
-> - en-AU (English, Australia)
-> - zh-CN (Chinese, China)
-
-## Countries/Regions
-
-|Country/region|Code|
-|-|-|
-|Argentina|AR|
-|Australia|AU|
-|Austria|AT|
-|Belgium|BE|
-|Brazil|BR|
-|Canada|CA|
-|Chile|CL|
-|Denmark|DK|
-|Finland|FI|
-|France|FR|
-|Germany|DE|
-|Hong Kong SAR|HK|
-|India|IN|
-|Indonesia|ID|
-|Italy|IT|
-|Japan|JP|
-|Korea|KR|
-|Malaysia|MY|
-|Mexico|MX|
-|Netherlands|NL|
-|New Zealand|NZ|
-|Norway|NO|
-|China|CN|
-|Poland|PL|
-|Portugal|PT|
-|Philippines|PH|
-|Russia|RU|
-|Saudi Arabia|SA|
-|South Africa|ZA|
-|Spain|ES|
-|Sweden|SE|
-|Switzerland|CH|
-|Taiwan|TW|
-|T├╝rkiye|TR|
-|United Kingdom|GB|
-|United States|US|
--
-## Markets
-
-|Country/region|Language|Market Code|
-|-|--|--|
-|Argentina|Spanish|es-AR|
-|Australia|English|en-AU|
-|Austria|German|de-AT|
-|Belgium|Dutch|nl-BE|
-|Belgium|French|fr-BE|
-|Brazil|Portuguese|pt-BR|
-|Canada|English|en-CA|
-|Canada|French|fr-CA|
-|Chile|Spanish|es-CL|
-|Denmark|Danish|da-DK|
-|Finland|Finnish|fi-FI|
-|France|French|fr-FR|
-|Germany|German|de-DE|
-|Hong Kong SAR|Traditional Chinese|zh-HK|
-|India|English|en-IN|
-|Indonesia|English|en-ID|
-|Italy|Italian|it-IT|
-|Japan|Japanese|ja-JP|
-|Korea|Korean|ko-KR|
-|Malaysia|English|en-MY|
-|Mexico|Spanish|es-MX|
-|Netherlands|Dutch|nl-NL|
-|New Zealand|English|en-NZ|
-|China|Chinese|zh-CN|
-|Poland|Polish|pl-PL|
-|Portugal|Portuguese|pt-PT|
-|Philippines|English|en-PH|
-|Russia|Russian|ru-RU|
-|Saudi Arabia|Arabic|ar-SA|
-|South Africa|English|en-ZA|
-|Spain|Spanish|es-ES|
-|Sweden|Swedish|sv-SE|
-|Switzerland|French|fr-CH|
-|Switzerland|German|de-CH|
-|Taiwan|Traditional Chinese|zh-TW|
-|T├╝rkiye|Turkish|tr-TR|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|United States|Spanish|es-US|
-
-## Next steps
-For more information about the Bing News Search endpoints, see [News Image Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference).
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/overview.md
- Title: What is the Bing Image Search API?-
-description: The Bing Image Search API enables you to use Bing's cognitive image search capabilities in your application. By sending user search queries with the API, you can get and display relevant and high-quality images similar to Bing Images.
------ Previously updated : 01/05/2022-
-#Customer intent: As a developer, I want to integrate Bing's image search capabilities into my app, so that I can provide relevant, engaging images to my users.
---
-# What is the Bing Image Search API?
--
-The Bing Image Search API enables you to use Bing's image search capabilities in your application. By sending search queries to the API, you can get high-quality images similar to [bing.com/images](https://www.bing.com/images).
-
-While the Bing Image Search API provides image-only search results, you can combine or use the other available [Bing Search APIs](../bing-web-search/bing-api-comparison.md) to find many types of content on the web.
-
-## Bing Image Search features
-
-| Feature | Description |
-|--||
-| [Suggest search terms in real-time](./concepts/bing-image-search-sending-queries.md) | Improve your app experience by using the [Bing Autosuggest API](../bing-autosuggest/get-suggested-search-terms.md) to display suggested search terms as they're typed. |
-| [Filter and restrict image results](./concepts/bing-image-search-get-images.md) | Filter the images that Bing returns by editing query parameters. |
-| [Crop, resize, and display thumbnails](../bing-web-search/resize-and-crop-thumbnails.md) | Edit and display thumbnail previews for the images returned by Bing Image Search. |
-| [Pivot & expand user search queries](./concepts/bing-image-search-sending-queries.md) | Expand your search capabilities by including and displaying Bing-suggested search terms to queries. |
-| [Get trending images](trending-images.md) | Customize a search for trending images from around the world. |
-
-## Workflow
-
-The Bing Image Search API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON. You can use the service using either the [REST API](./quickstarts/csharp.md), or the [SDK](./quickstarts/client-libraries.md?pivots=programming-language-csharp%253fpivots%253dprogramming-language-csharp).
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-2. Send a request to the API, with a valid [search query](./concepts/bing-image-search-sending-queries.md).
-3. Process the API response by parsing the returned JSON message.
-
-## Next steps
-
-First, try the Bing Image Search API [interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/).
-This demo shows how you can quickly customize a search query and scour the web for images.
-
-To quickly get started with your first API request, you can learn to:
-
-* [Send search queries to Bing](./quickstarts/csharp.md) using the REST API, or
-* [Request and filter](./quickstarts/client-libraries.md?pivots=programming-language-csharp%253fpivots%253dprogramming-language-csharp) the images Bing returns using the SDK.
-
-## See also
-
-* [Pricing details](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/) for the Bing Search APIs.
-
-* The [Bing Image Search API v7](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference) reference section contains information on the API's endpoints, headers, API responses, and query parameters.
-
-* The [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
-
-* The [Getting images from the web with the Bing Image Search API](./concepts/bing-image-search-get-images.md) article describes how to search and get images from the web.
-
-* The [Sending and working with search queries](./concepts/bing-image-search-sending-queries.md) article describes how to make, customize, and pivot search queries.
-
-* Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing Image Search client library'-
-description: The Image Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 01/05/2022---
-# Quickstart: Use the Bing Image Search client library
-------------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/csharp.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and C#"-
-description: "Use this quickstart to send image search requests to the Bing Image Search REST API using C#, and receive JSON responses."
------ Previously updated : 01/05/2022---
-# Quickstart: Search for images using the Bing Image Search REST API and C#
--
-Use this quickstart to learn how to send search requests to the Bing Image Search API. This C# application sends a search query to the API, and displays the URL of the first image in the results. Although this application is written in C#, the API is a RESTful web service compatible with most programming languages.
-
-## Prerequisites
-* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
-* The [Json.NET](https://www.newtonsoft.com/json) framework, available as a NuGet package.
-* If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
-
-## Create and initialize a project
-
-1. Create a new console solution named `BingSearchApisQuickStart` in Visual Studio. Then, add the following namespaces to the main code file:
-
- ```csharp
- using System;
- using System.Net;
- using System.IO;
- using System.Collections.Generic;
- using Newtonsoft.Json.Linq;
- ```
-
-2. Create variables for the API endpoint, your subscription key, and search term. For `uriBase`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- //...
- namespace BingSearchApisQuickstart
- {
- class Program
- {
- // Replace the this string with your valid access key.
- const string subscriptionKey = "enter your key here";
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/images/search";
- const string searchTerm = "tropical ocean";
- //...
- ```
-
-## Create a struct to format the Bing Image Search response
-
-Define a `SearchResult` struct to contain the image search results and JSON header information.
-
-```csharp
- namespace BingSearchApisQuickstart
- {
- class Program
- {
- //...
- struct SearchResult
- {
- public String jsonResult;
- public Dictionary<String, String> relevantHeaders;
- }
-//...
-```
-
-## Create a method to send search requests
-
-Create a method named `BingImageSearch` to perform the call to the API, and set the return type to the `SearchResult` struct created previously.
-
-```csharp
-//...
-namespace BingSearchApisQuickstart
-{
- //...
- class Program
- {
- //...
- static SearchResult BingImageSearch(string searchTerm)
- {
- }
-//...
-```
-
-## Create and handle an image search request
-
-In the `BingImageSearch` method, perform the following steps:
-
-1. Construct the URI for the search request. Format the `SearchTerm` search term before you append it to the string.
-
- ```csharp
- static SearchResult BingImageSearch(string SearchTerm){
-
- var uriQuery = uriBase + "?q=" + Uri.EscapeDataString(SearchTerm);
- //...
- ```
-
-2. Send the web request and get the response as a JSON string.
-
- ```csharp
- WebRequest request = WebRequest.Create(uriQuery);
- request.Headers["Ocp-Apim-Subscription-Key"] = subscriptionKey;
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
- ```
-
-3. Create the search result object and extract the Bing HTTP headers. Then, return `searchResult`.
-
- ```csharp
- // Create the result object for return
- var searchResult = new SearchResult()
- {
- jsonResult = json,
- relevantHeaders = new Dictionary<String, String>()
- };
-
- // Extract Bing HTTP headers
- foreach (String header in response.Headers)
- {
- if (header.StartsWith("BingAPIs-") || header.StartsWith("X-MSEdge-"))
- searchResult.relevantHeaders[header] = response.Headers[header];
- }
- return searchResult;
- ```
-
-## Process and view the response
-
-1. In the main method, call `BingImageSearch()` and store the returned response. Then, deserialize the JSON into an object.
-
- ```csharp
- SearchResult result = BingImageSearch(searchTerm);
- //deserialize the JSON response from the Bing Image Search API
- dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(result.jsonResult);
- ```
-
-2. Get the first returned image from `jsonObj`, and print out the title and a URL to the image.
- ```csharp
- var firstJsonObj = jsonObj["value"][0];
- Console.WriteLine("Title for the first image result: " + firstJsonObj["name"]+"\n");
- //After running the application, copy the output URL into a browser to see the image.
- Console.WriteLine("URL for the first image result: " + firstJsonObj["webSearchUrl"]+"\n");
- ```
--
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Image Search single-page app tutorial](../tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Try an online interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/)
-* [Pricing details for the Bing Search APIs](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/java.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and Java"-
-description: Use this quickstart to send image search requests to the Bing Image Search REST API using Java, and receive JSON responses.
------ Previously updated : 01/05/2022---
-# Quickstart: Search for images with the Bing Image Search API and Java
--
-Use this quickstart to learn how to send search requests to the Bing Image Search API in Azure AI services. This Java application sends a search query to the API, and displays the URL of the first image in the results. Although this application is written in Java, the API is a RESTful web service compatible with most programming languages.
-
-## Prerequisites
-
-* The [Java Development Kit(JDK)](/azure/developer/java/fundamentals/java-support-on-azure)
-
-* The [Gson library](https://github.com/google/gson)
-
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.net.*;
- import java.util.*;
- import java.io.*;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. Create variables for the API endpoint, your subscription key, and search term. For `host`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- static String subscriptionKey = "enter key here";
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/images/search";
- static String searchTerm = "tropical ocean";
- ```
-
-## Construct the search request and query
-
-Use the variables from the previous step to format a search URL for the API request. URL-encode the search term before you appended it to the request.
-
-```java
-// construct the search request URL (in the form of endpoint + query string)
-URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8"));
-HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
-connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
-```
-
-## Receive and process the JSON response
-
-1. Receive the JSON response from the Bing Image Search API and construct the result object.
-
- ```java
- // receive JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
- ```
-2. Separate the Bing-related HTTP headers from the JSON body.
-
- ```java
- // extract Bing-related HTTP headers
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")) {
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
- ```
-
-3. Close the stream, and parse the response. Get the total number of returned search results and the thumbnail url to the first image result.
-
- ```java
- stream.close();
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(result.jsonResponse).getAsJsonObject();
- //get the first image result from the JSON object, along with the total
- //number of images returned by the Bing Image Search API.
- String total = json.get("totalEstimatedMatches").getAsString();
- JsonArray results = json.getAsJsonArray("value");
- JsonObject first_result = (JsonObject)results.get(0);
- String resultURL = first_result.get("thumbnailUrl").getAsString();
- ```
-
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Image Search single-page app tutorial](../tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Try an online interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/)
-* [Pricing details for the Bing Search APIs](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/nodejs.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and Node.js"-
-description: Use this quickstart to send image search requests to the Bing Image Search REST API using JavaScript, and JSON responses.
------ Previously updated : 01/05/2022----
-# Quickstart: Search for images using the Bing Image Search REST API and Node.js
--
-Use this quickstart to learn how to send search requests to the Bing Image Search API. This JavaScript application sends a search query to the API, and displays the URL of the first image in the results. Although this application is written in JavaScript, the API is a RESTful web service compatible with most programming languages.
-
-## Prerequisites
-
-* The latest version of [Node.js](https://nodejs.org/en/download/).
-
-* The [JavaScript Request Library](https://github.com/request/request).
-
-For more information, see [Azure AI services pricing - Bing Search API](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/).
-
-## Create and initialize the application
-
-1. Create a new JavaScript file in your favorite IDE or editor, and set the strictness and HTTPS requirements.
-
- ```javascript
- 'use strict';
- let https = require('https');
- ```
-
-2. Create variables for the API endpoint, image API search path, your subscription key, and search term. For `host`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- let subscriptionKey = 'enter key here';
- let host = 'api.cognitive.microsoft.com';
- let path = '/bing/v7.0/images/search';
- let term = 'tropical ocean';
- ```
-
-## Construct the search request and query.
-
-1. Use the variables from the last step to format a search URL for the API request. URL-encode your search term before you send it to the API.
-
- ```javascript
- let request_params = {
- method : 'GET',
- hostname : host,
- path : path + '?q=' + encodeURIComponent(search),
- headers : {
- 'Ocp-Apim-Subscription-Key' : subscriptionKey,
- }
- };
- ```
-
-2. Use the request library to send your query to the API.
- ```javascript
- let req = https.request(request_params, response_handler);
- req.end();
- ```
-
-## Handle and parse the response
-
-1. Define a function named `response_handler` that takes an HTTP call, `response`, as a parameter.
-
-2. Within this function, define a variable to contain the body of the JSON response.
-
- ```javascript
- let response_handler = function (response) {
- let body = '';
- };
- ```
-
-3. Store the body of the response when the `data` flag is called.
-
- ```javascript
- response.on('data', function (d) {
- body += d;
- });
- ```
-
-4. When an `end` flag is signaled, get the first result from the JSON response. Print the URL for the first image, along with the total number of returned images.
-
- ```javascript
- response.on('end', function () {
- let firstImageResult = imageResults.value[0];
- console.log(`Image result count: ${imageResults.value.length}`);
- console.log(`First image thumbnail url: ${firstImageResult.thumbnailUrl}`);
- console.log(`First image web search url: ${firstImageResult.webSearchUrl}`);
- });
- ```
-
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page app](../tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Try an online interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/)
-* [Pricing details for the Bing Search APIs](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/php.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and PHP"-
-description: Use this quickstart to send image search requests to the Bing Image Search REST API using PHP, and receive JSON responses.
------ Previously updated : 05/08/2020---
-# Quickstart: Search for images using the Bing Image Search REST API and PHP
--
-Use this quickstart to make your first call to the Bing Image Search API and receive a JSON response. The simple application in this article sends a search query and displays the raw results.
-
-Although this application is written in PHP, the API is a RESTful Web service compatible with any programming language that can make HTTP requests and parse JSON.
-
-## Prerequisites
-
-* [PHP 5.6.x or later](https://php.net/downloads.php)
-
-For more information, see [Azure AI services pricing - Bing Search API](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/).
-
-## Create and initialize the application
-
-To run this application, follow these steps:
-
-1. Make sure secure HTTP support is enabled in your `php.ini` file. For Windows, this file is located in *C:\windows*.
-2. Create a new PHP project in your favorite IDE or editor.
-3. Define the API endpoint, your subscription key, and search term. The endpoint can be the global endpoint in the following code, or the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```php
- $endpoint = 'https://api.cognitive.microsoft.com/bing/v7.0/images/search';
- // Replace the accessKey string value with your valid access key.
- $accessKey = 'enter key here';
- $term = 'tropical ocean';
- ```
-
-## Construct and perform an HTTP request
-
-1. Use the variables from the last step to prepare an HTTP request to the Image Search API.
-
- ```php
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
- $options = array ( 'http' => array (
- 'header' => $headers,
- 'method' => 'GET' ));
- ```
-
-2. Send the web request and get the JSON response.
-
- ```php
- $context = stream_context_create($options);
- $result = file_get_contents($url . "?q=" . urlencode($query), false, $context);
- ```
-
-## Process and print the JSON
-
-Process and print the returned JSON response.
-
-```php
-$headers = array();
- foreach ($http_response_header as $k => $v) {
- $h = explode(":", $v, 2);
- if (isset($h[1]))
- if (preg_match("/^BingAPIs-/", $h[0]) || preg_match("/^X-MSEdge-/", $h[0]))
- $headers[trim($h[0])] = trim($h[1]);
- }
- return array($headers, $result);
-```
-
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Image Search single-page app tutorial](../tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Try an online interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/)
-* [Pricing details for the Bing Search APIs](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/python.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and Python"-
-description: Use this quickstart to send image search requests to the Bing Image Search REST API using Python, and receive JSON responses.
------ Previously updated : 01/05/2022----
-# Quickstart: Search for images using the Bing Image Search REST API and Python
--
-Use this quickstart to learn how to send search requests to the Bing Image Search API. This Python application sends a search query to the API, and displays the URL of the first image in the results. Although this application is written in Python, the API is a RESTful web service compatible with most programming languages.
-
-## Prerequisites
-
-* [Python 2.x or 3.x](https://www.python.org/)
-* The [Python Imaging Library (PIL)](https://pillow.readthedocs.io/en/stable/https://docsupdatetracker.net/index.html)
-* [matplotlib](https://matplotlib.org/)
-
-## Create and initialize the application
-
-1. Create a new Python file in your favorite IDE or editor, and import the following modules. Create a variable for your subscription key, search endpoint, and search term. For `search_url`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- import requests
- import matplotlib.pyplot as plt
- from PIL import Image
- from io import BytesIO
-
- subscription_key = "your-subscription-key"
- search_url = "https://api.cognitive.microsoft.com/bing/v7.0/images/search"
- search_term = "puppies"
- ```
-
-2. Add your subscription key to the `Ocp-Apim-Subscription-Key` header by creating a dictionary, and adding the key as a value.
-
- ```python
- headers = {"Ocp-Apim-Subscription-Key" : subscription_key}
- ```
-
-## Create and send a search request
-
-1. Create a dictionary for the search request's parameters. Add your search term to the `q` parameter. Set the `license` parameter to `public` to search for images in the public domain. Set the `imageType` to `photo` to search only for photos.
-
- ```python
- params = {"q": search_term, "license": "public", "imageType": "photo"}
- ```
-
-2. Use the `requests` library to call the Bing Image Search API. Add your header and parameters to the request, and return the response as a JSON object. Get the URLs to several thumbnail images from the response's `thumbnailUrl` field.
-
- ```python
- response = requests.get(search_url, headers=headers, params=params)
- response.raise_for_status()
- search_results = response.json()
- thumbnail_urls = [img["thumbnailUrl"] for img in search_results["value"][:16]]
- ```
-
-## View the response
-
-1. Create a new figure with four columns and four rows by using the matplotlib library.
-
-2. Iterate through the figure's rows and columns, and use the PIL library's `Image.open()` method to add an image thumbnail to each space.
-
-3. Use `plt.show()` to draw the figure and display the images.
-
- ```python
- f, axes = plt.subplots(4, 4)
- for i in range(4):
- for j in range(4):
- image_data = requests.get(thumbnail_urls[i+4*j])
- image_data.raise_for_status()
- image = Image.open(BytesIO(image_data.content))
- axes[i][j].imshow(image)
- axes[i][j].axis("off")
- plt.show()
- ```
--
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Image Search single-page app tutorial](../tutorial-bing-image-search-single-page-app.md)
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Pricing details for the Bing Search APIs](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/quickstarts/ruby.md
- Title: "Quickstart: Search for images using the Bing Image Search REST API and Ruby"-
-description: Use this quickstart to send image search requests to the Bing Image Search REST API using Ruby, and receive JSON responses.
------ Previously updated : 01/05/2022---
-# Quickstart: Search for images using the Bing Image Search REST API and Ruby
--
-Use this quickstart to make your first call to the Bing Image Search API and receive a JSON response. This simple Ruby application sends a search query to the API and displays the raw results.
-
-Although this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [The latest version of Ruby](https://www.ruby-lang.org/en/downloads/).
-
-For more information, see [Azure AI services pricing - Bing Search API](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/).
-
-## Create and initialize the application
-
-1. Import the following packages into your code file:
-
- ```ruby
- require 'net/https'
- require 'uri'
- require 'json'
- ```
-
-2. Create variables for the API endpoint, image API search path, your subscription key, and search term. For `uri`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```ruby
- uri = "https://api.cognitive.microsoft.com"
- path = "/bing/v7.0/images/search"
- term = "puppies"
- ```
-
-## Format and make an API request
-
-Use the variables from the previous step to format a search URL for the API request. Then, send the request.
-
-```ruby
-uri = URI(uri + path + "?q=" + URI.escape(term))
--
-request = Net::HTTP::Get.new(uri)
-request['Ocp-Apim-Subscription-Key'] = accessKey
-
-response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
-end
-```
-
-## Process and print the JSON
-
-After the response is received, you can parse the JSON, and get values from it. For example, the thumbnail URL to the first result, and the total number of returned images.
-
-```ruby
-response.each_header do |key, value|
- # header names are lowercased
- if key.start_with?("bingapis-") or key.start_with?("x-msedge-") then
- puts key + ": " + value
- end
-end
-
-parsed_json = JSON.parse(response.body)
-total_returned_images = parsed_json["totalEstimatedMatches"]
-first_result = parsed_json["value"][0]["thumbnailUrl"]
-
-puts "total number of returned matches: #{total_returned_images}"
-puts "Url to the thumbnail of the first returned search result: #{first_result}"
-```
-
-## Example JSON response
-
-Responses from the Bing Image Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
-"_type":"Images",
-"instrumentation":{
- "_type":"ResponseInstrumentation"
-},
-"readLink":"images\/search?q=tropical ocean",
-"webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=tropical ocean&FORM=OIIARP",
-"totalEstimatedMatches":842,
-"nextOffset":47,
-"value":[
- {
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?view=detailv2&FORM=OIIRPO&q=tropical+ocean&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&simid=608027248313960152",
- "name":"My Life in the Ocean | The greatest WordPress.com site in ...",
- "thumbnailUrl":"https:\/\/tse3.mm.bing.net\/th?id=OIP.fmwSKKmKpmZtJiBDps1kLAHaEo&pid=Api",
- "datePublished":"2017-11-03T08:51:00.0000000Z",
- "contentUrl":"https:\/\/mylifeintheocean.files.wordpress.com\/2012\/11\/tropical-ocean-wallpaper-1920x12003.jpg",
- "hostPageUrl":"https:\/\/mylifeintheocean.wordpress.com\/",
- "contentSize":"897388 B",
- "encodingFormat":"jpeg",
- "hostPageDisplayUrl":"https:\/\/mylifeintheocean.wordpress.com",
- "width":1920,
- "height":1200,
- "thumbnail":{
- "width":474,
- "height":296
- },
- "imageInsightsToken":"ccid_fmwSKKmK*mid_8607ACDACB243BDEA7E1EF78127DA931E680E3A5*simid_608027248313960152*thid_OIP.fmwSKKmKpmZtJiBDps1kLAHaEo",
- "insightsMetadata":{
- "recipeSourcesCount":0,
- "bestRepresentativeQuery":{
- "text":"Tropical Beaches Desktop Wallpaper",
- "displayText":"Tropical Beaches Desktop Wallpaper",
- "webSearchUrl":"https:\/\/www.bing.com\/images\/search?q=Tropical+Beaches+Desktop+Wallpaper&id=8607ACDACB243BDEA7E1EF78127DA931E680E3A5&FORM=IDBQDM"
- },
- "pagesIncludingCount":115,
- "availableSizesCount":44
- },
- "imageId":"8607ACDACB243BDEA7E1EF78127DA931E680E3A5",
- "accentColor":"0050B2"
- }]
-}
-```
--
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Image Search single-page app tutorial](../tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [What is the Bing Image Search API?](../overview.md)
-* [Try an online interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api/)
-* [Azure AI services documentation](../../../ai-services/index.yml)
-* [Bing Image Search API reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Trending Images https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/trending-images.md
- Title: Get trending images with the Bing Image Search API-
-description: Search for today's trending images from the web with the Bing Image Search API.
------ Previously updated : 03/04/2019----
-# Get trending images from the web
--
-To get today's trending images, send the following GET request:
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/trending?mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The Trending Images API currently supports only the following markets:
--- en-US (English, United States) -- en-CA (English, Canada) -- en-AU (English, Australia) -- zh-CN (Chinese, China)-
-The response contains a [TrendingImages](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#trendingimages) object that lists images by category. Use the category's `title` to group the images in your user experience. The categories may change daily.
-
-```json
-{
- "_type" : "TrendingImages",
- "categories" : [{
- "title" : "Popular people searches",
- "tiles" : [{
- "query" : {
- "text" : "Smith",
- "displayText" : "Mr. Smith",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=smith&FORM=..."
- },
- "image" : {
- "id" : "C3C60AE779A054D5CD80D3CACF0F3",
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?id=OIP.M2532...",
- "contentUrl" : "http:\/\/www.contoso.com.au\/assets\/Uploads\/smith-SH01.jpg",
- "thumbnail" : {
- "width" : 288,
- "height" : 300
- }
- }
- },
- . . .
- ]
- },
- . . .
- {
- "title" : "Popular Halloween searches",
- "tiles" : [{
- "query" : {
- "text" : "Halloween costumes for adults",
- "displayText" : "Halloween costumes for adults",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=Halloween+costumes..."
- },
- "image" : {
- "id" : "0F3395F2983003F89DCEE711B55D7FA53E4",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OIP.Me429c...",
- "contentUrl" : "http:\/\/images.domain.com\/products\/8179\/1-1\/adult-squirrel...",
- "thumbnail" : {
- "width" : 336,
- "height" : 480
- }
- }
- }]
- }]
-}
-```
-
-Each tile contains an image and options for getting related images. To get the related images, you can use the query `text` to call the [Image Search API](./overview.md) and display the related images yourself. Or, you can use the URL in `webSearchUrl` to take the user to Bing's images search results page, which contains the related images.
-
-If you call the Image Search API to get the related images, set the [id](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#id) query parameter to the ID in the `id` field. Specifying the ID ensures that the response contains the image (it is the first image in the response) and its related images. Also, set the [q](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference) query parameter to the text in the `query` object's `text` field.
-
-The following example shows how to use the image ID to get related images of Mr. Smith in the preceding Trending Images API response.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=Smith&id=77FDE4A1C6529A23C7CF0EC073FAA64843E828F2&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
cognitive-services Tutorial Bing Image Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/tutorial-bing-image-search-single-page-app.md
- Title: "Tutorial: Create a single-page web app - Bing Image Search API"-
-description: The Bing Image Search API enables you to search the web for high-quality, relevant images. Use this tutorial to build a single-page web application that can send search queries to the API, and display the results within the webpage.
------ Previously updated : 03/05/2020----
-# Tutorial: Create a single-page app using the Bing Image Search API
--
-The Bing Image Search API enables you to search the web for high-quality, relevant images. Use this tutorial to build a single-page web application that can send search queries to the API, and display the results within the webpage. This tutorial is similar to the [corresponding tutorial](../bing-web-search/tutorial-bing-web-search-single-page-app.md) for Bing Web Search.
-
-The tutorial app illustrates how to:
-
-> [!div class="checklist"]
-> * Perform a Bing Image Search API call in JavaScript
-> * Improve search results using search options
-> * Display and page through search results
-> * Request and handle an API subscription key, and Bing client ID.
-
-## Prerequisites
-
-* The latest version of [Node.js](https://nodejs.org/).
-* The [Express.js](https://expressjs.com/) framework for Node.js. Installation instructions for the source code are available in the GitHub sample readme file.
-
-## Manage and store user subscription keys
-
-This application uses web browsers' persistent storage to store API subscription keys. If no key is stored, the webpage will prompt the user for their key and store it for later use. If the key is later rejected by the API, The app will remove it from storage. This sample uses the global endpoint. You can also use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
--
-Define `storeValue` and `retrieveValue` functions to use either the `localStorage` object (if the browser supports it) or a cookie.
-
-```javascript
-// Cookie names for data being stored
-API_KEY_COOKIE = "bing-search-api-key";
-CLIENT_ID_COOKIE = "bing-search-client-id";
-// The Bing Image Search API endpoint
-BING_ENDPOINT = "https://api.cognitive.microsoft.com/bing/v7.0/images/search";
-
-try { //Try to use localStorage first
- localStorage.getItem;
-
- window.retrieveValue = function (name) {
- return localStorage.getItem(name) || "";
- }
- window.storeValue = function(name, value) {
- localStorage.setItem(name, value);
- }
-} catch (e) {
- //If the browser doesn't support localStorage, try a cookie
- window.retrieveValue = function (name) {
- var cookies = document.cookie.split(";");
- for (var i = 0; i < cookies.length; i++) {
- var keyvalue = cookies[i].split("=");
- if (keyvalue[0].trim() === name) return keyvalue[1];
- }
- return "";
- }
- window.storeValue = function (name, value) {
- var expiry = new Date();
- expiry.setFullYear(expiry.getFullYear() + 1);
- document.cookie = name + "=" + value.trim() + "; expires=" + expiry.toUTCString();
- }
-}
-```
-
-The `getSubscriptionKey()` function attempts to retrieve a previously stored key using `retrieveValue`. If one isn't found, it will prompt the user for their key, and store it using `storeValue`.
-
-```javascript
-
-// Get the stored API subscription key, or prompt if it's not found
-function getSubscriptionKey() {
- var key = retrieveValue(API_KEY_COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Search API subscription key:", "").trim();
- }
- // always set the cookie in order to update the expiration date
- storeValue(API_KEY_COOKIE, key);
- return key;
-}
-```
-
-The HTML `<form>` tag `onsubmit` calls the `bingWebSearch` function to return search results. `bingWebSearch` uses `getSubscriptionKey` to authenticate each query. As shown in the previous definition, `getSubscriptionKey` prompts the user for the key if the key hasn't been entered. The key is then stored for continuing use by the application.
-
-```html
-<form name="bing" onsubmit="this.offset.value = 0; return bingWebSearch(this.query.value,
-bingSearchOptions(this), getSubscriptionKey())">
-```
-
-## Send search requests
-
-This application uses an HTML `<form>` to initially send user search requests, using the `onsubmit` attribute to call `newBingImageSearch()`.
-
-```html
-<form name="bing" onsubmit="return newBingImageSearch(this)">
-```
-
-By default, the `onsubmit` handler returns `false`, keeping the form from being submitted.
-
-## Select search options
-
-![[Bing Image Search form]](media/cognitive-services-bing-images-api/image-search-spa-form.png)
-
-The Bing Image Search API offers several [filter query parameters](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#filter-query-parameters) to narrow and filter search results. The HTML form in this application uses and displays the following parameter options:
-
-| Option | Description |
-|--||
-| `where` | A drop-down menu for selecting the market (location and language) used for the search. |
-| `query` | The text field in which to enter the search terms. |
-| `aspect` | Radio buttons for choosing the proportions of the found images: roughly square, wide, or tall. |
-| `color` | |
-| `when` | Drop-down menu for optionally limiting the search to the most recent day, week, or month. |
-| `safe` | A checkbox indicating whether to use Bing's SafeSearch feature to filter out "adult" results. |
-| `count` | Hidden field. The number of search results to return on each request. Change to display fewer or more results per page. |
-| `offset` | Hidden field. The offset of the first search result in the request; used for paging. It's reset to `0` on a new request. |
-| `nextoffset` | Hidden field. Upon receiving a search result, this field is set to the value of the `nextOffset` in the response. Using this field avoids overlapping results on successive pages. |
-| `stack` | Hidden field. A JSON-encoded list of the offsets of preceding pages of search results, for navigating back to previous pages. |
-
-The `bingSearchOptions()` function formats these options into a partial query string, which can be used in the app's API requests.
-
-```javascript
-// Build query options from the HTML form
-function bingSearchOptions(form) {
-
- var options = [];
- options.push("mkt=" + form.where.value);
- options.push("SafeSearch=" + (form.safe.checked ? "strict" : "off"));
- if (form.when.value.length) options.push("freshness=" + form.when.value);
- var aspect = "all";
- for (var i = 0; i < form.aspect.length; i++) {
- if (form.aspect[i].checked) {
- aspect = form.aspect[i].value;
- break;
- }
- }
- options.push("aspect=" + aspect);
- if (form.color.value) options.push("color=" + form.color.value);
- options.push("count=" + form.count.value);
- options.push("offset=" + form.offset.value);
- return options.join("&");
-}
-```
-
-## Performing the request
-
-Using the search query, options string, and API key, the `BingImageSearch()` function uses an XMLHttpRequest object to make the request to the Bing Image Search endpoint.
--
-```javascript
-// perform a search given query, options string, and API key
-function bingImageSearch(query, options, key) {
-
- // scroll to top of window
- window.scrollTo(0, 0);
- if (!query.trim().length) return false; // empty query, do nothing
-
- showDiv("noresults", "Working. Please wait.");
- hideDivs("results", "related", "_json", "_http", "paging1", "paging2", "error");
-
- var request = new XMLHttpRequest();
- var queryurl = BING_ENDPOINT + "?q=" + encodeURIComponent(query) + "&" + options;
-
- // open the request
- try {
- request.open("GET", queryurl);
- }
- catch (e) {
- renderErrorMessage("Bad request (invalid URL)\n" + queryurl);
- return false;
- }
-
- // add request headers
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
- request.setRequestHeader("Accept", "application/json");
- var clientid = retrieveValue(CLIENT_ID_COOKIE);
- if (clientid) request.setRequestHeader("X-MSEdge-ClientID", clientid);
-
- // event handler for successful response
- request.addEventListener("load", handleBingResponse);
-
- // event handler for erorrs
- request.addEventListener("error", function() {
- renderErrorMessage("Error completing request");
- });
-
- // event handler for aborted request
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-
- // send the request
- request.send();
- return false;
-}
-```
-
-Upon successful completion of the HTTP request, JavaScript calls the "load" event handler `handleBingResponse()` to handle a successful HTTP GET request.
-
-```javascript
-// handle Bing search request results
-function handleBingResponse() {
- hideDivs("noresults");
-
- var json = this.responseText.trim();
- var jsobj = {};
-
- // try to parse JSON results
- try {
- if (json.length) jsobj = JSON.parse(json);
- } catch(e) {
- renderErrorMessage("Invalid JSON response");
- }
-
- // show raw JSON and HTTP request
- showDiv("json", preFormat(JSON.stringify(jsobj, null, 2)));
- showDiv("http", preFormat("GET " + this.responseURL + "\n\nStatus: " + this.status + " " +
- this.statusText + "\n" + this.getAllResponseHeaders()));
-
- // if HTTP response is 200 OK, try to render search results
- if (this.status === 200) {
- var clientid = this.getResponseHeader("X-MSEdge-ClientID");
- if (clientid) retrieveValue(CLIENT_ID_COOKIE, clientid);
- if (json.length) {
- if (jsobj._type === "Images") {
- if (jsobj.nextOffset) document.forms.bing.nextoffset.value = jsobj.nextOffset;
- renderSearchResults(jsobj);
- } else {
- renderErrorMessage("No search results in JSON response");
- }
- } else {
- renderErrorMessage("Empty response (are you sending too many requests too quickly?)");
- }
- }
-
- // Any other HTTP response is an error
- else {
- // 401 is unauthorized; force re-prompt for API key for next request
- if (this.status === 401) invalidateSubscriptionKey();
-
- // some error responses don't have a top-level errors object, so gin one up
- var errors = jsobj.errors || [jsobj];
- var errmsg = [];
-
- // display HTTP status code
- errmsg.push("HTTP Status " + this.status + " " + this.statusText + "\n");
-
- // add all fields from all error responses
- for (var i = 0; i < errors.length; i++) {
- if (i) errmsg.push("\n");
- for (var k in errors[i]) errmsg.push(k + ": " + errors[i][k]);
- }
-
- // also display Bing Trace ID if it isn't blocked by CORS
- var traceid = this.getResponseHeader("BingAPIs-TraceId");
- if (traceid) errmsg.push("\nTrace ID " + traceid);
-
- // and display the error message
- renderErrorMessage(errmsg.join("\n"));
- }
-}
-```
-
-> [!IMPORTANT]
-> Successful HTTP requests may contain failed search information. If an error occurs during the search operation, the Bing Image Search API will return a non-200 HTTP status code and error information in the JSON response. Additionally, if the request was rate-limited, the API will return an empty response.
-
-## Display the search results
-
-Search results are displayed by the `renderSearchResults()` function, which takes the JSON returned by the Bing Image Search service and calls an appropriate renderer function on any returned images and related searches.
-
-```javascript
-function renderSearchResults(results) {
-
- // add Prev / Next links with result count
- var pagingLinks = renderPagingLinks(results);
- showDiv("paging1", pagingLinks);
- showDiv("paging2", pagingLinks);
-
- showDiv("results", renderImageResults(results.value));
- if (results.relatedSearches)
- showDiv("sidebar", renderRelatedItems(results.relatedSearches));
-}
-```
-
-Image search results are contained in the top-level `value` object within the JSON response. These are passed to `renderImageResults()`, which iterates through the results and converts each item into HTML.
-
-```javascript
-function renderImageResults(items) {
- var len = items.length;
- var html = [];
- if (!len) {
- showDiv("noresults", "No results.");
- hideDivs("paging1", "paging2");
- return "";
- }
- for (var i = 0; i < len; i++) {
- html.push(searchItemRenderers.images(items[i], i, len));
- }
- return html.join("\n\n");
-}
-```
-
-The Bing Image Search API can return four types of search suggestions to help guide users' search experiences, each in its own top-level object:
-
-| Suggestion | Description |
-|--||
-| `pivotSuggestions` | Queries that replace a pivot word in original search with a different one. For example, if you search for "red flowers," a pivot word might be "red," and a pivot suggestion might be "yellow flowers." |
-| `queryExpansions` | Queries that narrow the original search by adding more terms. For example, if you search for "Microsoft Surface," a query expansion might be "Microsoft Surface Pro." |
-| `relatedSearches` | Queries that have also been entered by other users who entered the original search. For example, if you search for "Mount Rainier," a related search might be "Mt. Saint Helens." |
-| `similarTerms` | Queries that are similar in meaning to the original search. For example, if you search for "kittens," a similar term might be "cute." |
-
-This application only renders the `relatedItems` suggestions, and places the resulting links in the page's sidebar.
-
-## Rendering search results
-
-In this application, the `searchItemRenderers` object contains renderer functions that generate HTML for each kind of search result.
-
-```javascript
-searchItemRenderers = {
- images: function(item, index, count) { ... },
- relatedSearches: function(item) { ... }
-}
-```
-
-These renderer functions accept the following parameters:
-
-| Parameter | Description |
-||-|
-| `item` | The JavaScript object containing the item's properties, such as its URL and its description. |
-| `index` | The index of the result item within its collection. |
-| `count` | The number of items in the search result item's collection. |
-
-The `index` and `count` parameters are used to number results, generate HTML for collections, and organize the content. Specifically, it:
-
-* Calculates the image thumbnail size (width varies, with a minimum of 120 pixels, while height is fixed at 90 pixels).
-* Builds the HTML `<img>` tag to display the image thumbnail.
-* Builds the HTML `<a>` tags that link to the image and the page that contains it.
-* Builds the description that displays information about the image and the site it's on.
-
-```javascript
- images: function (item, index, count) {
- var height = 120;
- var width = Math.max(Math.round(height * item.thumbnail.width / item.thumbnail.height), 120);
- var html = [];
- if (index === 0) html.push("<p class='images'>");
- var title = escape(item.name) + "\n" + getHost(item.hostPageDisplayUrl);
- html.push("<p class='images' style='max-width: " + width + "px'>");
- html.push("<img src='"+ item.thumbnailUrl + "&h=" + height + "&w=" + width +
- "' height=" + height + " width=" + width + "'>");
- html.push("<br>");
- html.push("<nobr><a href='" + item.contentUrl + "'>Image</a> - ");
- html.push("<a href='" + item.hostPageUrl + "'>Page</a></nobr><br>");
- html.push(title.replace("\n", " (").replace(/([a-z0-9])\.([a-z0-9])/g, "$1.<wbr>$2") + ")</p>");
- return html.join("");
- }, // relatedSearches renderer omitted
-```
-
-The thumbnail image's `height` and `width` are used in both the `<img>` tag and the `h` and `w` fields in the thumbnail's URL. This enables Bing to return [a thumbnail](../bing-web-search/resize-and-crop-thumbnails.md) of exactly that size.
-
-## Persisting client ID
-
-Responses from the Bing search APIs may include a `X-MSEdge-ClientID` header that should be sent back to the API with successive requests. If multiple Bing Search APIs are being used, the same client ID should be used with all of them, if possible.
-
-Providing the `X-MSEdge-ClientID` header allows the Bing APIs to associate all of a user's searches, which is useful in
-
-First, it allows the Bing search engine to apply past context to searches to find results that better satisfy the user. If a user has previously searched for terms related to sailing, for example, a later search for "knots" might preferentially return information about knots used in sailing.
-
-Second, Bing may randomly select users to experience new features before they are made widely available. Providing the same client ID with each request ensures that users that have been chosen to see a feature always see it. Without the client ID, the user might see a feature appear and disappear, seemingly at random, in their search results.
-
-Browser security policies (CORS) may prevent the `X-MSEdge-ClientID` header from being available to JavaScript. This limitation occurs when the search response has a different origin from the page that requested it. In a production environment, you should address this policy by hosting a server-side script that does the API call on the same domain as the Web page. Since the script has the same origin as the Web page, the `X-MSEdge-ClientID` header is then available to JavaScript.
-
-> [!NOTE]
-> In a production Web application, you should perform the request server-side anyway. Otherwise, your Bing Search API key must be included in the Web page, where it is available to anyone who views source. You are billed for all usage under your API subscription key, even requests made by unauthorized parties, so it is important not to expose your key.
-
-For development purposes, you can make the Bing Web Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that allows response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our tutorial app to access the client ID header. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then issue the following command in a command window:
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Extract Image details using the Bing Image Search API](tutorial-image-post.md)
-
-## See also
-
-* [Bing Image Search API reference](/rest/api/cognitiveservices/bing-images-api-v7-reference)
cognitive-services Tutorial Image Post https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Image-Search/tutorial-image-post.md
- Title: "Tutorial: Extract image details with the REST API and C# - Bing Image Search"-
-description: Use this tutorial to create a C# application that extracts image details using the Bing Image Search API.
------ Previously updated : 12/06/2019----
-# Tutorial: Extract image details using the Bing Image Search API and C#
--
-There are multiple [endpoints](./image-search-endpoint.md) available through the Bing Image Search API. The `/details` endpoint accepts a POST request with an image, and can return a variety of details about the image. This C# application sends an image using this API, and displays the details returned by Bing, which are JSON objects, such as the following:
-
-![[JSON results]](media/cognitive-services-bing-images-api/jsonResult.jpg)
-
-This tutorial explains how to:
-
-> [!div class="checklist"]
-> * Use the Image Search `/details` endpoint in a `POST` request
-> * Specify headers for the request
-> * Use URL parameters to specify results
-> * Upload the image data and send the `POST` request
-> * Print the JSON results to the console
-
-## Prerequisites
-
-* Any edition of [Visual studio 2017 or later](https://visualstudio.microsoft.com/downloads/).
-
-## Construct an image details search request
-
-The following is the `/details` endpoint, which accepts POST requests with image data in the body of the request. You can use the global endpoint below, or the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-```
-https://api.cognitive.microsoft.com/bing/v7.0/images/details
-```
-
-When constructing the search request URL, the `modules` parameter follows the above endpoint, and specifies the types of details the results will contain:
-
-* `modules=All`
-* `modules=RecognizedEntities` (people or places visible in the image)
-
-Specify `modules=All` in the POST request to get JSON text that includes the following:
-
-* `bestRepresentativeQuery` - a Bing query that returns images similar to the uploaded image
-* `detectedObjects` - objects found in the image
-* `image` - metadata for the image
-* `imageInsightsToken` - a token for a later GET requests that get `RecognizedEntities` (people or places visible in the image) from the image.
-* `imageTags` - tags for the image
-* `pagesIncluding` - Web pages that include the image
-* `relatedSearches` - searches based on details in the image.
-* `visuallySimilarImages` - similar images on the web.
-
-Specify `modules=RecognizedEntities` in the POST request to only get `imageInsightsToken`, which can be used in a subsequent GET request to identify people or places in the image.
-
-## Create a WebClient object, and set headers for the API request
-
-Create a `WebClient` object, and set the headers. All requests to the Bing Search API require an `Ocp-Apim-Subscription-Key`. A `POST` request to upload an image must also specify `ContentType: multipart/form-data`.
-
-```javascript
-WebClient client = new WebClient();
-client.Headers["Ocp-Apim-Subscription-Key"] = accessKey;
-client.Headers["ContentType"] = "multipart/form-data";
-```
-
-## Upload the image, and display the results
-
-The `WebClient` class's `UpLoadFile()` method formats data for the `POST` request, including formatting `RequestStream` and calling `HttpWebRequest`.
-
-Call `WebClient.UpLoadFile()` with the `/details` endpoint and the image file to upload. Use the JSON response to initialize an instance of the `SearchResult` structure, and store the response.
-
-```javascript
-const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/images/details";
-// The image to upload. Replace with your file and path.
-const string imageFile = "your-image.jpg";
-byte[] resp = client.UploadFile(uriBase + "?modules=All", imageFile);
-var json = System.Text.Encoding.Default.GetString(resp);
-// Create result object for return
-var searchResult = new SearchResult()
-{
- jsonResult = json,
- relevantHeaders = new Dictionary<String, String>()
-};
-```
-This JSON response can then be printed to the console.
-
-## Use an image insights token in a request
-
-To use the `ImageInsightsToken` returned with results of a `POST`, you can add it to a `GET` request. For example:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/images/details?InsightsToken="bcid_A2C4BB81AA2C9EF8E049C5933C546449*ccid_osS7gaos*mid_BF7CC4FC4A882A3C3D56E644685BFF7B8BACEAF2
-```
-
-If there are identifiable people or places in the image, this request will return information about them.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Display images and search options in a single-page Web app
-](tutorial-bing-image-search-single-page-app.md)
-
-## See also
-
-* [Bing Image Search API reference](/rest/api/cognitiveservices/bing-images-api-v7-reference)
cognitive-services Bing News Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/bing-news-upgrade-guide-v5-to-v7.md
- Title: Upgrade Bing News Search API v5 to v7-
-description: Identifies the parts of your Bing News Search application that you need to update to use version 7.
------- Previously updated : 01/10/2019---
-# News Search API upgrade guide
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing News Search API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number changed from v5 to v7. For example, `https://api.cognitive.microsoft.com/bing/v7.0/news/search`.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
--- Replaced the v5 error codes with the following possible `code` and `subCode` values.-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the sub-code conditions occur. The response includes these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
-
-### Object changes
--- Added the `contractualRules` field to the [NewsArticle](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#newsarticle) object. The `contractualRules` field contains a list of rules that you must follow (for example, article attribution). You must apply the attribution provided in `contractualRules` instead of using `provider`. The article includes `contractualRules` only when the [Web Search API](../bing-web-search/overview.md) response contains a News answer.-
-## Non-breaking Changes
-
-### Query parameters
--- Added Products as a possible value that you may set the [category](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#category) query parameter to. See [Categories By Markets](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference).--- Added the [SortBy](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#sortby) query parameter, which returns trending topics sorted by date with the most recent first.--- Added the [Since](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#since) query parameter, which returns trending topics that were discovered by Bing on or after the specified Unix epoch timestamp.-
-### Object changes
--- Added the `mentions` field to the [NewsArticle](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#newsarticle) object. The `mentions` field contains a list of entities (persons or places) that were found in the article.--- Added the `video` field to the [NewsArticle](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#newsarticle) object. The `video` field contains a video that's related to the news article. The video is either an \<iframe\> that you can embed or a motion thumbnail.--- Added the `sort` field to the [News](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#news) object. The `sort` field shows the sort order of the articles. For example, the articles are sorted by relevance (default) or date.--- Added the [SortValue](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#sortvalue) object, which defines a sort order. The `isSelected` field indicates whether the response used the sort order. If **true**, the response used the sort order. If `isSelected` is **false**, you can use the URL in the `url` field to request a different sort order.
cognitive-services Search For News https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/concepts/search-for-news.md
- Title: Search for news with the Bing News Search API-
-description: Learn how to send search queries for general news, trending topics, and headlines.
------- Previously updated : 12/18/2019---
-# Search for news with the Bing News Search API
--
-The Bing Image Search API makes it easy to integrate Bing's cognitive news searching capabilities into your applications.
-
-While the Bing News Search API primarily finds and returns relevant news articles, it provides several features for intelligent, and focused news retrieval on the web.
-
-## Suggest and use search terms
-
-If you provide a search box where the user enters their search term, use the [Bing Autosuggest API](../../bing-autosuggest/get-suggested-search-terms.md) to improve the experience. The API returns suggested query strings based on partial search terms as the user types.
-
-After the user enters their search term, URL encode it before setting the [q](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#query) query parameter. For example, if the user enters *sailing dinghies*, set `q` to `sailing+dinghies` or `sailing%20dinghies`.
-
-## Get general news
-
-To get general news articles related to the user's search term from the web, send the following GET request:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=sailing+dinghies&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-To get news from a specific domain, use the [site:](/previous-versions/bing/search/ff795613(v=msdn.10)) query operator.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=sailing+dinghies+site:contososailing.com&mkt=en-us HTTP/1.1
-```
-
-The following JSON sample shows the response to the previous query. As part of the [Use and display requirements](../../bing-web-search/use-display-requirements.md) for the Bing search APIs, you must display each news article in the order provided in the response. If the article has clustered articles, you should indicate that related articles exist and display them upon request.
-
-```json
-{
- "_type" : "News",
- "readLink" : "https:\/\/api.cognitive.microsoft.com\/bing\/v5\/news\/search?q=sailing+dinghies",
- "totalEstimatedMatches" : 88400,
- "value" : [{
- "name" : "Sailing Vies for Four Trophies",
- "url" : "http:\/\/www.bing.com\/cr?IG=CCE2F06CA750455891FE99A72...",
- "image" : {
- "thumbnail" : {
- "contentUrl" : "https:\/\/www.bing.com\/th?id=ON.9C23AA5...",
- "width" : 650,
- "height" : 341
- }
- },
- "description" : "College Rankings, presented by Zim...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "contoso.com"
- }],
- "datePublished" : "2017-04-14T15:28:00"
- },
-
- ...
-
- {
- "name" : "Fabrikam Sailing Club to host Mirror Dinghy...",
- "url" : "http:\/\/www.bing.com\/cr?IG=CCE2F06CA750455891F...",
- "image" : {
- "thumbnail" : {
- "contentUrl" : "https:\/\/www.bing.com\/th?id=ON.36...",
- "width" : 448,
- "height" : 300
- }
- },
- "description" : "The sailing club that trained Olympian Ben...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "Contoso"
- }],
- "datePublished" : "2017-04-04T11:02:00",
- "category" : "Sports"
- }]
-}
-```
-
-The [news](/rest/api/cognitiveservices-bingsearch/bing-news-api-v5-reference#news) answer lists the news articles that Bing thought were relevant to the query. The `totalEstimatedMatches` field contains an estimate of the number of articles available to view. For information about paging through the articles, see [Paging News](../../bing-web-search/paging-search-results.md).
-
-Each [news article](/rest/api/cognitiveservices-bingsearch/bing-news-api-v5-reference#newsarticle) in the list includes the article's name, description, and URL to the article on the host's website. If the article contains an image, the object includes a thumbnail of the image. Use `name` and `url` to create a hyperlink that takes the user to the news article on the host's site. If the article includes an image, also make the image clickable using `url`. Be sure to use `provider` to attribute the article.
-
-If Bing can determine the category of news article, the article includes the `category` field.
-
-## Get today's top news
-
-To get today's top news articles, you can send the same general news request as before, while leaving the `q` parameter unset.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The response for getting top news is almost the same as the one for getting general news. However, the `news` answer doesn't include the `totalEstimatedMatches` field because there's a set number of results. The number of top news articles may vary depending on the news cycle. Be sure to use the `provider` field to attribute the article.
-
-## Get news by category
-
-To get news articles by category, such as the top sports or entertainment articles, send the following GET request to Bing:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news?category=sports&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-Use the [category](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#category) query parameter to specify the category of articles to get. For a list of possible news categories that you may specify, see [News Categories by Market](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#news-categories-by-market).
-
-The response for getting news by category is almost the same as getting general news. However, the articles are all from the specified category.
-
-## Get headline news
-
-To request headline news articles and get articles from all news categories, send the following GET request to Bing:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news?mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-Do not include the [category](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#category) query parameter.
-
-The response for getting headline news is the same as getting today's top news. If the article is a headline article, its `headline` field is set to **true**.
-
-By default, the response includes up to 12 headline articles. To change the number of headline articles to return, specify the [headlineCount](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#headlinecount) query parameter. The response also includes up to four non-headline articles per news category.
-
-The response counts clusters as one article. Because a cluster may have several articles, the response may include more than 12 headline articles and more than four non-headline articles per category.
-
-## Get trending news
-
-To get news topics that are trending on social networks, send the following GET request to Bing:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/trendingtopics?mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-X-MSAPI-UserState: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-> [!NOTE]
-> Trending Topics is available only in the en-US and zh-CN markets.
-
-The following JSON is the response to the preceding request. Each trending news article includes a related image, breaking news flag, and a URL to the Bing search results for the article. Use the URL in the `webSearchUrl` field to take the user to the Bing search results page. Or, use the query text to call the [Web Search API](../../bing-web-search/overview.md) to display the results yourself.
-
-```json
-{
- "_type" : "TrendingTopics",
- "value" : [{
- "name" : "Canada pot measure",
- "image" : {
- "url" : "https:\/\/www.bing.com\/th?id=OPN.RTNews_hHD...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "Contoso Images"
- }]
- },
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=070292D8CEDD...",
- "isBreakingNews" : false,
- "query" : {
- "text" : "Canada marijuana"
- }
- },
- {
- "name" : "Down on Vegas move",
- "image" : {
- "url" : "https:\/\/www.bing.com\/th?id=OPN.RTNews_Bfbmg8h...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "Contoso"
- }]
- },
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=070292D8CEDD...",
- "isBreakingNews" : false,
- "query" : {
- "text" : "Marcus Appel Las Vegas"
- }
- },
-
- ...
-
- ]
-}
-```
-
-## Getting related news
-
-If there are other articles that are related to a news article, the news article may include the [clusteredArticles](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#newsarticle-clusteredarticles) field. The following shows an article with clustered articles.
-
-```json
- {
- "name" : "Playoffs 2017: Betting lines, point spreads...",
- "url" : "http:\/\/www.bing.com\/cr?IG=4B7056CEC271408997D115...",
- "image" : {
- "thumbnail" : {
- "contentUrl" : "https:\/\/www.bing.com\/th?id=ON.D7B1...",
- "width" : 700,
- "height" : 393
- }
- },
- "description" : "April 14, 2017 3:37pm EDT April 14, 2017 3:34pm...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "Contoso"
- }],
- "datePublished" : "2017-04-14T19:43:00",
- "category" : "Sports",
- "clusteredArticles" : [{
- "name" : "Playoffs 2017: Betting odds, favorites to win...",
- "url" : "http:\/\/www.bing.com\/cr?IG=4B7056CEC271408997D1159E...",
- "description" : "April 14, 2017 3:30pm EDT April 14, 2017 3:27pm...",
- "provider" : [{
- "_type" : "Organization",
- "name" : "Contoso"
- }],
- "datePublished" : "2017-04-14T19:37:00",
- "category" : "Sports"
- }]
- },
-```
-
-## Throttling requests
--
-## Next steps
-
-> [!div class="nextstepaction"]
-> [How to page through Bing News Search results](../../bing-web-search/paging-search-results.md)
cognitive-services Send Search Queries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/concepts/send-search-queries.md
- Title: "Sending queries to the Bing News Search API"-
-description: The Bing News Search API enables you to search the web for relevant news items. Use this article to learn more about sending search queries to the API.
------- Previously updated : 12/18/2019---
-# Sending queries to the Bing News Search API
--
-The Bing News Search API enables you to search the web for relevant news items. Use this article to learn more about sending search queries to the API.
--
-## Sending a request
-
-To get news-only search results, you'd send a GET request to the following endpoint:
-
-```http
-https://api.cognitive.microsoft.com/bing/v7.0/news/search
-```
-
-The request must use the HTTPS protocol.
-
-We recommend that all requests originate from a server. Distributing the key as part of a client application provides more opportunity for a malicious third party to access it. Also, making calls from a server provides a single upgrade point for future versions of the API.
-
-The request must specify the [q](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#query) query parameter, which contains the user's search term. Although it's optional, the request should also specify the [mkt](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters such as `freshness` and `textDecorations`, see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#query-parameters). All query parameter values must be URL encoded.
-
-The request must specify the [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#subscriptionkey) header. Although optional, you are encouraged to also specify the following headers:
--- [User-Agent](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#useragent)-- [X-MSEdge-ClientID](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#clientid)-- [X-Search-ClientIP](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#clientip)-- [X-Search-Location](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#location)-
-The client IP and location headers are important for returning location aware content.
-
-For a list of all request and response headers, see [Headers](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#headers).
-
-The following shows a news request that includes all the suggested query parameters and headers. If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=sailing+dinghies&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Bing News Search API response
-
-The following shows the response to the previous request. The example also shows the response headers.
--
-```json
-BingAPIs-TraceId: 994974CC8D994C95A5C31387296A510A
-X-MSEdge-ClientID: 3358F499A06F6A562B88F8F4A1236BC0
-BingAPIs-Market: en-US
-
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=sailing%2bdinghies",
- "queryContext": {
- "originalQuery": "sailing+dinghies",
- "adultIntent": false
- },
- "totalEstimatedMatches": 60000,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=sailing%2bdinghies"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=sailing%2bdinghies&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Global single-handed sailing dinghy market research illuminated by new report",
- "url": "https:\/\/www.whatech.com\/market-research\/consumer\/506504-global-single-handed-sailing-dinghy-market-research-illuminated-by-new-report",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.784C1E1F53BA96E21EAD9382C8D47855&pid=News",
- "width": 490,
- "height": 280
- }
- },
- "description": "With this Single-Handed Sailing Dinghy Market report, one is sure to keep up with information on the dogged competition for market share and control, between elite manufacturers. It also features, price, production, and revenue. Global Single-Handed ...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/ba5cfb68-96fd-4529-bdd3-060f6fca43f1",
- "name": "Single-handed sailing"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "WhaTech",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=AR_7f43f11eb94501973a55b64ec0721b55&pid=news"
- }
- }
- }
- ],
- "datePublished": "2018-09-12T05:30:00.0000000Z",
- "category": "Business"
- },
- {
- "name": "Boat collides with luxury craft at sail launch",
- "url": "https:\/\/www.sunshinecoastdaily.com.au\/news\/boat-capsizes-in-display-at-the-launch-of-the-sout\/3523096\/",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.C2D335BDDAB1844EAF7775B121433119&pid=News",
- "width": 460,
- "height": 258
- }
- },
- "description": "The annual spectacle is never a dull affair with a flotilla of club vessels - from small sailing dinghy's to powerboats - completing a tight turn in the marina right in front of the club house. A strong northerly made conditions extra tricky for the 70 ...", "provider": [{"_type": "Organization", "name": "Sunshine Coast Daily", "image": {"thumbnail": {"contentUrl": "https:\/\/www.bing.com\/th?id=AR_73ce1412dfbebb5c4f539ac7c5e31429&pid=news"}}}], "datePublished": "2018-09-16T22:03:00.0000000Z", "category": "Sports"}, {"name": "Boat capsizes in display at the launch of the Southport Yacht Club sailing season", "url": "https:\/\/www.goldcoastbulletin.com.au\/news\/gold-coast\/boat-capsizes-in-display-at-the-launch-of-the-southport-yacht-club-sailing-season\/news-story\/6c0fb5366ed6a1abe93e85825598aee8", "image": {"thumbnail": {"contentUrl": "https:\/\/www.bing.com\/th?id=ON.247A9B91E2888976DA8F4776DC9B2372&pid=News", "width": 700, "height": 393}}, "description": "The annual spectacle is never a dull affair with a flotilla of club vessels - from small sailing dinghyΓÇÖs to powerboats - completing a tight turn in the marina right in front of the club house. A strong northerly made conditions extra tricky for the 70 ...", "about": [{"readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf2ea25d-2faf-1486-6db8-0e4c16cabed7", "name": "Southport"}], "provider": [{"_type": "Organization", "name": "Gold Coast Sun"}], "datePublished": "2018-09-16T14:05:00.0000000Z", "category": "Sports"}, {"name": "Caribbean Dinghy Championship 2018", "url": "https:\/\/www.sailingscuttlebutt.com\/2018\/09\/06\/caribbean-dinghy-championship-2018\/", "image": {"thumbnail": {"contentUrl": "https:\/\/www.bing.com\/th?id=ON.C9D13963192B123805E8BD0707370BFF&pid=News", "width": 620, "height": 350}}, "description": "After storms forced the cancellation of the 2017 Caribbean Dinghy Championship, the event returns in 2018 ... Launched in 1997, Scuttlebutt provides sailing news with a North American focus. Look for the latest information to be posted on the website ...", "about": [{"readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/7ee7f148-7ed7-b73e-7461-900ee716ef61", "name": "Caribbean"}], "provider": [{"_type": "Organization", "name": "Scuttlebutt Sailing News", "image": {"thumbnail": {"contentUrl": "https:\/\/www.bing.com\/th?id=AR_bce37315275c769315a43e2792dab150&pid=news"}}}], "datePublished": "2018-09-06T18:29:00.0000000Z"}, {"name": "Severna Park sailor places fifth at Optimist World Championship", "url": "http:\/\/www.capitalgazette.com\/sports\/ac-cs-tommy-sitzmann-feature-20180915-story.html", "description": "When the sailing conditions are right ... he could be a top contender on an international level by placing fifth at the United States Optimist Dinghy Association Team Trials, held April 26-29 out of Key Biscayne Yacht Club. That in itself was a massive ...", "about": [{"readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/1883f6c3-f9bf-357c-01b1-96120862af67", "name": "Severna Park"}, {"readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/5254c06e-0891-5637-4e51-45fa4eec4ca2", "name": "Optimist dinghy"}], "provider": [{"_type": "Organization", "name": "Capital Gazette", "image": {"thumbnail": {"contentUrl": "https:\/\/www.bing.com\/th?id=AR_ef9a3ded8bb90aef15d34f327e53e2ec&pid=news"}}}], "datePublished": "2018-09-15T22:04:00.0000000Z", "category": "Sports"}, {"name": "A Dorset dinghy celebrates 60 years on the water", "url": "https:\/\/www.bbc.co.uk\/programmes\/p06kk2zv", "description": "If you learned to sail as a child, or if you have children or grandchildren who sail then you will know about the AB sailing dinghy. The simple little boat was first designed and built in Poole in 1958 and this year it's celebrating its 60th anniversary.",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/248ebd80-8904-8a43-be23-3cd065a30350",
- "name": "Dorset"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/84fb5887-86ed-ecdb-55b7-718ba1cdefb8",
- "name": "BBC Radio Solent"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/1cf31e75-0340-8af2-1efc-e2cd0d0fa253",
- "name": "Water"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "BBC",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=AR_b639c1691c4fa767d85fd87b7042f9e6&pid=news"
- }
- }
- }
- ],
- "datePublished": "2018-09-07T10:29:00.0000000Z"
- },
- {
- "name": "Angst as Sailing misses Paris 2024 Paralympic inclusion",
- "url": "https:\/\/www.sail-world.com\/news\/210021\/Four-more-years--Para-Sailing-misses-Paris-cut",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0C996DAB550F7202E8C53BBCFF51B9F3&pid=News",
- "width": 700,
- "height": 466
- }
- },
- "description": "World Sailing has also put the second oldest Olympic class, the two-handed 470 on the skids, with moves to drop the men's and women's two-person dinghy events and replace them with a single mixed gender doublehander, with the class yet to be selected.",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/819fda72-a524-6f49-5e39-5d559e2a5969",
- "name": "2024 Summer Olympics"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/24256509-f062-baaa-3ed3-3ec1a7a2d38c",
- "name": "Sailing"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Sail World News"
- }
- ],
- "datePublished": "2018-09-15T06:24:00.0000000Z"
- },
- {
- "name": "West Sacramento sailing club uses warm weather for wind surfing",
- "url": "http:\/\/www.dailydemocrat.com\/article\/NI\/20180912\/NEWS\/180919960",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.6BC8EBF8DEFBA55247EFEEAF545DDE15&pid=News",
- "width": 384,
- "height": 400
- }
- },
- "description": "Once comfortable, newcomers can join in on the many hosted races, like the annual Delta Ditch Dinghy Race that begins in Rio Vista. ΓÇ£It truly is the best kept secret in Sacramento,ΓÇ¥ Glovin said. ΓÇ£ItΓÇÖs the best sailing around. You get the consistent ...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/aaf3c53a-9932-f043-c1ca-9cae2d19f9cf",
- "name": "West Sacramento"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Woodland Daily Democrat",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=AR_0b1348a0984c3f1177b2fff3b8f27549&pid=news"
- }
- }
- }
- ],
- "datePublished": "2018-09-12T22:55:00.0000000Z"
- },
- {
- "name": "SAILING: Sailing teams begin busy 2018ΓÇô19",
- "url": "https:\/\/yaledailynews.com\/blog\/2018\/09\/11\/sailing-teams-begin-busy-2018-19\/",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.ACEBE0C4D4E85B3E3DE149E8D31BC026&pid=News",
- "width": 700,
- "height": 524
- }
- },
- "description": "On the first day, Arcot and Ware sailed six of seven races in the Firefly dinghy, a boat with which they had no previous experience. Next weekend, both coed and womenΓÇÖs sailing head to Boston College. The coed team also scatters to MIT and Bowdoin while ...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/dac17b74-6cf9-27ba-27ff-8dc6f57b7a31",
- "name": "Sailing"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/dacda48e-35d6-bcad-0e81-96951267dfda",
- "name": "Sailing"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Yale Daily News",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=AR_6b2f0dfab97da868e0d3df07012f44a4&pid=news"
- }
- }
- }
- ],
- "datePublished": "2018-09-11T04:31:00.0000000Z",
- "category": "Sports"
- },
- {
- "name": "Tasar UK National Championship at Hayling Island Sailing Club",
- "url": "https:\/\/www.sail-world.com\/news\/209889",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.6A28956676E79790BED64ACD9498F7AF&pid=News",
- "width": 700,
- "height": 497
- }
- },
- "description": "Under the beautiful backdrop of the Spinnaker Tower, the Tasar fleet, who had the pleasure of sharing the sailing space with 43 Contenders, had fun milling around the Committee Boat waiting to start. The sight of so many dinghies is always gorgeous ...",
- "provider": [
- {
- "_type": "Organization",
- "name": "Sail World News"
- }
- ],
- "datePublished": "2018-09-11T15:30:00.0000000Z",
- "category": "Sports"
- }
- ]
-}
-
-```
-
-## Next steps
-
-* [What is Bing News Search?](../search-the-web.md).
-* [Get today's top news](search-for-news.md#get-todays-top-news)
-* [Get news by category](search-for-news.md#get-news-by-category)
-* [Get trending news](search-for-news.md#get-trending-news)
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/csharp.md
- Title: "Quickstart: Perform a news search with C# - Bing News Search REST API"-
-description: "Use this quickstart to send a request to the Bing News Search REST API using C#, and receive a JSON response."
------ Previously updated : 05/22/2020----
-# Quickstart: Search for news using C# and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple C# application sends a news search query to the API, and displays the JSON response.
-
-Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages.
-
-The full code to this sample can be found on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingNewsSearchv7.cs).
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
-* The [Json.NET](https://www.newtonsoft.com/json) framework, available as a NuGet package.
-* If you're using Linux/MacOS, you can run this application by using [Mono](https://www.mono-project.com/).
--
-## Create and initialize a project
-
-1. Create a new C# console solution in Visual Studio. Then, add the following namespaces to the main code file:
-
- ```csharp
- using System;
- using System.Text;
- using System.Net;
- using System.IO;
- using System.Collections.Generic;
- ```
-
-2. Create variables for the API endpoint, your subscription key, and search term. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- const string accessKey = "enter key here";
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/news/search";
- const string searchTerm = "Microsoft";
- ```
-
-## Create a struct to format the Bing News Search response
-
-Define a `SearchResult` struct to contain the news search results and JSON header information.
-
-```csharp
-struct SearchResult
-{
- public String jsonResult;
- public Dictionary<String, String> relevantHeaders;
-}
-```
-
-## Create and handle a news search request
-
-1. Create a method named `BingNewsSearch()` to call the API, and set the return type to the `SearchResult` struct created previously.
-
- Add code to this method in the steps that follow.
-
-1. Construct the URI for the search request. The `toSearch` search term must be formatted before it's appended to the string.
-
- ```csharp
- static SearchResult BingNewsSearch(string toSearch){
-
- var uriQuery = uriBase + "?q=" + Uri.EscapeDataString(toSearch);
- //...
- ```
-
-1. Perform the web request and get the response as a JSON string.
-
- ```csharp
- WebRequest request = WebRequest.Create(uriQuery);
- request.Headers["Ocp-Apim-Subscription-Key"] = subscriptionKey;
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
- ```
-
-1. Create the search result object, and extract the Bing HTTP headers. Then, return `searchResult`.
-
- ```csharp
- // Create the result object for return
- var searchResult = new SearchResult()
- {
- jsonResult = json,
- relevantHeaders = new Dictionary<String, String>()
- };
-
- // Extract Bing HTTP headers
- foreach (String header in response.Headers)
- {
- if (header.StartsWith("BingAPIs-") || header.StartsWith("X-MSEdge-"))
- searchResult.relevantHeaders[header] = response.Headers[header];
- }
- return searchResult;
- ```
-
-## Process the response
-
-In the main method, call `BingNewsSearch()` and store the returned response. Then, deserialize the JSON into an object where you can view the values of the response.
-
-```csharp
-SearchResult result = BingNewsSearch(searchTerm);
-//deserialize the JSON response
-dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(result.jsonResult);
-Console.WriteLine(jsonObj["value"][0])
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft",
- "totalEstimatedMatches": 36,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Microsoft to open flagship London brick-and-mortar retail store",
- "url": "http:\/\/www.contoso.com\/article\/microsoft-to-open-flagshi...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.F9E4A49EC010417...",
- "width": 220,
- "height": 146
- }
- },
- "description": "After years of rumors about Microsoft opening a brick-and-mortar...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entiti...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entit...",
- "name": "London"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T21:16:00.0000000Z",
- "category": "ScienceAndTechnology"
- },
-
- . . .
-
- {
- "name": "Microsoft adds Availability Zones to its Azure cloud platform",
- "url": "https:\/\/contoso.com\/2017\/09\/21\/microsoft-adds-availability...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0AE7595B9720...",
- "width": 700,
- "height": 466
- }
- },
- "description": "Microsoft has begun adding Availability Zones to its...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/a093e9b...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf3abf7d-e379-...",
- "name": "Windows Azure"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/9cdd061c-1fae-d0...",
- "name": "Cloud"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T09:01:00.0000000Z",
- "category": "ScienceAndTechnology"
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Endpoint News https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/endpoint-news.md
- Title: Bing News Search endpoints-
-description: This article provides a summary of the News search API endpoints; news, top news, and trending news.
------- Previously updated : 1/10/2019---
-# Bing News Search API endpoints
--
-The **News Search API** returns news articles, Web pages, images, videos, and [entities](../bing-entities-search/overview.md). Entities contain summary information about a person, place, or topic.
-
-## Endpoints
-
-To get news search results using the Bing News Search API, send a `GET` request to one of the following endpoints. The headers and URL parameters define further specifications.
-
-### News items by search query
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/search
-```
-
-Returns news items based on a search query. If the search query is empty, the API will return top news articles from different categories. Send a query by url encoding your search term and appending it to the`q=""` parameter. For availability, see [Supported countries/regions and markets](language-support.md#supported-markets-for-news-search-endpoint).
-
-### Top news items by category
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/news
-```
-
-Returns the top news items by category. You can specifically request the top business, sports, or entertainment articles using `category=business`, `category=sports`, or `category=entertainment`.  The `category` parameter can only be used with the `/news` URL. There are some formal requirements for specifying categories; refer to `category` in the [query parameter](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#query-parameters) documentation. Send a query by url encoding your search term and appending it to the`q=""` parameter. For availability, see [Supported countries/regions and markets](language-support.md#supported-markets-for-news-endpoint).
-
-### Trending news topics
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/news/trendingtopics
-```
-
-Returns news topics that are currently trending on social networks. When the `/trendingtopics` option is included, Bing search ignores several other parameters, such as `freshness` and `?q=""`. For availability, see [Supported countries/regions and markets](language-support.md#supported-markets-for-news-trending-endpoint).
-
-## Next steps
-
-For details about headers, parameters, market codes, response objects, errors, etc., see the [Bing News search API v7](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference) reference.
-
-For complete information about the parameters supported by each endpoint, see the reference pages for each type.
-For examples of basic requests using the News search API, see [Bing News Search Quick-starts](/azure/cognitive-services/bing-news-search/search-the-web).
cognitive-services Go https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/go.md
- Title: "Quickstart: Get news using Bing News Search REST API and Go"-
-description: This quickstart uses the Go language to call the Bing News Search API. The results include names and URLs of news sources identified by the query string.
------ Previously updated : 05/22/2020----
-# Quickstart: Get news results using the Bing News Search REST API and Go
--
-This quickstart uses the Go language to call the Bing News Search API. The results include names and URLs of news sources identified by the query string.
-
-## Prerequisites
-* Install the [Go binaries](https://go.dev/dl/).
-* Install the go-spew library to use a deep pretty printer to display the results. Use this command to install the library: `$ go get -u https://github.com/davecgh/go-spew`.
--
-## Create a project and import libraries
-
-Create a new Go project in your IDE or editor. Then, import `net/http` for requests, `ioutil` to read the response, `encoding/json` to handle the JSON text of results, and the `go-spew` library to parse the JSON results.
-
-```go
-package main
-
-import (
- "fmt"
- "net/http"
- "io/ioutil"
- "encoding/json"
- "github.com/davecgh/go-spew/spew"
-)
-
-```
-
-## Create a struct to format the news search results
-
-The `NewsAnswer` struct formats the data provided in the response JSON, which is multilevel and complex. The following implementation covers the essentials:
-
-```go
-// This struct formats the answer provided by the Bing News Search API.
-type NewsAnswer struct {
- ReadLink string `json: "readLink"`
- QueryContext struct {
- OriginalQuery string `json: "originalQuery"`
- AdultIntent bool `json: "adultIntent"`
- } `json: "queryContext"`
- TotalEstimatedMatches int `json: totalEstimatedMatches"`
- Sort []struct {
- Name string `json: "name"`
- ID string `json: "id"`
- IsSelected bool `json: "isSelected"`
- URL string `json: "url"`
- } `json: "sort"`
- Value []struct {
- Name string `json: "name"`
- URL string `json: "url"`
- Image struct {
- Thumbnail struct {
- ContentUrl string `json: "thumbnail"`
- Width int `json: "width"`
- Height int `json: "height"`
- } `json: "thumbnail"`
- } `json: "image"`
- Description string `json: "description"`
- Provider []struct {
- Type string `json: "_type"`
- Name string `json: "name"`
- } `json: "provider"`
- DatePublished string `json: "datePublished"`
- } `json: "value"`
-}
-
-```
-
-## Declare the main function and define variables
-
-The following code declares the main function and assigns the required variables. Confirm that the endpoint is correct, and then replace the `token` value with a valid subscription key from your Azure account. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```go
-func main() {
- // Verify the endpoint URI and replace the token string with a valid subscription key.
- const endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/news/search"
- token := "YOUR-ACCESS-KEY"
- searchTerm := "Microsoft Cognitive Services"
-
- // Declare a new GET request.
- req, err := http.NewRequest("GET", endpoint, nil)
- if err != nil {
- panic(err)
- }
-
- // The rest of the code in this example goes here in the main function.
-}
-```
-
-## Query and header
-
-Add the query string and access key header.
-
-```go
-// Add the query to the request.
-param := req.URL.Query()
-param.Add("q", searchTerm)
-req.URL.RawQuery = param.Encode()
-
-// Insert the subscription-key header.
-req.Header.Add("Ocp-Apim-Subscription-Key", token)
-
-```
-
-## GET request
-
-Create the client and send the GET request.
-
-```go
-// Instantiate a client.
-client := new(http.Client)
-
-// Send the request to Bing.
-resp, err := client.Do(req)
-if err != nil {
- panic(err)
-}
-
-```
-
-## Send the request
-
-Send the request and read the results by using `ioutil`.
-
-```go
-resp, err := client.Do(req)
- if err != nil {
- panic(err)
-}
-
-// Close the connection.
-defer resp.Body.Close()
-
-// Read the results
-body, err := ioutil.ReadAll(resp.Body)
-if err != nil {
- panic(err)
-}
-
-```
-
-## Handle the response
-
-The `Unmarshall` function extracts information from the JSON text returned by the Bing News Search API. Then, display nodes from the results with the `go-spew` pretty printer.
-
-```go
-// Create a new answer object
-ans := new(NewsAnswer)
-err = json.Unmarshal(body, &ans)
-if err != nil {
- fmt.Println(err)
-}
-
-fmt.Print("Output of BingAnswer: \r\n\r\n")
-
-// Iterate over search results and print the result name and URL.
-for _, result := range ans.Value{
-spew.Dump(result.Name, result.URL)
-}
-
-```
-
-## Results
-
-The following output contains the name and URL of each result:
-
-```
-(string) (len=91) "Cognitive Services Market: Global Industry Analysis and Opportunity Assessment, 2019 - 2025"
-(string) (len=142) "https://www.marketwatch.com/press-release/cognitive-services-market-global-industry-analysis-and-opportunity-assessment-20192025-2019-02-21"
-(string) (len=104) "Microsoft calls for greater collaboration to harness the power of AI to empower people with disabilities"
-(string) (len=115) "https://indiaeducationdiary.in/microsoft-calls-greater-collaboration-harness-power-ai-empower-people-disabilities-2/"
-(string) (len=70) "Microsoft 'Intelligent Cloud Hub' to build AI-ready workforce in India"
-(string) (len=139) "https://cio.economictimes.indiatimes.com/news/cloud-computing/microsoft-intelligent-cloud-hub-to-build-ai-ready-workforce-in-india/67187807"
-(string) (len=81) "Skills shortage is stopping many Asian companies from embracing A.I., study shows"
-(string) (len=106) "https://www.cnbc.com/2019/02/20/microsoft-idc-study-skills-shortages-stopping-companies-from-using-ai.html"
-(string) (len=143) "Cognitive Computing in Healthcare Market Emerging Top Key Vendors- Apixio, MedWhat, Healthcare X.0, Apple, Google, Microsoft, and IBM 2017-2025"
-(string) (len=40) "http://www.digitaljournal.com/pr/4163064"
-(string) (len=49) "Microsoft launches AI skills initiative in Brazil"
-(string) (len=80) "https://www.zdnet.com/article/microsoft-launches-ai-skills-initiative-in-brazil/"
-(string) (len=45) "Kuwait's CITRA and Microsoft host AI OpenHack"
-(string) (len=70) "http://www.itp.net/618639-kuwaits-citra-and-microsoft-host-ai-openhack"
-(string) (len=51) "CITRA and Microsoft collaborate to host AI workshop"
-(string) (len=123) "https://www.zawya.com/mena/en/press-releases/story/CITRA_and_Microsoft_collaborate_to_host_AI_workshop-ZAWYA20190212105751/"
-
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [What is Bing News Search](search-the-web.md)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/java.md
- Title: "Quickstart: Perform a web search with Java - Bing Web Search REST API"-
-description: Use this quickstart to send a request to the Bing News Search REST API using Java, and receive a JSON response.
------ Previously updated : 05/22/2020----
-# Quickstart: Perform a news search using Java and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple Java application sends a news search query to the API, and displays the JSON response.
-
-Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingNewsSearchv7.java).
-
-## Prerequisites
-
-* The [Java Development Kit (JDK) 7 or 8](/azure/developer/java/fundamentals/java-support-on-azure).
-* The [Gson library](https://github.com/google/gson).
---
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.net.*;
- import java.util.*;
- import java.io.*;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. Create a new class. Add variables for the API endpoint, your subscription key, and search term. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- public static SearchResults SearchNews (String searchQuery) throws Exception {
- static String subscriptionKey = "enter key here";
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/news/search";
- static String searchTerm = "Microsoft";
- //...
- }
- ```
-
-## Construct the search request, and receive a JSON response
-
-1. Use the variables from the previous step to format a search URL for the API request. URL-encode your search term before you append it to the request.
-
- ```java
- public static SearchResults SearchNews (String searchQuery) throws Exception {
- // construct the search request URL (in the form of URL + query string)
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8"));
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
- }
- ```
-
-2. Receive the JSON response from the Bing News Search API and construct the result object.
-
- ```java
- // receive JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
- ```
-
-## Process the JSON response
-
-1. Separate the Bing-related HTTP headers from the JSON body, then close the stream and return the API response.
-
- ```java
- // extract Bing-related HTTP headers
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")) {
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
- stream.close();
- return results;
- ```
-
-2. Create a method to parse and reserialize the JSON results.
-
- ```java
- // pretty-printer for JSON; uses GSON parser to parse and re-serialize
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
- ```
-
-3. In the main method of your application, call the search method and display the results.
-
- ```java
- public static void main (String[] args) {
- System.out.println("Searching the Web for: " + searchTerm);
- SearchResults result = SearchNews(searchTerm);
-
- System.out.println("\nRelevant HTTP Headers:\n");
- for (String header : result.relevantHeaders.keySet())
- System.out.println(header + ": " + result.relevantHeaders.get(header));
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(result.jsonResponse));
- }
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft",
- "totalEstimatedMatches": 36,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Microsoft to open flagship London brick-and-mortar retail store",
- "url": "http:\/\/www.contoso.com\/article\/microsoft-to-open-flagshi...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.F9E4A49EC010417...",
- "width": 220,
- "height": 146
- }
- },
- "description": "After years of rumors about Microsoft opening a brick-and-mortar...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entiti...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entit...",
- "name": "London"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T21:16:00.0000000Z",
- "category": "ScienceAndTechnology"
- },
-
- . . .
-
- {
- "name": "Microsoft adds Availability Zones to its Azure cloud platform",
- "url": "https:\/\/contoso.com\/2017\/09\/21\/microsoft-adds-availability...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0AE7595B9720...",
- "width": 700,
- "height": 466
- }
- },
- "description": "Microsoft has begun adding Availability Zones to its...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/a093e9b...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf3abf7d-e379-...",
- "name": "Windows Azure"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/9cdd061c-1fae-d0...",
- "name": "Cloud"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T09:01:00.0000000Z",
- "category": "ScienceAndTechnology"
- }
- ]
-}
-```
--
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/language-support.md
- Title: Language support - Bing News Search API-
-description: A list of natural languages, countries and regions that are supported by the Bing News Search API.
------- Previously updated : 1/10/2019---
-# Language and region support for the Bing News Search API
--
-The Bing News Search API supports numerous countries/regions, many with more than one language. Specifying a country/region with a query serves primarily to refine search results based on interests in that country/region. Additionally, the results may contain links to Bing, and these links may localize the Bing user experience according to the specified country/region or language.
-
-You can specify a country/region using the `cc` query parameter. If you specify a country/region, you must also specify one or more language codes using the `Accept-Language` HTTP header. The supported languages vary by countr/region; they are given for each country/region in the Markets table.
-
-Alternatively, you may specify the market using the `mkt` query parameter and a code from the **Markets** table. Specifying a market simultaneously specifies a country/region and a preferred language. The `setLang` query parameter may be set to a language code in this case; usually this is the same language specified by `mkt` unless the user prefers to see Bing in another language.
-
-## Supported markets for news search endpoint
-
-For the `/news/search` endpoint, the following table lists the market code values that you may use to specify the `mkt` query parameter. Bing returns content for only these markets. The list is subject to change.
-
-For a list of country/region codes that you may specify in the `cc` query parameter, see [Country Codes](#countrycodes).
-
-|Country/region|Language|Market code|
-||--|--|
-|Denmark|Danish|da-DK|
-|Austria|German|de-AT|
-|Switzerland|German|de-CH|
-|Germany|German|de-DE|
-|Australia|English|en-AU|
-|Canada|English|en-CA|
-|United Kingdom|English|en-GB|
-|Indonesia|English|en-ID|
-|Ireland|English|en-IE|
-|India|English|en-IN|
-|Malaysia|English|en-MY|
-|New Zealand|English|en-NZ|
-|Republic of the Philippines|English|en-PH|
-|Singapore|English|en-SG|
-|United States|English|en-US|
-|English|general|en-WW|
-|English|general|en-XA|
-|South Africa|English|en-ZA|
-|Argentina|Spanish|es-AR|
-|Chile|Spanish|es-CL|
-|Spain|Spanish|es-ES|
-|Mexico|Spanish|es-MX|
-|United States|Spanish|es-US|
-|Spanish|general|es-XL|
-|Finland|Finnish|fi-FI|
-|France|French|fr-BE|
-|Canada|French|fr-CA|
-|Belgium|Dutch|nl-BE|
-|Switzerland|French|fr-CH|
-|France|French|fr-FR|
-|Italy|Italian|it-IT|
-|Hong Kong SAR|Traditional Chinese|zh-HK|
-|Taiwan|Traditional Chinese|zh-TW|
-|Japan|Japanese|ja-JP|
-|Korea|Korean|ko-KR|
-|Netherlands|Dutch|nl-NL|
-|People's republic of China|Chinese|zh-CN|
-|Brazil|Portuguese|pt-BR|
-|Russia|Russian|ru-RU|
-|Sweden|Swedish|sv-SE|
-|T├╝rkiye|Turkish|tr-TR|
-
-## Supported markets for news endpoint
-For the `/news` endpoint, the following table lists the market code values that you may use to specify the `mkt` query parameter. Bing returns content for only these markets. The list is subject to change.
-
-For a list of country/region codes that you may specify in the `cc` query parameter, see [Country Codes](#countrycodes).
-
-|Country/region|Language|Market code|
-||--|--|
-|Denmark|Danish|da-DK|
-|Germany|German|de-DE|
-|Australia|English|en-AU|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|English|general|en-WW|
-|Chile|Spanish|es-CL|
-|Mexico|Spanish|es-MX|
-|United States|Spanish|es-US|
-|Finland|Finnish|fi-FI|
-|Canada|French|fr-CA|
-|France|French|fr-FR|
-|Italy|Italian|it-IT|
-|Brazil|Portuguese|pt-BR|
-|People's republic of China|Chinese|zh-CN|
-
-## Supported markets for news trending endpoint
-For the `/news/trendingtopics` endpoint, the following table lists the market code values that you may use to specify the `mkt` query parameter. Bing returns content for only these markets. The list is subject to change.
-
-For a list of country/region codes that you may specify in the `cc` query parameter, see [Country Codes](#countrycodes).
-
-|Country/region|Language|Market code|
-||--|--|
-|Germany|German|de-DE|
-|Australia|English|en-AU|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|Canada|English|en-CA|
-|India|English|en-IN|
-|France|French|fr-FR|
-|Canada|French|fr-CA|
-|Brazil|Portuguese|pt-BR|
-|People's republic of China|Chinese|zh-CN|
--
-<a name="countrycodes"></a>
-### Country codes
-
-The following are the country/region codes that you may specify in the `cc` query parameter. The list is subject to change.
-
-|Country/region|Country code|
-|||
-|Argentina|AR|
-|Australia|AU|
-|Austria|AT|
-|Belgium|BE|
-|Brazil|BR|
-|Canada|CA|
-|Chile|CL|
-|Denmark|DK|
-|Finland|FI|
-|France|FR|
-|Germany|DE|
-|Hong Kong SAR|HK|
-|India|IN|
-|Indonesia|ID|
-|Italy|IT|
-|Japan|JP|
-|Korea|KR|
-|Malaysia|MY|
-|Mexico|MX|
-|Netherlands|NL|
-|New Zealand|NZ|
-|Norway|NO|
-|People's Republic of China|CN|
-|Poland|PL|
-|Portugal|PT|
-|Republic of the Philippines|PH|
-|Russia|RU|
-|Saudi Arabia|SA|
-|South Africa|ZA|
-|Spain|ES|
-|Sweden|SE|
-|Switzerland|CH|
-|Taiwan|TW|
-|T├╝rkiye|TR|
-|United Kingdom|GB|
-|United States|US|
-
-## Next steps
-For more information about the Bing News Search endpoints, see [News Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference).
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/nodejs.md
- Title: "Quickstart: Perform a news search with Node.js - Bing News Search REST API"-
-description: Use this quickstart to send a request to the Bing News Search REST API using Node.js, and receive a JSON response.
------ Previously updated : 05/22/2020---
-# Quickstart: Perform a news search using Node.js and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple JavaScript application sends a search query to the API and displays the JSON response.
-
-Although this application is written in JavaScript and runs in Node.js, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingNewsSearchv7.js).
-
-## Prerequisites
-
-* The latest version of [Node.js](https://nodejs.org/en/download/).
-* The [JavaScript Request Library](https://github.com/request/request).
--
-## Create and initialize the application
-
-1. Create a new JavaScript file in your favorite IDE or editor, and set the strictness and HTTPS requirements.
-
- ```javascript
- 'use strict';
- let https = require('https');
- ```
-
-2. Create variables for the API endpoint, news API search path, your subscription key, and search term. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- let subscriptionKey = 'enter key here';
- let host = 'api.cognitive.microsoft.com';
- let path = '/bing/v7.0/news/search';
- let term = 'Microsoft';
- ```
-
-## Handle and parse the response
-
-1. Define a function named `response_handler` that takes an HTTP call, `response`, as a parameter.
-
- Add code to this function in the steps that follow.
-
-2. Define a variable to contain the body of the JSON response.
-
- ```javascript
- let response_handler = function (response) {
- let body = '';
- };
- ```
-
-3. Store the body of the response when the `data` flag is called.
-
- ```javascript
- response.on('data', function (d) {
- body += d;
- });
- ```
-
-3. When an `end` flag is signaled, the JSON and headers can be viewed.
-
- ```javascript
- response.on('end', function () {
- console.log('\nRelevant Headers:\n');
- for (var header in response.headers)
- // header keys are lower-cased by Node.js
- if (header.startsWith("bingapis-") || header.startsWith("x-msedge-"))
- console.log(header + ": " + response.headers[header]);
- body = JSON.stringify(JSON.parse(body), null, ' ');
- console.log('\nJSON Response:\n');
- console.log(body);
- });
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft",
- "totalEstimatedMatches": 36,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Microsoft to open flagship London brick-and-mortar retail store",
- "url": "http:\/\/www.contoso.com\/article\/microsoft-to-open-flagshi...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.F9E4A49EC010417...",
- "width": 220,
- "height": 146
- }
- },
- "description": "After years of rumors about Microsoft opening a brick-and-mortar...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entiti...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entit...",
- "name": "London"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T21:16:00.0000000Z",
- "category": "ScienceAndTechnology"
- },
-
- . . .
-
- {
- "name": "Microsoft adds Availability Zones to its Azure cloud platform",
- "url": "https:\/\/contoso.com\/2017\/09\/21\/microsoft-adds-availability...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0AE7595B9720...",
- "width": 700,
- "height": 466
- }
- },
- "description": "Microsoft has begun adding Availability Zones to its...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/a093e9b...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf3abf7d-e379-...",
- "name": "Windows Azure"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/9cdd061c-1fae-d0...",
- "name": "Cloud"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T09:01:00.0000000Z",
- "category": "ScienceAndTechnology"
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/php.md
- Title: "Quickstart: Perform a news search with PHP and the Bing News Search REST API"-
-description: Use this quickstart to send a request to the Bing News Search REST API using PHP, and receive a JSON response.
------ Previously updated : 05/22/2020---
-# Quickstart: Perform a news search using PHP and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple PHP application sends a search query to the API and displays the JSON response.
-
-Although this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* PHP 5.6 or later
--
-For more information, see [Azure AI services pricing - Bing Search API](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/).
-
-## Run the application
-
-To run this application, follow these steps:
-
-1. Enable secure HTTP support in your `php.ini` file by uncommenting the `;extension=php_openssl.dll` line, as described in the code comment.
-2. Create a new PHP project in your favorite IDE or editor.
-3. Add the code provided below.
-4. Replace the `accessKey` value with an access key valid for your subscription.
-5. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-6. Run the program.
-
-```php
-<?php
-
-// NOTE: Be sure to uncomment the following line in your php.ini file.
-// ;extension=php_openssl.dll
-
-// **********************************************
-// *** Update or verify the following values. ***
-// **********************************************
-
-// Replace the accessKey string value with your valid access key.
-$accessKey = 'enter key here';
-
-// Verify the endpoint URI. At this writing, only one endpoint is used for Bing
-// search APIs. In the future, regional endpoints may be available. If you
-// encounter unexpected authorization errors, double-check this value against
-// the endpoint for your Bing Search instance in your Azure dashboard.
-$endpoint = 'https://api.cognitive.microsoft.com/bing/v7.0/news/search';
-
-$term = 'Microsoft';
-
-function BingNewsSearch ($url, $key, $query) {
- // Prepare HTTP request
- // NOTE: Use the key 'http' even if you are making an HTTPS request. See:
- // https://php.net/manual/en/function.stream-context-create.php
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
- $options = array ('http' => array (
- 'header' => $headers,
- 'method' => 'GET' ));
-
- // Perform the Web request and get the JSON response
- $context = stream_context_create($options);
- $result = file_get_contents($url . "?q=" . urlencode($query), false, $context);
-
- // Extract Bing HTTP headers
- $headers = array();
- foreach ($http_response_header as $k => $v) {
- $h = explode(":", $v, 2);
- if (isset($h[1]))
- if (preg_match("/^BingAPIs-/", $h[0]) || preg_match("/^X-MSEdge-/", $h[0]))
- $headers[trim($h[0])] = trim($h[1]);
- }
-
- return array($headers, $result);
-}
-
-print "Searching news for: " . $term . "\n";
-
-list($headers, $json) = BingNewsSearch($endpoint, $accessKey, $term);
-
-print "\nRelevant Headers:\n\n";
-foreach ($headers as $k => $v) {
- print $k . ": " . $v . "\n";
-}
-
-print "\nJSON Response:\n\n";
-echo json_encode(json_decode($json), JSON_PRETTY_PRINT);
-?>
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft",
- "totalEstimatedMatches": 36,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Microsoft to open flagship London brick-and-mortar retail store",
- "url": "http:\/\/www.contoso.com\/article\/microsoft-to-open-flagshi...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.F9E4A49EC010417...",
- "width": 220,
- "height": 146
- }
- },
- "description": "After years of rumors about Microsoft opening a brick-and-mortar...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entiti...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entit...",
- "name": "London"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T21:16:00.0000000Z",
- "category": "ScienceAndTechnology"
- },
-
- . . .
-
- {
- "name": "Microsoft adds Availability Zones to its Azure cloud platform",
- "url": "https:\/\/contoso.com\/2017\/09\/21\/microsoft-adds-availability...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0AE7595B9720...",
- "width": 700,
- "height": 466
- }
- },
- "description": "Microsoft has begun adding Availability Zones to its...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/a093e9b...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf3abf7d-e379-...",
- "name": "Windows Azure"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/9cdd061c-1fae-d0...",
- "name": "Cloud"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T09:01:00.0000000Z",
- "category": "ScienceAndTechnology"
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/python.md
- Title: "Quickstart: Perform a news search with Python and the Bing News Search REST API"-
-description: Use this quickstart to send a request to the Bing News Search REST API using Python, and receive a JSON response.
------ Previously updated : 06/16/2020----
-# Quickstart: Perform a news search using Python and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple Python application sends a search query to the API and processes the JSON result.
-
-Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-To run this code sample as a Jupyter notebook on [MyBinder](https://mybinder.org), select the **launch binder** badge:
-
-[![launch binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/Microsoft/cognitive-services-notebooks/master?filepath=BingNewsSearchAPI.ipynb)
-
-The source code for this sample is also available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingNewsSearchv7.py).
--
-## Create and initialize the application
-
-Create a new Python file in your favorite IDE or editor, and import the request module. Create variables for your subscription key, endpoint, and search term. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```python
-import requests
-
-subscription_key = "your subscription key"
-search_term = "Microsoft"
-search_url = "https://api.cognitive.microsoft.com/bing/v7.0/news/search"
-```
-
-## Create parameters for the request
-
-Add your subscription key to a new dictionary, using `Ocp-Apim-Subscription-Key` as the key. Do the same for your search parameters.
-
-```python
-headers = {"Ocp-Apim-Subscription-Key" : subscription_key}
-params = {"q": search_term, "textDecorations": True, "textFormat": "HTML"}
-```
-
-## Send a request and get a response
-
-1. Use the requests library to call the Bing Visual Search API with your subscription key, and the dictionary objects you created in the previous step.
-
- ```python
- response = requests.get(search_url, headers=headers, params=params)
- response.raise_for_status()
- search_results = json.dumps(response.json())
- ```
-
-2. Access the descriptions of the articles contained in the response from the API, which is stored in `search_results` as a JSON object.
-
- ```python
- descriptions = [article["description"] for article in search_results["value"]]
- ```
-
-## Display the results
-
-These descriptions can then be rendered as a table with the search keyword highlighted in bold.
-
-```python
-from IPython.display import HTML
-rows = "\n".join(["<tr><td>{0}</td></tr>".format(desc)
- for desc in descriptions])
-HTML("<table>"+rows+"</table>")
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing News Search client library'-
-description: The News Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 03/12/2020---
-# Quickstart: Use the Bing News Search client library
-------------
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/ruby.md
- Title: "Quickstart: Perform a news search with Ruby and the Bing News Search REST API"-
-description: Use this quickstart to send a request to the Bing News Search REST API using Ruby, and receive a JSON response.
------ Previously updated : 05/22/2020----
-# Quickstart: Perform a news search using Ruby and the Bing News Search REST API
--
-Use this quickstart to make your first call to the Bing News Search API. This simple Ruby application sends a search query to the API and processes the JSON response.
-
-Although this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/ruby/Search/BingNewsSearchv7.rb).
-
-## Prerequisites
-
-* Ruby [2.4 or later](https://www.ruby-lang.org/en/downloads/)
--
-## Create and initialize the application
-
-1. Import the following packages into your code file:
-
- ```ruby
- require 'net/https'
- require 'uri'
- require 'json'
- ```
-
-2. Create variables for the API endpoint, news search URL, your subscription key, and search term. You can use the global endpoint in the following code, or use the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```ruby
- accessKey = "enter key here"
- uri = "https://api.cognitive.microsoft.com"
- path = "/bing/v7.0/news/search"
- term = "Microsoft"
- ```
-
-## Format and make an API request
-
-Use the variables from the previous step to format a search URL for the API request. Then, send the request.
-
-```ruby
-uri = URI(uri + path + "?q=" + URI.escape(term))
-request = Net::HTTP::Get.new(uri)
-request['Ocp-Apim-Subscription-Key'] = accessKey
-response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
-end
-```
-
-## Process and print the JSON response
-
-After the response is received, parse the JSON, and then print both the response body and its headers.
-
-```ruby
-puts "\nRelevant Headers:\n\n"
-response.each_header do |key, value|
- # header names are coerced to lowercase
- if key.start_with?("bingapis-") or key.start_with?("x-msedge-") then
- puts key + ": " + value
- end
-end
-puts "\nJSON Response:\n\n"
-puts JSON::pretty_generate(JSON(response.body))
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "News",
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft",
- "totalEstimatedMatches": 36,
- "sort": [
- {
- "name": "Best match",
- "id": "relevance",
- "isSelected": true,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft"
- },
- {
- "name": "Most recent",
- "id": "date",
- "isSelected": false,
- "url": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/news\/search?q=Microsoft&sortby=date"
- }
- ],
- "value": [
- {
- "name": "Microsoft to open flagship London brick-and-mortar retail store",
- "url": "http:\/\/www.contoso.com\/article\/microsoft-to-open-flagshi...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.F9E4A49EC010417...",
- "width": 220,
- "height": 146
- }
- },
- "description": "After years of rumors about Microsoft opening a brick-and-mortar...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entiti...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entit...",
- "name": "London"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T21:16:00.0000000Z",
- "category": "ScienceAndTechnology"
- },
-
- . . .
-
- {
- "name": "Microsoft adds Availability Zones to its Azure cloud platform",
- "url": "https:\/\/contoso.com\/2017\/09\/21\/microsoft-adds-availability...",
- "image": {
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.0AE7595B9720...",
- "width": 700,
- "height": 466
- }
- },
- "description": "Microsoft has begun adding Availability Zones to its...",
- "about": [
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/a093e9b...",
- "name": "Microsoft"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/cf3abf7d-e379-...",
- "name": "Windows Azure"
- },
- {
- "readLink": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/entities\/9cdd061c-1fae-d0...",
- "name": "Cloud"
- }
- ],
- "provider": [
- {
- "_type": "Organization",
- "name": "Contoso"
- }
- ],
- "datePublished": "2017-09-21T09:01:00.0000000Z",
- "category": "ScienceAndTechnology"
- }
- ]
-}
-```
-
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](tutorial-bing-news-search-single-page-app.md)
cognitive-services Search The Web https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/search-the-web.md
- Title: What is the Bing News Search API?-
-description: Learn how to use the Bing News Search API to search the web for current headlines across categories, including headlines and trending topics.
------- Previously updated : 12/18/2019---
-# What is the Bing News Search API?
--
-The Bing News Search API makes it easy to integrate Bing's cognitive news searching capabilities into your applications. The API provides a similar experience to [Bing News](https://www.bing.com/news), letting you send search queries and receive relevant news articles.
-
-Be aware that the Bing News Search API provides news search results only. Use the [Bing Web Search API](../bing-web-search/overview.md), [Video Search API](../bing-video-search/overview.md) and [Image Search API](../bing-image-search/overview.md) for other types of web content.
-
-## Bing News Search API features
-
-While the Bing News Search API primarily finds and returns relevant news articles, it provides several features for intelligent, and focused news retrieval on the web.
-
-|Feature |Description |
-|||
-|[Suggesting and using search terms](concepts/search-for-news.md#suggest-and-use-search-terms) | Improve your search experience by using the [Bing Autosuggest API](../bing-autosuggest/get-suggested-search-terms.md) to display suggested search terms as they're typed. |
-|[Get general news](concepts/search-for-news.md#get-general-news) | Find news by sending a search query to the Bing News Search API, and getting back a list of relevant news articles. |
-|[Today's top news](concepts/search-for-news.md#get-todays-top-news) | Get the top news stories for the day, across all categories. |
-|[News by category](concepts/search-for-news.md) | Search for news in specific categories. |
-|[Headline news](concepts/search-for-news.md) | Search for top headlines across all categories. |
-
-## Workflow
-
-The Bing News Search API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON. You can use the service using either the REST API, or the SDK.
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-2. Send a request to the API, with a valid search query.
-3. Process the API response by parsing the returned JSON message.
-
-## Next steps
-
-First, try the [interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-news-search-api/) for the Bing News Search API. This demo shows how you can quickly customize a search query and find news on the web.
-
-To quickly get started with your first API request, try a quickstart for the [REST API](./csharp.md) or one of the [SDKs](./quickstarts/client-libraries.md?pivots=programming-language-csharp).
-
-## See also
-
-* The [Bing News Search API v7](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference) reference section contains definitions and information on the endpoints, headers, API responses, and query parameters that you can use to request image-based search results.
-* The [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
-* Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Tutorial Bing News Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-News-Search/tutorial-bing-news-search-single-page-app.md
- Title: "Tutorial: Create a single-page web app using the Bing News Search API"-
-description: Use this tutorial to build a single-page web application that can send search queries to the Bing News API, and display the results within the webpage.
------ Previously updated : 06/23/2020----
-# Tutorial: Create a single-page web app
--
-The Bing News Search API lets you search the Web and obtain results of the news type relevant to a search query. In this tutorial, we build a single-page Web application that uses the Bing News Search API to display search results on the page. The application includes HTML, CSS, and JavaScript components. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/BingNewsSearchApp.html).
-
-<!-- Remove until we can replace it with sanitized copy
-![Single-page Bing News Search app](media/news-search-singlepage.png)
>-
-> [!NOTE]
-> The JSON and HTTP headings at the bottom of the page when clicked show the JSON response and HTTP request information. These details can be useful when exploring the service.
-
-The tutorial app illustrates how to:
-> [!div class="checklist"]
-> * Perform a Bing News Search API call in JavaScript
-> * Pass search options to the Bing News Search API
-> * Display news search results from four categories: any-type, business, health, or politics, from time-frames of 24 hours, the past week, month, or all available time
-> * Page through search results
-> * Handle the Bing client ID and API subscription key
-> * Handle errors that might occur
-
-The tutorial page is entirely self-contained; it does not use any external frameworks, style sheets, or image files. It uses only widely supported JavaScript language features and works with current versions of all major Web browsers.
--
-## Prerequisites
-
-To follow along with the tutorial, you need subscription keys for the Bing Search API. If you don't have these, you'll need to create them:
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-## App components
-Like any single-page Web app, this tutorial application includes three parts:
-
-> [!div class="checklist"]
-> * HTML - Defines the structure and content of the page
-> * CSS - Defines the appearance of the page
-> * JavaScript - Defines the behavior of the page
-
-Most of the HTML and CSS is conventional, so the tutorial doesn't discuss it. The HTML contains the search form in which the user enters a query and chooses search options. The form is connected to JavaScript that actually performs the search using the `onsubmit` attribute of the `<form>` tag:
-
-```html
-<form name="bing" onsubmit="return newBingNewsSearch(this)">
-```
-The `onsubmit` handler returns `false`, which keeps the form from being submitted to a server. The JavaScript code does the work of collecting the necessary information from the form and performing the search.
-
-The HTML also contains the divisions (HTML `<div>` tags) where the search results appear.
-
-## Managing subscription key
-
-To avoid having to include the Bing Search API subscription key in the code, we use the browser's persistent storage to store the key. Before the key is stored, we prompt for the user's key. If the key is later rejected by the API, we invalidate the stored key so the user will be prompted again.
-
-We define `storeValue` and `retrieveValue` functions that use either the `localStorage` object (not all browsers support it) or a cookie. The `getSubscriptionKey()` function uses these functions to store and retrieve the user's key. You can use the global endpoint below, or the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-``` javascript
-// Cookie names for data we store
-API_KEY_COOKIE = "bing-search-api-key";
-CLIENT_ID_COOKIE = "bing-search-client-id";
-
-// Bing Search API endpoint
-BING_ENDPOINT = "https://api.cognitive.microsoft.com/bing/v7.0/news";
-
-// ... omitted definitions of storeValue() and retrieveValue()
-// Browsers differ in their support for persistent storage by
-// local HTML files. See the source code for browser-specific
-// options.
-
-// Get stored API subscription key, or
-// prompt if it's not found.
-function getSubscriptionKey() {
- var key = retrieveValue(API_KEY_COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Search API subscription key:", "").trim();
- }
- // always set the cookie in order to update the expiration date
- storeValue(API_KEY_COOKIE, key);
- return key;
-}
-```
-The HTML `<form>` tag `onsubmit` calls the `bingWebSearch` function to return search results. `bingWebSearch` uses `getSubscriptionKey()` to authenticate each query. As shown in the previous definition, `getSubscriptionKey` prompts the user for the key if the key hasn't been entered. The key is then stored for continuing use by the application.
-
-```html
-<form name="bing" onsubmit="this.offset.value = 0; return bingWebSearch(this.query.value,
- bingSearchOptions(this), getSubscriptionKey())">
-```
-## Selecting search options
-The following figure shows the query text box and options that define a search for news about school funding.
-
-![Bing News Search options](media/news-search-categories.png)
-
-The HTML form includes elements with the following names:
-
-|Element|Description|
-|-|-|
-| `where` | A drop-down menu for selecting the market (location and language) used for the search. |
-| `query` | The text field to enter the search terms. |
-| `category` | Checkboxes for promoting particular kinds of results. Promoting Health, for example, increases the ranking of health news. |
-| `when` | Drop-down menu for optionally limiting the search to the most recent day, week, or month. |
-| `safe` | A checkbox indicating whether to use the Bing SafeSearch feature to filter out "adult" results. |
-| `count` | Hidden field. The number of search results to return on each request. Change to display fewer or more results per page. |
-| `offset`| Hidden field. The offset of the first search result in the request; used for paging. It's reset to `0` on a new request. |
-
-> [!NOTE]
-> Bing Web Search offers other query parameters. We're using only a few of them.
-
-``` javascript
-// build query options from the HTML form
-function bingSearchOptions(form) {
-
- var options = [];
- options.push("mkt=" + form.where.value);
- options.push("SafeSearch=" + (form.safe.checked ? "strict" : "off"));
- if (form.when.value.length) options.push("freshness=" + form.when.value);
-
- for (var i = 0; i < form.category.length; i++) {
- if (form.category[i].checked) {
- category = form.category[i].value;
- break;
- }
- }
- if (category.valueOf() != "all".valueOf()) {
- options.push("category=" + category);
- }
- options.push("count=" + form.count.value);
- options.push("offset=" + form.offset.value);
- return options.join("&");
-}
-```
-
-For example, the `SafeSearch` parameter in an actual API call can be `strict`, `moderate`, or `off`, with `moderate` being the default. Our form, however, uses a checkbox, which has only two states. The JavaScript code converts this setting to either `strict` or `off` (`moderate` is not used).
-
-## Performing the request
-Given the query, the options string, and the API key, the `BingNewsSearch` function uses an `XMLHttpRequest` object to make the request to the Bing News Search endpoint.
-
-```javascript
-// perform a search given query, options string, and API key
-function bingNewsSearch(query, options, key) {
-
- // scroll to top of window
- window.scrollTo(0, 0);
- if (!query.trim().length) return false; // empty query, do nothing
-
- showDiv("noresults", "Working. Please wait.");
- hideDivs("results", "related", "_json", "_http", "paging1", "paging2", "error");
-
- var request = new XMLHttpRequest();
- if (category.valueOf() != "all".valueOf()) {
- var queryurl = BING_ENDPOINT + "/search?" + "?q=" + encodeURIComponent(query) + "&" + options;
- }
- else
- {
- if (query){
- var queryurl = BING_ENDPOINT + "?q=" + encodeURIComponent(query) + "&" + options;
- }
- else {
- var queryurl = BING_ENDPOINT + "?" + options;
- }
- }
-
- // open the request
- try {
- request.open("GET", queryurl);
- }
- catch (e) {
- renderErrorMessage("Bad request (invalid URL)\n" + queryurl);
- return false;
- }
-
- // add request headers
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
- request.setRequestHeader("Accept", "application/json");
- var clientid = retrieveValue(CLIENT_ID_COOKIE);
- if (clientid) request.setRequestHeader("X-MSEdge-ClientID", clientid);
-
- // event handler for successful response
- request.addEventListener("load", handleBingResponse);
-
- // event handler for erorrs
- request.addEventListener("error", function() {
- renderErrorMessage("Error completing request");
- });
-
- // event handler for aborted request
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-
- // send the request
- request.send();
- return false;
-}
-```
-Upon successful completion of the HTTP request, JavaScript calls the `load` event handler, the `handleBingResponse()` function, to handle a successful HTTP GET request to the API.
-
-```javascript
-// handle Bing search request results
-function handleBingResponse() {
- hideDivs("noresults");
-
- var json = this.responseText.trim();
- var jsobj = {};
-
- // try to parse JSON results
- try {
- if (json.length) jsobj = JSON.parse(json);
- } catch(e) {
- renderErrorMessage("Invalid JSON response");
- }
-
- // show raw JSON and HTTP request
- showDiv("json", preFormat(JSON.stringify(jsobj, null, 2)));
- showDiv("http", preFormat("GET " + this.responseURL + "\n\nStatus: " + this.status + " " +
- this.statusText + "\n" + this.getAllResponseHeaders()));
-
- // if HTTP response is 200 OK, try to render search results
- if (this.status === 200) {
- var clientid = this.getResponseHeader("X-MSEdge-ClientID");
- if (clientid) retrieveValue(CLIENT_ID_COOKIE, clientid);
- if (json.length) {
- if (jsobj._type === "News") {
- renderSearchResults(jsobj);
- } else {
- renderErrorMessage("No search results in JSON response");
- }
- } else {
- renderErrorMessage("Empty response (are you sending too many requests too quickly?)");
- }
- }
-
- // Any other HTTP response is an error
- else {
- // 401 is unauthorized; force re-prompt for API key for next request
- if (this.status === 401) invalidateSubscriptionKey();
-
- // some error responses don't have a top-level errors object, so gin one up
- var errors = jsobj.errors || [jsobj];
- var errmsg = [];
-
- // display HTTP status code
- errmsg.push("HTTP Status " + this.status + " " + this.statusText + "\n");
-
- // add all fields from all error responses
- for (var i = 0; i < errors.length; i++) {
- if (i) errmsg.push("\n");
- for (var k in errors[i]) errmsg.push(k + ": " + errors[i][k]);
- }
-
- // also display Bing Trace ID if it isn't blocked by CORS
- var traceid = this.getResponseHeader("BingAPIs-TraceId");
- if (traceid) errmsg.push("\nTrace ID " + traceid);
-
- // and display the error message
- renderErrorMessage(errmsg.join("\n"));
- }
-}
-```
-
-> [!IMPORTANT]
-> A successful HTTP request does *not* necessarily mean that the search itself succeeded. If an error occurs in the search operation, the Bing News Search API returns a non-200 HTTP status code and includes error information in the JSON response. Additionally, if the request was rate-limited, the API returns an empty response.
-
-Much of the code in both of the preceding functions is dedicated to error handling. Errors may occur at the following stages:
-
-|Stage|Potential error(s)|Handled by|
-|-|-|-|
-|Building the JavaScript request object|Invalid URL|`try`/`catch` block|
-|Making the request|Network errors, aborted connections|`error` and `abort` event handlers|
-|Performing the search|Invalid request, invalid JSON, rate limits|tests in `load` event handler|
-
-Errors are handled by calling `renderErrorMessage()` with any details known about the error. If the response passes the full gauntlet of error tests, we call `renderSearchResults()` to display the search results in the page.
-
-## Displaying search results
-The main function for displaying the search results is `renderSearchResults()`. This function takes the JSON returned by the Bing News Search service and renders the news results and the related searches, if any.
-
-```javascript
-// render the search results given the parsed JSON response
- function renderSearchResults(results) {
-
- // add Prev / Next links with result count
- var pagingLinks = renderPagingLinks(results);
- showDiv("paging1", pagingLinks);
- showDiv("paging2", pagingLinks);
-
- showDiv("results", renderResults(results.value));
- if (results.relatedSearches)
- showDiv("sidebar", renderRelatedItems(results.relatedSearches));
-}
-```
-The main search results are returned as the top-level `value` object in the JSON response. We pass them to our function `renderResults()`, which iterates through them and calls a separate function to render each item into HTML. The resulting HTML is returned to `renderSearchResults()`, where it is inserted into the `results` division in the page.
-
-```javascript
-function renderResults(items) {
- var len = items.length;
- var html = [];
- if (!len) {
- showDiv("noresults", "No results.");
- hideDivs("paging1", "paging2");
- return "";
- }
- for (var i = 0; i < len; i++) {
- html.push(searchItemRenderers.news(items[i], i, len));
- }
- return html.join("\n\n");
-}
-```
-The Bing News Search API returns up to four different kinds of related results, each in its own top-level object. They are:
-
-|Relation|Description|
-|-|-|
-|`pivotSuggestions`|Queries that replace a pivot word in original search with a different one. For example, if you search for "red flowers," a pivot word might be "red," and a pivot suggestion might be "yellow flowers."|
-|`queryExpansions`|Queries that narrow the original search by adding more terms. For example, if you search for "Microsoft Surface," a query expansion might be "Microsoft Surface Pro."|
-|`relatedSearches`|Queries that have also been entered by other users who entered the original search. For example, if you search for "Mount Rainier," a related search might be "Mt. Saint Helens."|
-|`similarTerms`|Queries that are similar in meaning to the original search. For example, if you search for "schools," a similar term might be "education."|
-
-As previously seen in `renderSearchResults()`, we render only the `relatedItems` suggestions and place the resulting links in the page's sidebar.
-
-## Rendering result items
-
-In the JavaScript code the object, `searchItemRenderers`, contains *renderers:* functions that generate HTML for each kind of search result.
-
-```javascript
-searchItemRenderers = {
- news: function(item) { ... },
- webPages: function (item) { ... },
- images: function(item, index, count) { ... },
- relatedSearches: function(item) { ... }
-}
-```
-A renderer function can accept the following parameters:
-
-|Parameter|Description|
-|-|-|
-|`item`| The JavaScript object containing the item's properties, such as its URL and its description.|
-|`index`| The index of the result item within its collection.|
-|`count`| The number of items in the search result item's collection.|
-
-The `index` and `count` parameters can be used to number results, to generate special HTML for the beginning or end of a collection, to insert line breaks after a certain number of items, and so on. If a renderer does not need this functionality, it does not need to accept these two parameters.
-
-The `news` renderer is shown in the following JavaScript excerpt:
-```javascript
- // render news story
- news: function (item) {
- var html = [];
- html.push("<p class='news'>");
- if (item.image) {
- width = 60;
- height = Math.round(width * item.image.thumbnail.height / item.image.thumbnail.width);
- html.push("<img src='" + item.image.thumbnail.contentUrl +
- "&h=" + height + "&w=" + width + "' width=" + width + " height=" + height + ">");
- }
- html.push("<a href='" + item.url + "'>" + item.name + "</a>");
- if (item.category) html.push(" - " + item.category);
- if (item.contractualRules) { // MUST display source attributions
- html.push(" (");
- var rules = [];
- for (var i = 0; i < item.contractualRules.length; i++)
- rules.push(item.contractualRules[i].text);
- html.push(rules.join(", "));
- html.push(")");
- }
- html.push(" (" + getHost(item.url) + ")");
- html.push("<br>" + item.description);
- return html.join("");
- },
-```
-The news renderer function:
-> [!div class="checklist"]
-> * Creates a paragraph tag, assigns it to the `news` class, and pushes it to the html array.
-> * Calculates image thumbnail size (width is fixed at 60 pixels, height calculated proportionately).
-> * Builds the HTML `<img>` tag to display the image thumbnail.
-> * Builds the HTML `<a>` tags that link to the image and the page that contains it.
-> * Builds the description that displays information about the image and the site it's on.
-
-The thumbnail size is used in both the `<img>` tag and the `h` and `w` fields in the thumbnail's URL. The [Bing thumbnail service](../bing-web-search/resize-and-crop-thumbnails.md) then delivers a thumbnail of exactly that size.
-
-## Persisting client ID
-Responses from the Bing search APIs may include an `X-MSEdge-ClientID` header that should be sent back to the API with successive requests. If multiple Bing Search APIs are being used, the same client ID should be used with all of them, if possible.
-
-Providing the `X-MSEdge-ClientID` header allows the Bing APIs to associate all of a user's searches, which has two important benefits.
-
-First, it allows the Bing search engine to apply past context to searches to find results that better satisfy the user. If a user has previously searched for terms related to sailing, for example, a later search for "knots" might preferentially return information about knots used in sailing.
-
-Second, Bing may randomly select users to experience new features before they are made widely available. Providing the same client ID with each request ensures that users who see the feature always see it. Without the client ID, the user might see a feature appear and disappear, seemingly at random, in their search results.
-
-Browser security policies (CORS) may prevent the `X-MSEdge-ClientID` header from being available to JavaScript. This limitation occurs when the search response has a different origin from the page that requested it. In a production environment, you should address this policy by hosting a server-side script that does the API call on the same domain as the Web page. Since the script has the same origin as the Web page, the `X-MSEdge-ClientID` header is then available to JavaScript.
-
-> [!NOTE]
-> In a production Web application, you should perform the request server-side. Otherwise, your Bing Search API key must be included in the Web page, where it is available to anyone who views source. You are billed for all usage under your API subscription key, even requests made by unauthorized parties, so it is important not to expose your key.
-
-For development purposes, you can make the Bing Web Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that allows response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our tutorial app to access the client ID header. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then issue the following command in a command window:
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Next steps
-> [!div class="nextstepaction"]
-> [Bing News Search API reference](/rest/api/cognitiveservices/bing-news-api-v7-reference)
cognitive-services Bing Spell Check Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/bing-spell-check-upgrade-guide-v5-to-v7.md
- Title: Upgrade Bing Spell Check API v5 to v7-
-description: Identifies the parts of your Bing Spell Check application that you need to update to use version 7.
------- Previously updated : 02/20/2019---
-# Spell Check API upgrade guide
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing Spell Check API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number changed from v5 to v7. For example, `https://api.cognitive.microsoft.com/bing/v7.0/spellcheck`.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
-
--- Replaced the v5 error codes with the following possible `code` and `subCode` values.
-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the subcode conditions occur. The response includes these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request isn't valid. For example, a required parameter is missing or a parameter value isn't valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing can't authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key isn't valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller doesn't have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.
-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Use and display requirements](../bing-web-search/use-display-requirements.md)
cognitive-services Sending Requests https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/concepts/sending-requests.md
- Title: Sending requests to the Bing Spell Check API-
-description: Learn about the Bing Spell Check modes, settings, and other information relating to the API.
------- Previously updated : 06/27/2019---
-# Sending requests to the Bing Spell Check API
--
-To check a text string for spelling and grammar errors, you'd send a GET request to the following endpoint:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/spellcheck
-```
-
-The request must use the HTTPS protocol.
-
-We recommend that all requests originate from a server. Distributing the key as part of a client application provides more opportunity for a malicious third-party to access it. A server also provides a single upgrade point for future versions of the API.
-
-The request must specify the [text](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#text) query parameter, which contains the text string to proof. Although optional, the request should also specify the [mkt](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters such as `mode`, see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#query-parameters). All query parameter values must be URL encoded.
-
-The request must specify the [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#subscriptionkey) header. Although optional, you are encouraged to also specify the following headers. These headers help the Bing Spell Check API return more accurate results:
-
-- [User-Agent](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#useragent) -- [X-MSEdge-ClientID](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#clientid) -- [X-Search-ClientIP](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#clientip) -- [X-Search-Location](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#location) -
-For a list of all request and response headers, see [Headers](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v5-reference#headers).
-
-When calling the Bing Spell Check API using JavaScript, your browser's built-in security features might prevent you from accessing the values of these headers.
-
-To resolve this issue, you can make the Bing Spell Check API request through a CORS proxy. The response from such a proxy has a `Access-Control-Expose-Headers` header that filters response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow the [tutorial app](../tutorials/spellcheck.md) to access the optional client headers. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then enter the following command at a command prompt.
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Spell Check API endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/spellcheck/`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it's the same for each request.
-
-## Example API request
-
-The following shows a request that includes all the suggested query parameters and headers. If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/spellcheck?text=when+its+your+turn+turn,+john,+come+runing&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following shows the response to the previous request. The example also shows the Bing-specific response headers.
--
-```json
-BingAPIs-TraceId: 76DD2C2549B94F9FB55B4BD6FEB6AC
-X-MSEdge-ClientID: 1C3352B306E669780D58D607B96869
-BingAPIs-Market: en-US
-
-{
- "_type" : "SpellCheck",
- "flaggedTokens" : [{
- "offset" : 5,
- "token" : "its",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "it's",
- "score" : 1
- }]
- },
- {
- "offset" : 25,
- "token" : "john",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "John",
- "score" : 1
- }]
- },
- {
- "offset" : 19,
- "token" : "turn",
- "type" : "RepeatedToken",
- "suggestions" : [{
- "suggestion" : "",
- "score" : 1
- }]
- },
- {
- "offset" : 35,
- "token" : "runing",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "running",
- "score" : 1
- }]
- }]
-}
-```
-
-## Next steps
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 Reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Using Spell Check https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/concepts/using-spell-check.md
- Title: Using the Bing Spell Check API-
-description: Learn about the Bing Spell Check modes, settings, and other information related to the API.
------- Previously updated : 02/20/2019---
-# Using the Bing Spell Check API
--
-Use this article to learn about using the Bing Spell Check API to perform contextual grammar and spell checking. While most spell-checkers rely on dictionary-based rule sets, the Bing spell-checker leverages machine learning and statistical machine translation to provide accurate and contextual corrections.
-
-## Spell check modes
-
-The API supports two proofing modes, `Proof` and `Spell`. Try examples [here](https://azure.microsoft.com/services/cognitive-services/spell-check/).
-
-### Proof - for documents
-
-The default mode is `Proof`. The `Proof` spelling mode provides the most comprehensive checks, adding capitalization, basic punctuation, and other features to aid document creation. but it is available only in the en-US (English-United States), es-ES(Spanish), pt-BR(Portuguese) markets (Note: only in beta version for Spanish and Portuguese). For all other markets, set the mode query parameter to Spell.
-
-> [!NOTE]
-> If the length of query text exceeds 4096, it will be truncated to 4096 characters, then get processed.
-
-### Spell - for web searches/queries
-
-`Spell` is more aggressive in order to return better search results. The `Spell` mode finds most spelling mistakes but doesn't find some of the grammar errors that `Proof` catches, for example, capitalization and repeated words.
-
-> [!NOTE]
-> * The maximum supported query length is below. If the query exceeds the max length, the query and its results will not be altered.
-> * 130 characters for the following language codes: en, de, es, fr, pl, pt, sv, ru, nl, nb, tr-tr, it, zh, ko.
-> * 65 characters for all others.
-> * The Spell mode does not support square bracket characters (`[` and `]`) in queries, and may cause inconsistent results. We recommend removing them from your queries when using the Spell mode.
-
-## Market setting
-
-A [market code](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#market-codes) should be specified with the `mkt` query parameter in your request. The API will otherwise use a default market based on the request's IP address.
--
-## HTTP POST and GET support
-
-The API supports either HTTP POST or HTTP GET. Which you use depends on the length of text you plan to proof. If the strings are always less than 1,500 characters, you'd use a GET. But if you want to support strings up to 10,000 characters, you'd use POST. The text string may include any valid UTF-8 character.
-
-The following example shows a POST request to check the spelling and grammar of a text string. The example includes the [mode](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#mode) query parameter for completeness (it could have been left out since `mode` defaults to Proof). The [text](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#text) query parameter contains the string to be proofed.
-
-```
-POST https://api.cognitive.microsoft.com/bing/v7.0/spellcheck?mode=proof&mkt=en-us HTTP/1.1
-Content-Type: application/x-www-form-urlencoded
-Content-Length: 47
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-
-text=when+its+your+turn+turn,+john,+come+runing
-```
-
-If you use HTTP GET, you'd include the `text` query parameter in the URL's query string
-
-The following shows the response to the previous request. The response contains a [SpellCheck](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#spellcheck) object.
-
-```json
-{
- "_type" : "SpellCheck",
- "flaggedTokens" : [{
- "offset" : 5,
- "token" : "its",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "it's",
- "score" : 1
- }]
- },
- {
- "offset" : 25,
- "token" : "john",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "John",
- "score" : 1
- }]
- },
- {
- "offset" : 19,
- "token" : "turn",
- "type" : "RepeatedToken",
- "suggestions" : [{
- "suggestion" : "",
- "score" : 1
- }]
- },
- {
- "offset" : 35,
- "token" : "runing",
- "type" : "UnknownToken",
- "suggestions" : [{
- "suggestion" : "running",
- "score" : 1
- }]
- }]
-}
-```
-
-The [flaggedTokens](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#flaggedtokens) field lists the spelling and grammar errors that the API found in the [text](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference#text) string. The `token` field contains the word to be replaced. You'd use the zero-based offset in the `offset` field to find the token in the `text` string. You'd then replace the word at that location with the word in the `suggestion` field.
-
-If the `type` field is RepeatedToken, you'd still replace the token with `suggestion` but you'd also likely need to remove the trailing space.
-
-## Throttling requests
--
-## Next steps
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 Reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/language-support.md
- Title: Language support - Bing Spell Check API-
-description: A list of natural languages supported by the Bing Spell Check API.
------- Previously updated : 02/20/2019---
-# Language and region support for Bing Spell Check API
--
-These languages are supported by the Bing Spell Check API (only in `spell` mode).
-
-Please note that to work with any other language than `en-US`, the `mkt` should be set and either `Accept-Language` or `setLang` should be set as it has been described in [Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
-
-| Language | Language code |
-|:-- |:-:|
-| Arabic | `ar` |
-| Chinese (People's Republic of China) | `zh-CN` |
-| Chinese (Hong Kong SAR) | `zh-HK` |
-| Chinese (Taiwan) | `zh-TW` |
-| Danish | `da` |
-| Dutch (Belgium) | `nl-BE` |
-| Dutch (Netherlands) | `nl-NL` |
-| English (Australia) | `en-AU` |
-| English (Canada) | `en-CA` |
-| English (India) | `en-IN` |
-| English (Indonesia) | `en-ID` |
-| English (Malaysia) | `en-MY` |
-| English (New Zealand) | `en-NZ` |
-| English (Philippines) | `en-PH` |
-| English (South Africa) | `en-ZA` |
-| English (United Kingdom) | `en-GB` |
-| English (United States) | `en-US` |
-| Finnish | `fi` |
-| French (Belgium) | `fr-BE` |
-| French (Canada) | `fr-CA` |
-| French (France) | `fr-FR` |
-| French (Switzerland) | `fr-CH` |
-| German (Austria) | `de-AT` |
-| German (Germany) | `de-DE` |
-| German (Switzerland) | `de-CH` |
-| Italian | `it` |
-| Japanese | `ja` |
-| Korean | `ko` |
-| Norwegian | `no` |
-| Polish | `pl` |
-| Portuguese (Brazil) | `pt-BR`|
-| Portuguese (Portugal) | `pt-PT`|
-| Russian | `ru` |
-| Spanish (Argentina) | `es-AR` |
-| Spanish (Chile) | `es-CL` |
-| Spanish (Mexico) | `es-MX` |
-| Spanish (Spain) | `es-ES` |
-| Spanish (United States) | `es-US` |
-| Swedish | `sv` |
-| Turkish | `tr` |
-
-## See also
--- [Azure AI services documentation](../../ai-services/index.yml)-- [Azure AI services product information](https://azure.microsoft.com/services/cognitive-services/)
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/overview.md
- Title: What is the Bing Spell Check API?-
-description: Learn about the Bing Spell Check API, which uses machine learning and statistical machine translation for contextual spell checking.
------ Previously updated : 12/19/2019---
-# What is the Bing Spell Check API?
--
-The Bing Spell Check API enables you to perform contextual grammar and spell checking on text. While most spell-checkers rely on dictionary-based rule sets, the Bing spell-checker leverages machine learning and statistical machine translation to provide accurate and contextual corrections.
-
-## Features
-
-| Feature | Description |
-|||
-|Multiple spell check modes | Multiple spell check modes enable you to get corrections focused on grammar and/or spelling. |
-|Slang and informal language recognition | Recognize common expressions and informal terms used in text. |
-|Differentiate between similar words | Find the correct usage between words that sound similar but differ in meaning (for example, "see" and "sea") |
-|Brand, title, and popular usage support | Recognize new brands, titles, and other popular expressions as they emerge |
-
-## Workflow
-
-The Bing Spell Check API is easy to call from any programming language that can make HTTP requests and parse JSON responses. The service is accessible using the REST API or the Bing Spell Check SDKs.
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can create a free account.
-2. Send a request to the Bing Web Search API.
-3. Parse the JSON response
-
-## Next steps
-
-First, try the Bing Spell Check Search API [interactive demo](https://azure.microsoft.com/services/cognitive-services/spell-check/) to see how you can quickly check a variety of texts.
-
-When you are ready to call the API, create an [Azure AI services resource](../../ai-services/multi-service-resource.md?pivots=azportal). If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-
-You can also visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/csharp.md
- Title: "Quickstart: Check spelling with the REST API and C# - Bing Spell Check"-
-description: "Get started using the Bing Spell Check REST API and C# to check spelling and grammar."
------ Previously updated : 05/21/2020----
-# Quickstart: Check spelling with the Bing Spell Check REST API and C#
--
-Use this quickstart to make your first call to the Bing Spell Check REST API. This simple C# application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
-* The Newtonsoft.Json NuGet package.
-
- To install this package in Visual studio:
-
- 1. In **Solution Explorer**, right-click the Solution file.
- 1. Select **Manage NuGet Packages for Solution**.
- 1. Search for *Newtonsoft.Json* and install the package.
-
-* If you're using Linux/MacOS, you can run this application by using [Mono](https://www.mono-project.com/).
--
-## Create and initialize a project
-
-1. Create a new console solution named SpellCheckSample in Visual Studio. Then, add the following namespaces into the main code file:
-
- ```csharp
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Net.Http.Headers;
- using System.Text;
- using Newtonsoft.Json;
- ```
-
-2. Create variables for the API endpoint, your subscription key, and the text to be spell checked. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- namespace SpellCheckSample
- {
- class Program
- {
- static string host = "https://api.cognitive.microsoft.com";
- static string path = "/bing/v7.0/spellcheck?";
- static string key = "<ENTER-KEY-HERE>";
- //text to be spell-checked
- static string text = "Hollo, wrld!";
- }
- }
- ```
-
-3. Create a string for your search parameters:
-
- 1. Assign your market code to the `mkt` parameter with the `=` operator. The market code is the code of the country/region you make the request from.
-
- 1. Add the `mode` parameter with the `&` operator, and then assign the spell-check mode. The mode can be either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling errors, but not as many grammar errors).
-
- ```csharp
- static string params_ = "mkt=en-US&mode=proof";
- ```
-
-## Create and send a spell check request
-
-1. Create an asynchronous function called `SpellCheck()` to send a request to the API. Create a `HttpClient`, and add your subscription key to the `Ocp-Apim-Subscription-Key` header. Within the function, follow the next steps.
-
- ```csharp
- async static void SpellCheck()
- {
- var client = new HttpClient();
- client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", key);
-
- HttpResponseMessage response = null;
- // add the rest of the code snippets here (except for main())...
- }
- ```
-
-2. Create the URI for your request by appending your host, path, and parameters.
-
- ```csharp
- string uri = host + path + params_;
- ```
-
-3. Create a list with a `KeyValuePair` object containing your text, and use it to create a `FormUrlEncodedContent` object. Set the header information, and use `PostAsync()` to send the request.
-
- ```csharp
- var values = new Dictionary<string, string>();
- values.Add("text", text);
- var content = new FormUrlEncodedContent(values);
- content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
- response = await client.PostAsync(uri, new FormUrlEncodedContent(values));
- ```
-
-## Get and print the API response
-
-### Get the client ID header
-
-If the response contains an `X-MSEdge-ClientID` header, get the value and print it.
-
-``` csharp
-string client_id;
-if (response.Headers.TryGetValues("X-MSEdge-ClientID", out IEnumerable<string> header_values))
-{
- client_id = header_values.First();
- Console.WriteLine("Client ID: " + client_id);
-}
-```
-
-### Get the response
-
-Get the response from the API. Deserialize the JSON object, and print it to the console.
-
-```csharp
-string contentString = await response.Content.ReadAsStringAsync();
-
-dynamic jsonObj = JsonConvert.DeserializeObject(contentString);
-Console.WriteLine(jsonObj);
-```
-
-## Call the spell check function
-
-In the `Main()` function of your project, call `SpellCheck()`.
-
-```csharp
-static void Main(string[] args)
-{
- SpellCheck();
- Console.ReadLine();
-}
-```
-
-## Run the application
-
-Build and run your project. If you're using Visual Studio, press **F5** to debug the file.
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/java.md
- Title: "Quickstart: Check spelling with the REST API and Java - Bing Spell Check"-
-description: Get started using the Bing Spell Check REST API and Java to check spelling and grammar.
------ Previously updated : 05/21/2020----
-# Quickstart: Check spelling with the Bing Spell Check REST API and Java
--
-Use this quickstart to make your first call to the Bing Spell Check REST API. This simple Java application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in Java, the API is a RESTful web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingSpellCheck.java).
-
-## Prerequisites
-
-* The Java Development Kit(JDK) 7 or later.
-
-* Import the [gson-2.8.5.jar](https://libraries.io/maven/com.google.code.gson%3Agson) or the most current [Gson](https://github.com/google/gson) version. For command-line execution, add the `.jar` to your Java folder with the main class.
--
-## Create and initialize an application
-
-1. Create a new Java Project in your favorite IDE or editor with a class name of your choosing, and then import the following packages:
-
- ```java
- import java.io.*;
- import java.net.*;
- import com.google.gson.*;
- import javax.net.ssl.HttpsURLConnection;
- ```
-
-2. Create variables for the API endpoint's host, path, and your subscription key. Then, create variables for your market, the text you want to spell check, and a string for the spell check mode. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/spellcheck";
-
- static String key = "<ENTER-KEY-HERE>";
-
- static String mkt = "en-US";
- static String mode = "proof";
- static String text = "Hollo, wrld!";
- ```
-
-## Create and send an API request
-
-1. Create a function called `check()` to create and send the API request. Within this function, add the code specified in the next steps. Create a string for the request parameters:
-
- 1. Assign your market code to the `mkt` parameter with the `=` operator.
-
- 1. Add the `mode` parameter with the `&` operator, and then assign the spell-check mode.
-
- ```java
- public static void check () throws Exception {
- String params = "?mkt=" + mkt + "&mode=" + mode;
- // add the rest of the code snippets here (except prettify() and main())...
- }
- ```
-
-2. Create a URL by combining the endpoint host, path, and parameters string. Create a new `HttpsURLConnection` object.
-
- ```java
- URL url = new URL(host + path + params);
- HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
- ```
-
-3. Open a connection to the URL. Set the request method to `POST` and add your request parameters. Be sure to add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```java
- connection.setRequestMethod("POST");
- connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", key);
- connection.setDoOutput(true);
- ```
-
-4. Create a new `DataOutputStream` object and send the request to the API.
-
- ```java
- DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
- wr.writeBytes("text=" + text);
- wr.flush();
- wr.close();
- ```
-
-## Format and read the API response
-
-1. Add the `prettify()` method to your class, which formats the JSON for a more readable output.
-
- ``` java
- // This function prettifies the json response.
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonElement json = parser.parse(json_text);
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
- ```
-
-1. Create a `BufferedReader` and read the response from the API. Print it to the console.
-
- ```java
- BufferedReader in = new BufferedReader(
- new InputStreamReader(connection.getInputStream()));
- String line;
- while ((line = in.readLine()) != null) {
- System.out.println(prettify(line));
- }
- in.close();
- ```
-
-## Call the API
-
-In the main function of your application, call your `check()` method created previously.
-```java
-public static void main(String[] args) {
- try {
- check();
- }
- catch (Exception e) {
- System.out.println (e);
- }
-}
-```
-
-## Run the application
-
-Build and run your project. If you're using the command line, use the following commands to build and run the application:
-
-1. Build the application:
-
- ```bash
- javac -classpath .;gson-2.2.2.jar\* <CLASS_NAME>.java
- ```
-
-2. Run the application:
-
- ```bash
- java -cp .;gson-2.2.2.jar\* <CLASS_NAME>
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/nodejs.md
- Title: "Quickstart: Check spelling with the REST API and Node.js - Bing Spell Check"-
-description: Get started using the Bing Spell Check REST API and Node.js to check spelling and grammar.
------ Previously updated : 05/21/2020----
-# Quickstart: Check spelling with the Bing Spell Check REST API and Node.js
--
-Use this quickstart to make your first call to the Bing Spell Check REST API. This simple JavaScript application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingSpellCheckv7.js).
-
-## Prerequisites
-
-* [Node.js 6](https://nodejs.org/en/download/) or later.
---
-## Create and initialize a project
-
-1. Create a new JavaScript file in your favorite IDE or editor. Set the strictness, and require `https`. Then, create variables for your API endpoint's host, path, and your subscription key. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- 'use strict';
- let https = require ('https');
-
- let host = 'api.cognitive.microsoft.com';
- let path = '/bing/v7.0/spellcheck';
- let key = '<ENTER-KEY-HERE>';
- ```
-
-2. Create variables for your search parameters and the text you want to check:
-
- 1. Assign your market code to the `mkt` parameter with the `=` operator. The market code is the code of the country/region you make the request from.
-
- 1. Add the `mode` parameter with the `&` operator, and then assign the spell-check mode. The mode can be either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling errors, but not as many grammar errors).
-
- ```javascript
- let mkt = "en-US";
- let mode = "proof";
- let text = "Hollo, wrld!";
- let query_string = "?mkt=" + mkt + "&mode=" + mode;
- ```
-
-## Create the request parameters
-
-Create your request parameters by creating a new object with a `POST` method. Add your path by appending your endpoint path, and query string. Then, add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
-```javascript
-let request_params = {
- method : 'POST',
- hostname : host,
- path : path + query_string,
- headers : {
- 'Content-Type' : 'application/x-www-form-urlencoded',
- 'Content-Length' : text.length + 5,
- 'Ocp-Apim-Subscription-Key' : key,
- }
-};
-```
-
-## Create a response handler
-
-Create a function called `response_handler` to take the JSON response from the API, and print it. Create a variable for the response body. Append the response when a `data` flag is received by using `response.on()`. After an `end` flag is received, print the JSON body to the console.
-
-```javascript
-let response_handler = function (response) {
- let body = '';
- response.on ('data', function (d) {
- body += d;
- });
- response.on ('end', function () {
- let body_ = JSON.parse (body);
- console.log (body_);
- });
- response.on ('error', function (e) {
- console.log ('Error: ' + e.message);
- });
-};
-```
-
-## Send the request
-
-Call the API using `https.request()` with your request parameters and response handler. Write your text to the API, and then end the request.
-
-```javascript
-let req = https.request (request_params, response_handler);
-req.write ("text=" + text);
-req.end ();
-```
--
-## Run the application
-
-1. Build and run your project.
-
-1. If you're using the command line, use the following command to build and run the application:
-
- ```bash
- node <FILE_NAME>.js
- ```
--
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/php.md
- Title: "Quickstart: Check spelling with the REST API and PHP - Bing Spell Check"-
-description: This quickstart shows how a simple PHP application sends a request to the Bing Spell Check API and returns a list of suggested corrections.
------ Previously updated : 05/21/2020---
-# Quickstart: Check spelling with the Bing Spell Check REST API and PHP
--
-Use this quickstart to make your first call to the Bing Spell Check REST API. This simple PHP application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [PHP 5.6.x](https://php.net/downloads.php)
---
-## Get Bing Spell Check REST API results
-
-1. Create a new PHP project in your favorite IDE.
-2. Add the code provided below.
-3. Replace the `subscriptionKey` value with an access key valid for your subscription.
-4. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-5. Run the program.
-
- ```php
- <?php
-
- // NOTE: Be sure to uncomment the following line in your php.ini file.
- // ;extension=php_openssl.dll
-
- // These properties are used for optional headers (see below).
- // define("CLIENT_ID", "<Client ID from Previous Response Goes Here>");
- // define("CLIENT_IP", "999.999.999.999");
- // define("CLIENT_LOCATION", "+90.0000000000000;long: 00.0000000000000;re:100.000000000000");
-
- $host = 'https://api.cognitive.microsoft.com';
- $path = '/bing/v7.0/spellcheck?';
- $params = 'mkt=en-us&mode=proof';
-
- $input = "Hollo, wrld!";
-
- $data = array (
- 'text' => urlencode ($input)
- );
-
- // NOTE: Replace this example key with a valid subscription key.
- $key = 'ENTER KEY HERE';
-
- // The following headers are optional, but it is recommended
- // that they are treated as required. These headers will assist the service
- // with returning more accurate results.
- //'X-Search-Location' => CLIENT_LOCATION
- //'X-MSEdge-ClientID' => CLIENT_ID
- //'X-MSEdge-ClientIP' => CLIENT_IP
-
- $headers = "Content-type: application/x-www-form-urlencoded\r\n" .
- "Ocp-Apim-Subscription-Key: $key\r\n";
-
- // NOTE: Use the key 'http' even if you are making an HTTPS request. See:
- // https://php.net/manual/en/function.stream-context-create.php
- $options = array (
- 'http' => array (
- 'header' => $headers,
- 'method' => 'POST',
- 'content' => http_build_query ($data)
- )
- );
- $context = stream_context_create ($options);
- $result = file_get_contents ($host . $path . $params, false, $context);
-
- if ($result === FALSE) {
- /* Handle error */
- }
-
- $json = json_encode(json_decode($result), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
- echo $json;
- ?>
- ```
--
-## Run the application
-
-Run your application by starting a web server and navigating to your file.
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/python.md
- Title: "Quickstart: Check spelling with the REST API and Python - Bing Spell Check"-
-description: Get started using the Bing Spell Check REST API and Python to check spelling and grammar.
------ Previously updated : 05/21/2020---
-# Quickstart: Check spelling with the Bing Spell Check REST API and Python
--
-Use this quickstart to make your first call to the Bing Spell Check REST API. This simple Python application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingEntitySearchv7.py)
-
-## Prerequisites
-
-* Python [3.x](https://www.python.org)
--
-## Initialize the application
-
-1. Create a new Python file in your favorite IDE or editor, and add the following import statements:
-
- ```python
- import requests
- import json
- ```
-
-2. Create variables for the text you want to spell check, your subscription key, and your Bing Spell Check endpoint. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- api_key = "<ENTER-KEY-HERE>"
- example_text = "Hollo, wrld" # the text to be spell-checked
- endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/SpellCheck"
- ```
-
-## Create the parameters for the request
-
-1. Create a new dictionary with `text` as the key, and your text as the value.
-
- ```python
- data = {'text': example_text}
- ```
-
-2. Add the parameters for your request:
-
- 1. Assign your market code to the `mkt` parameter with the `=` operator. The market code is the code of the country/region you make the request from.
-
- 1. Add the `mode` parameter with the `&` operator, and then assign the spell-check mode. The mode can be either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling errors, but not as many grammar errors).
-
- ```python
- params = {
- 'mkt':'en-us',
- 'mode':'proof'
- }
- ```
-
-3. Add a `Content-Type` header and your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```python
- headers = {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Ocp-Apim-Subscription-Key': api_key,
- }
- ```
-
-## Send the request and read the response
-
-1. Send the POST request by using the requests library.
-
- ```python
- response = requests.post(endpoint, headers=headers, params=params, data=data)
- ```
-
-2. Get the JSON response and print it.
-
- ```python
- json_response = response.json()
- print(json.dumps(json_response, indent=4))
- ```
--
-## Run the application
-
-If you're using the command line, use the following command to run the application:
-
-```bash
-python <FILE_NAME>.py
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/quickstarts/ruby.md
- Title: "Quickstart: Check spelling with the REST API and Ruby - Bing Spell Check"-
-description: Get started using the Bing Spell Check REST API and Ruby to check spelling and grammar.
------ Previously updated : 05/21/2020---
-# Quickstart: Check spelling with the Bing Spell Check REST API and Ruby
--
-Use this quickstart to make your first call to the Bing Spell Check REST API using Ruby. This simple application sends a request to the API and returns a list of suggested corrections.
-
-Although this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/ruby/Search/BingSpellCheckv7.rb)
-
-## Prerequisites
-
-* [Ruby 2.4](https://www.ruby-lang.org/en/downloads/) or later.
---
-## Create and initialize the application
-
-1. Create a new Ruby file in your favorite editor or IDE, and add the following requirements:
-
- ```ruby
- require 'net/http'
- require 'uri'
- require 'json'
- ```
-
-2. Create variables for your subscription key, endpoint URI, and path. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource. Create your request parameters:
-
- 1. Assign your market code to the `mkt` parameter with the `=` operator. The market code is the code of the country/region you make the request from.
-
- 1. Add the `mode` parameter with the `&` operator, and then assign the spell-check mode. The mode can be either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling errors, but not as many grammar errors).
-
- ```ruby
- key = 'ENTER YOUR KEY HERE'
- uri = 'https://api.cognitive.microsoft.com'
- path = '/bing/v7.0/spellcheck?'
- params = 'mkt=en-us&mode=proof'
- ```
-
-## Send a spell check request
-
-1. Create a URI from your host uri, path, and parameters string. Set its query to contain the text you want to spell check.
-
- ```ruby
- uri = URI(uri + path + params)
- uri.query = URI.encode_www_form({
- # Request parameters
- 'text' => 'Hollo, wrld!'
- })
- ```
-
-2. Create a request using the URI constructed previously. Add your key to the `Ocp-Apim-Subscription-Key` header.
-
- ```ruby
- request = Net::HTTP::Post.new(uri)
- request['Content-Type'] = "application/x-www-form-urlencoded"
- request['Ocp-Apim-Subscription-Key'] = key
- ```
-
-3. Send the request.
-
- ```ruby
- response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
- end
- ```
-
-4. Get the JSON response, and print it to the console.
-
- ```ruby
- result = JSON.pretty_generate(JSON.parse(response.body))
- puts result
- ```
-
-## Run the application
-
-Build and run your project. If you're using the command line, use the following command to run the application:
-
- ```bash
- ruby <FILE_NAME>.rb
- ```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.9115257530801
- },
- {
- "suggestion": "Hollow",
- "score": 0.858039839213461
- },
- {
- "suggestion": "Hallo",
- "score": 0.597385084464481
- }
- ]
- },
- {
- "offset": 7,
- "token": "wrld",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.9115257530801
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](../overview.md)-- [Bing Spell Check API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
cognitive-services Sdk Quickstart Spell Check https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/sdk-quickstart-spell-check.md
- Title: "Quickstart: Check spelling with the Bing Spell Check SDK for C#"-
-description: Get started using the Bing Spell Check REST API to check spelling and grammar.
------ Previously updated : 12/16/2019----
-# Quickstart: Check spelling with the Bing Spell Check SDK for C#
--
-Use this quickstart to begin spell checking with the Bing Spell Check SDK for C#. While Bing Spell Check has a REST API compatible with most programming languages, the SDK provides an easy way to integrate the service into your applications. The source code for this sample can be found on [GitHub](https://github.com/Azure-Samples/cognitive-services-dotnet-sdk-samples/tree/master/samples/SpellCheck).
-
-## Application dependencies
-
-* Any edition of [Visual Studio 2017 or later](https://visualstudio.microsoft.com/downloads/).
-* The Bing Spell Check [NuGet Package](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Language.SpellCheck)
-
-To add the Bing Spell Check SDK to your project, select **Manage NuGet Packages** from **Solution Explorer** in Visual Studio. Add the `Microsoft.Azure.CognitiveServices.Language.SpellCheck` package. The package also installs the following dependencies:
-
-* Microsoft.Rest.ClientRuntime
-* Microsoft.Rest.ClientRuntime.Azure
-* Newtonsoft.Json
--
-## Create and initialize the application
-
-1. Create a new C# console solution in Visual Studio. Then add the following `using` statement.
-
- ```csharp
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.Azure.CognitiveServices.Language.SpellCheck;
- using Microsoft.Azure.CognitiveServices.Language.SpellCheck.Models;
- ```
-
-2. Create a new class. Then create an asynchronous function called `SpellCheckCorrection()` that takes a subscription key and sends the spell check request.
-
-3. Instantiate the client by creating a new `ApiKeyServiceClientCredentials` object.
-
- ```csharp
- public static class SpellCheckSample{
- public static async Task SpellCheckCorrection(string key){
- var client = new SpellCheckClient(new ApiKeyServiceClientCredentials(key));
- }
- //...
- }
- ```
-
-## Send the request and read the response
-
-1. In the function created above, perform the following steps. Send the spell check request with the client. Add the text to be checked to the `text` parameter, and set the mode to `proof`.
-
- ```csharp
- var result = await client.SpellCheckerWithHttpMessagesAsync(text: "Bill Gatas", mode: "proof");
- ```
-
-2. Get the first spell check result, if there is one. Print the first misspelled word (token) returned, the token type, and the number of suggestions.
-
- ```csharp
- var firstspellCheckResult = result.Body.FlaggedTokens.FirstOrDefault();
-
- if (firstspellCheckResult != null)
- {
- Console.WriteLine("SpellCheck Results#{0}", result.Body.FlaggedTokens.Count);
- Console.WriteLine("First SpellCheck Result token: {0} ", firstspellCheckResult.Token);
- Console.WriteLine("First SpellCheck Result Type: {0} ", firstspellCheckResult.Type);
- Console.WriteLine("First SpellCheck Result Suggestion Count: {0} ", firstspellCheckResult.Suggestions.Count);
- }
- ```
-
-3. Get the first suggested correction, if there is one. Print the suggestion score, and the suggested word.
-
- ```csharp
- var suggestions = firstspellCheckResult.Suggestions;
-
- if (suggestions?.Count > 0)
- {
- var firstSuggestion = suggestions.FirstOrDefault();
- Console.WriteLine("First SpellCheck Suggestion Score: {0} ", firstSuggestion.Score);
- Console.WriteLine("First SpellCheck Suggestion : {0} ", firstSuggestion.Suggestion);
- }
- ```
-
-## Run the application
-
-Build and run your project. If you're using Visual Studio, press **F5** to debug the file.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single page web-app](tutorials/spellcheck.md)
--- [What is the Bing Spell Check API?](overview.md)-- [Bing Spell Check C# SDK reference guide](/dotnet/api/overview/azure/cognitiveservices/bing-spell-check-readme)
cognitive-services Spellcheck https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Spell-Check/tutorials/spellcheck.md
- Title: "Tutorial: Getting Spell Check Results using Bing Spell Check API"-
-description: Use this tutorial to build a web page that sends queries to the Bing Spell Check API, and displays the results.
------ Previously updated : 03/05/2020----
-# Tutorial: Build a Web page Spell Check client
--
-In this tutorial, we'll build a Web page that allows users to query the Bing Spell Check API. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/BingSpellCheckApp.html).
-
-This tutorial shows you how to:
-
-> [!div class="checklist"]
-> - Make a simple query to the Bing Spell Check API
-> - Display query results
-
-## Prerequisites
--
-To follow along with the tutorial, you need a subscription key for the Bing Spell Check API. If you don't have one, you'll need:
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* [A Bing Spell Check resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSpellCheck-v7)
-
-## Create a new Web page
-
-Open a text editor. Create a new file named, for example, spellcheck.html.
-
-## Add HTML header
-
-Add the HTML header information and begin the script section as follows.
-
-```html
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Bing Spell Check</title>
-
-<style type="text/css">
- html, body, div, p, h1, h2 {font-family: Verdana, "Lucida Sans", sans-serif;}
-
- html, body, div, p {font-weight: normal;}
- h1, h2 {font-weight: bold;}
- sup {font-weight: normal;}
-
- html, body, div, p {font-size: 12px;}
- h1 {font-size: 20px;}
- h2 {font-size: 16px;}
- h1, h2 {clear: left;}
-
- img#logo {float: right;
-</style>
-
-<script type="text/javascript">
-```
-
-## getSubscriptionKey function
-
-The getSubscriptionKey function returns the Bing Spell Check API key. It either retrieves it from
-local storage (that is, a cookie) or prompts the user for if needed.
-
-Begin the getSubscriptionKey function and declare the cookie name as follows.
-
-```html
-getSubscriptionKey = function() {
-
- var COOKIE = "bing-spell-check-api-key"; // name used to store API key in key/value storage
-```
-
-The findCookie helper function returns the value of the specified cookie; if the cookie is not
-found, it returns an empty string.
-
-```html
- function findCookie(name) {
- var cookies = document.cookie.split(";");
- for (var i = 0; i < cookies.length; i++) {
- var keyvalue = cookies[i].split("=");
- if (keyvalue[0].trim() === name) {
- return keyvalue[1];
- }
- }
- return "";
- }
-```
-
-The getSubscriptionKeyCookie helper function prompts the user for the value of the Bing
-Spell Check API key, and returns the key value.
-
-```html
- function getSubscriptionKeyCookie() {
- var key = findCookie(COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Spell Check API subscription key:", "").trim();
- var expiry = new Date();
- expiry.setFullYear(expiry.getFullYear() + 2);
- document.cookie = COOKIE + "=" + key.trim() + "; expires=" + expiry.toUTCString();
- }
- return key;
- }
-```
-
-The getSubscriptionKeyLocalStorage helper function first tries to retrieve the Bing Spell Check
-API key by looking up the appropriate cookie. If the cookie is not found, it prompts the user for
-the key value. It then returns the key value.
-
-```html
- function getSubscriptionKeyLocalStorage() {
- var key = localStorage.getItem(COOKIE) || "";
- while (key.length !== 32)
- key = prompt("Enter Bing Spell Check API subscription key:", "").trim();
- localStorage.setItem(COOKIE, key)
- return key;
- }
-```
-
-The getSubscriptionKey helper function takes one parameter, **invalidate**. If **invalidate** is
-**true**, getSubscriptionKey deletes the cookie that contains the Bing Spell Check API key. If
-**invalidate** is **false**, getSubscriptionKey returns the value of the Bing Spell Check API key.
-
-```html
- function getSubscriptionKey(invalidate) {
- if (invalidate) {
- try {
- localStorage.removeItem(COOKIE);
- } catch (e) {
- document.cookie = COOKIE + "=";
- }
- } else {
- try {
- return getSubscriptionKeyLocalStorage();
- } catch (e) {
- return getSubscriptionKeyCookie();
- }
- }
- }
-```
-
-Return the getSubscriptionKey helper function as the result of the outer getSubscriptionKey
-function. Close the definition of the outer getSubscriptionKey function.
-
-```html
- return getSubscriptionKey;
-
-}();
-```
-
-## Helper functions
-
-The pre helper function returns the specified text preformatted with the [pre](https://www.w3schools.com/tags/tag_pre.asp)
-HTML tag.
-
-```html
-function pre(text) {
- return "<pre>" + text.replace(/&/g, "&amp;").replace(/</g, "&lt;") + "</pre>"
-}
-```
-
-The renderSearchResults function displays the specified results from the Bing Spell Check API, using JSON pretty printing.
-
-```html
-function renderSearchResults(results) {
- document.getElementById("results").innerHTML = pre(JSON.stringify(results, null, 2));
-}
-```
-
-The renderErrorMessage function displays the specified error message and error code.
-
-```html
-function renderErrorMessage(message, code) {
- if (code)
- document.getElementById("results").innerHTML = "<pre>Status " + code + ": " + message + "</pre>";
- else
- document.getElementById("results").innerHTML = "<pre>" + message + "</pre>";
-}
-```
-
-## bingSpellCheck function
-
-The bingSpellCheck function is called each time the user enters text in the HTML form field.
-It takes two parameters: the contents of the HTML form field, and the Bing Spell Check API key.
-
-```html
-function bingSpellCheck(query, key) {
-```
-
-Specify the Bing Spell Check API endpoint and declare an XMLHttpRequest object, which we will
-use to send requests to the endpoint.
-
-```html
- var endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/spellcheck/";
-
- var request = new XMLHttpRequest();
-
- try {
- request.open("GET", endpoint + "?mode=proof&mkt=en-US&text=" + encodeURIComponent(query));
- }
- catch (e) {
- renderErrorMessage("Bad request");
- return false;
- }
-```
-
-Set the **Ocp-Apim-Subscription-Key** header to the value of the Bing Spell Check API key.
-
-```html
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
-```
-
-Handle the response from the endpoint. If the status is 200 (OK), display the results; otherwise,
-display the error information.
-
-```html
- request.addEventListener("load", function() {
- if (this.status === 200) {
- renderSearchResults(JSON.parse(this.responseText));
- }
- else {
- if (this.status === 401) getSubscriptionKey(true);
- renderErrorMessage(this.statusText, this.status);
- }
- });
-```
-
-Also handle possible error events from the XMLHttpRequest object.
-
-```html
- request.addEventListener("error", function() {
- renderErrorMessage("Network error");
- });
-
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-```
-
-Send the request. Close the bingSpellCheck function, the **script** tag, and the **head** tag.
-
-```html
- request.send();
- return false;
-}
-// --></script>
-
-</head>
-```
-
-## HTML body
-
-When the Web page loads, make sure we have the Bing Spell Check API key, prompting the user for it if needed.
-
-```html
-<body onload="document.forms.bing.query.focus(); getSubscriptionKey();">
-```
-
-Display the Bing logo.
-
-```html
-<img id="logo" align=base src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAyCAIAAAAYxYiPAAAAA3NCSVQICAjb4U/gAAARMElEQVR42u2bCVRUV5rHi8VxaeNuOumYTs706aTTZrp7TqbTk5g+9kn3OZN0pjudpZM5SfdJzEzPyZmO1gbIJhmNmijy6hUFsisCgsqigoCt7IoKgoDgUgXILntR+/aWzHfvfQUFFEURsU8cKe/hFFL16r3f++53/9//uyXSWUwjZgPDshzHcy4PnuMXHvP4EJ1qufpPyRHby3Iv93XqbDY7y7IC9QU48wr6RMtVEb1NpJAvoeQvpVF7L5c0jQ6ZHAwJcH6B+HyBzm6pEymkIlomouUiWiqiJCvpwDdOxCdfr+nV6x0Mwy+gnqeIJqAxa3iikJDhEyX5fmx4eZcGJ+yFxz2DPg6pQwA9eQBuSnJC3bCQPe4/6ChxjqbxAVQgnHM8OKBzW5s4lucfsOSxAHoWPh4eggRy/ubprQzL6a1Wo83KfZuWl5lBU39v0CDeQcDbGQa0PB7jT4RfHawDJD562bTzERiznI1l4xurX0yNfCVdcUbTAtAXQE+PSnbEYgkoyfmkOGNL8dEtxZkwPhFGFjz/tCR7b+35su5WrcXCuq1gOa5ZO7Q6eruIBuEk/WH8zj6LaQH0dNB8t8X03dgIqJ6cQyainENBhmSJQvxi2v4j12tMqIydFN3wy8XuO0sOSNEVUZI1ypA23cgCaDegewTQAlYfGNTEQCWVQkrO1l8h+eu5E2M2m+u5AfRBq+Xf0unFlHSxUv5BQZqRcSyAdg/60dgd+NPFf8hPiaotPQCjpnR/bWnExcI/5h96KmmXHyqsUGbwo+S7Lp2zu0Y0immuR6/NbLqSc7NhxGb59qyGXoMm6/59Bt0rgEYcY+svsOz4IscxHJhdXK/REFRZsISENiX9fkx4q0E3nqnRKxFrbIux5I3fnhL8Rp038o77u2iluxbjo7Fh+HwkqmvVnBt1wVoZ9rPibB8KQCPc6Tfr3cmQb6HX4QH0gW0ENATIHe2gwW5lp4rb+wZaKVE2uAWNgraqp2OJkqRsyb7qc+OgJ+tuMhG5mWS6kGsEhc4730TeJ/zXN1X9bh4zg4bhAlpSfPS149Gqa1U3RgeMdlCraCqji55f0GZIHeEkoqMbqqdXd/j3r2/ptd+JDhQpUbLec6GYnQyaQY46KlsQLpfcgZx2koI4IScRSQ6vtzIM1DhjVovJbnOgtCOkHo+qH+t+JPAdAERvMessZrPdzuBqYNLxcQ3lFWh4Y2mnelmU2EcpWR8T+ubJ5JTmq61jWjPjmF683V/QuLRuHBlcCuKPkvlFSVKba3ERw5HbAJjKutU5rU25msbmgT7X0zE5HPmtzdmaxhx1Y59eR25Jl24sqeHynwozXj2m2pRJv5EXF1p++lJfp4VhZpy1+H/hzzqrtayrNbQ8/628xFcyqV8di34vL2XfxfMtw/1WtEywl3o7cjXXc2431fZ2zgI6D0CjIzN6u+Pl1AOiaCJRpb5Rkqfid/65MCNPfb3PqIeIwPGN/t1X0CwSFmx6S70f0nmyNcqgOu0AClyeJbcB5N4v0ykQLT6UJLAkx/XG95j0j0YH+dAS36itJ243WR3M0VsNG5N2+0fB2itGKzC6amQRr1WGhFadGXWmymmzioPbWdvf87vchOWwTlBEO4iJePc/INkQu2NfXaXWbn8//7Nsr17X0N9T1aWBErSkSwNlt2Z0SG+DpOCm8fJ/b7k8gBQkHh4AAAAASUVORK5CYII=">
-```
-
-Create an HTML form with a text field. Handle the `onsubmit` event and call the bingSpellCheck
-function, passing the contents of the text field and the Bing Spell Check API key.
-
-```html
-<form name="bing" onsubmit="return bingSpellCheck(this.query.value, getSubscriptionKey())">
- <h2>Spell Check</h2>
- <input type="text" name="query" size="80" placeholder="Spell Check" autocomplete=off>
-</form>
-```
-
-Add the HTML **div** tag that we use to display the results. The JavaScript we defined
-previously refers to this **div** tag.
-
-```html
-<h2>Results</h2>
-<div id="results">
-<p>None yet.</p>
-
-</div>
-
-</body>
-</html>
-```
-
-Save the file.
-
-## Display results
-
-Open the Web page in your browser. At the prompt, enter your Bing Spell Check API subscription key. Enter a query (for example, "Hollo, wlrd!") in the **Spell Check** text box and press **Enter**. The Web page then displays the query results.
-
-```json
-{
- "_type": "SpellCheck",
- "flaggedTokens": [
- {
- "offset": 0,
- "token": "Hollo",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "Hello",
- "score": 0.856629936217145
- },
- {
- "suggestion": "Hollow",
- "score": 0.816717853225633
- }
- ]
- },
- {
- "offset": 7,
- "token": "wlrd",
- "type": "UnknownToken",
- "suggestions": [
- {
- "suggestion": "world",
- "score": 0.856629936217145
- }
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Use and display requirements](../../bing-web-search/use-display-requirements.md)
cognitive-services Bing Video Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/bing-video-upgrade-guide-v5-to-v7.md
- Title: Upgrade Bing Video Search API v5 to v7-
-description: Identifies the parts of your Bing Video Search application that you need to update to use version 7.
------- Previously updated : 01/31/2019---
-# Video Search API upgrade guide
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing Video Search API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number changed from v5 to v7. For example, `https://api.cognitive.microsoft.com/bing/v7.0/videos/search`.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
-
--- Replaced the v5 error codes with the following possible `code` and `subCode` values.-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the sub-code conditions occur. The response includes these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
-
-### Query parameters
--- Renamed the `modulesRequested` query parameter to [modules](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#modulesrequested). -
-### Object changes
--- Renamed the `nextOffsetAddCount` field of [Videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) to `nextOffset`. The way you use the offset has also changed. Previously, you would set the [offset](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#offset) query parameter to the `nextOffset` value plus the previous offset value plus the number of videos in the result. Now, you simply set the `offset` query parameter to the `nextOffset` value.
-
-- Changed the data type of the `relatedVideos` field from `Video[]` to [VideosModule](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videosmodule) (see [VideoDetails](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videodetails)).
cognitive-services Get Videos https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/concepts/get-videos.md
- Title: "Search for videos using the Bing Video Search API"-
-description: The Bing Video Search APIfinds and returns relevant videos from the web, it provides several features for intelligent and focused video retrieval on the web.
------ Previously updated : 06/24/2019---
-# Search for videos with the Bing Video Search API
--
-The Bing Video Search API makes it easy to integrate Bing's cognitive news searching capabilities into your applications. While the API primarily finds and returns relevant videos from the web, it provides several features for intelligent and focused video retrieval on the web.
-
-## Getting videos
-
-To get videos related to the user's search term from the web, send the following GET request:
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/search?q=sailing+dinghies&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-All requests must be made from a server.
-
-If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-To get videos from a specific domain, use the [site:](/previous-versions/bing/search/ff795613(v=msdn.10)) query operator.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/search?q=sailing+dinghies+site:contososailing.com&mkt=en-us HTTP/1.1
-```
-
-The response contains a [Videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) answer that contains a list of videos that Bing thought were relevant to the query. Each [Video](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video) object in the list includes the URL of the video, its duration, its dimensions, and its encoding format among other attributes. The video object also includes the URL of a thumbnail of the video and the thumbnail's dimensions.
-
-```json
-{
- "_type" : "Videos",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7545...",
- "totalEstimatedMatches" : 1000,
- "value" : [
- {
- "name" : "How to sail - What to Wear for Dinghy Sailing",
- "description" : "An informative video on what to wear when...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7...",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OVP.DYW...",
- "datePublished" : "2014-03-04T11:51:53",
- "publisher" : [
- {
- "name" : "Fabrikam"
- }
- ],
- "creator" :
- {
- "name" : "Marcus Appel"
- },
- "contentUrl" : "https:\/\/www.fabrikam.com\/watch?v=vzmPjZ--g",
- "hostPageUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7545D569...",
- "encodingFormat" : "h264",
- "hostPageDisplayUrl" : "https:\/\/www.fabrikam.com\/watch?v=vzmPjZ--g",
- "width" : 1280,
- "height" : 720,
- "duration" : "PT2M47S",
- "motionThumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?id=OM.Y62...",
- "embedHtml" : "<iframe width=\"1280\" height=\"720\" src=\"https:...><\/iframe>",
- "allowHttpsEmbed" : true,
- "viewCount" : 8743,
- "thumbnail" :
- {
- "width" : 300,
- "height" : 168
- },
- "videoId" : "6DB795E11A6E3CBAAD636DB795E113CBAAD63",
- "allowMobileEmbed" : true,
- "isSuperfresh" : false
- },
- ...
- ],
- "queryExpansions" : [...],
- "nextOffsetAddCount" : 0,
- "pivotSuggestions" : [...]
-}
-```
-
-## Video thumbnails
-
-You can display all, or a subset of the video thumbnails returned by the Bing Video Search API. If you display a subset, provide the user an option to view the remaining videos. as part of the Bing API [use and display requirements](../../bing-web-search/use-display-requirements.md), You must display the videos in the order provided in the response. For information about resizing the thumbnail, see [Resizing and Cropping Thumbnails](../../bing-web-search/resize-and-crop-thumbnails.md).
-
-As the user hovers over the thumbnail you can use [motionThumbnailUrl](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-motionthumbnailurl) to play a thumbnail version of the video. Be sure to attribute the motion thumbnail when you display it.
-
-<!-- Removing until the images can be sanitized.
-![Motion thumbnail of a video](../bing-web-search/media/cognitive-services-bing-web-api/bing-web-video-motion-thumbnail.PNG)
>-
-When a thumbnail is clicked, there are three options for viewing the video:
--- Use [hostPageUrl](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-hostpageurl) to view the video on the host website (for example, YouTube)-- Use [webSearchUrl](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-websearchurl) to view the video in the Bing video browser-- Use [embdedHtml](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-embedhtml) to embed the video in your own experience -
-Be sure to use the publisher and creator to attribute the video when you play it.
-
-For details about using [videoId](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-videoid) to get insights about the video, see [Video Insights](../video-insights.md).
-
-## Filtering videos
-
-By default, the Video Search API returns all videos that are relevant to the query. If you only want free videos or videos less than five minutes in length, you'd use the following filter query parameters:
--- [pricing](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#pricing)&mdash;Filter videos by pricing (for example, videos that are free or that you have to pay for)-- [resolution](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#resolution)&mdash;Filter videos by resolution (for example, videos with a 720p or higher resolution)-- [videoLength](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videolength)&mdash;Filter videos by video length (for example, videos that are less than five minutes in length)-- [freshness](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#freshness)&mdash;Filter videos by age (for example, videos discovered by Bing in the past week)-
-To get videos from a specific domain, include the [site:](/previous-versions/bing/search/ff795613(v=msdn.10)) query operator in the query string.
-
-> [!NOTE]
-> Depending on the query, if you use the `site:` query operator, there is the chance that the response contains adult content regardless of the [safeSearch](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#safesearch) setting. You should use `site:` only if you are aware of the content on the site and your scenario supports the possibility of adult content.
-
-The following example shows how to get free videos from ContosoSailing.com that have a resolution of 720p or better and that Bing has discovered in the past month.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/search?q=sailing+dinghies+site:contososailing.com&pricing=free&freshness=month&resolution=720p&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Expanding the query
-
-If Bing can expand the query to narrow the original search, the [Videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) object contains the `queryExpansions` field. For example, if the query was *Cleaning Gutters*, the expanded queries might be: Gutter Cleaning **Tools**, Cleaning Gutters **From the Ground**, Gutter Cleaning **Machine**, and **Easy** Gutter Cleaning.
-
-The following example shows the expanded queries for *Cleaning Gutters*.
-
-```json
-{
- "_type" : "Videos",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=B52FBC5...",
- "totalEstimatedMatches" : 1000,
- "value" : [...],
- "nextOffsetAddCount" : 4,
- "queryExpansions" : [
- {
- "text" : "Gutter Cleaning Tools",
- "displayText" : "Tools",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=B52FB....",
- "searchLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v5...",
- "thumbnail" : {
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?q=Gutter..."
- }
- },
- ...
- ]
- "pivotSuggestions" : [...],
-}
-```
-
-The `queryExpansions` field contains a list of [Query](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#query_obj) objects. The `text` field contains the expanded query and the `displayText` field contains the expansion term. You can use the text and thumbnail fields to display the expanded query strings to the user in case the expanded query string is really what they're looking for. Make the thumbnail and text clickable using the `webSearchUrl` URL or `searchLink` URL. Use `webSearchUrl` to send the user to the Bing search results, or `searchLink` if you provide your own results page.
-
-## Pivoting the query
-
-If Bing can segment the original search query, the [Videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) object contains the `pivotSuggestions` field. For example, if the original query was *Cleaning Gutters*, Bing might segment the query into *Cleaning* and *Gutters*.
-
-The following example shows the pivot suggestions for *Cleaning Gutters*.
-
-```json
-{
- "_type" : "Videos",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=B52FBC...",
- "totalEstimatedMatches" : 1000,
- "value" : [...],
- "nextOffsetAddCount" : 0,
- "queryExpansions" : [...],
- "pivotSuggestions" : [
- {
- "pivot" : "cleaning",
- "suggestions" : [
- {
- "text" : "Gutter Repair",
- "displayText" : "Repair",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=B52...",
- "searchLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v5\/videos...",
- "thumbnail" : {
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?q=Gutter..."
- }
- },
- ...
- ]
- },
- {
- "pivot" : "gutters",
- "suggestions" : [
- {
- "text" : "Window Cleaning",
- "displayText" : "Window",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=B52FBC59...",
- "searchLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v5...",
- "thumbnail" : {
- "thumbnailUrl" : "https:\/\/tse2.mm.bing.net\/th?q=Window..."
- }
- },
- ...
- ]
- }
- ]
-}
-```
-
-For each pivot, the response contains a list of [Query](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#query_obj) objects that contain suggested queries. The `text` field contains the suggested query and the `displayText` field contains the term that replaces the pivot in the original query. For example, Window Cleaning.
-
-You can use the `text` and `thumbnail` fields to display the expanded query strings to the user in case the expanded query string is really what they're looking for. Make the thumbnail and text clickable using the `webSearchUrl` URL or `searchLink` URL. Use `webSearchUrl` to send the user to the Bing search results, or `searchLink` if you provide your own results page.
-
-## Throttling requests
-
cognitive-services Sending Requests https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/concepts/sending-requests.md
- Title: "Send search requests to the Bing Video Search API"-
-description: This article describes the parameters and attributes of requests sent to the Bing Video Search API, as well as the JSON response object it returns.
------ Previously updated : 12/03/2019---
-# Sending search requests to the Bing Video Search API
--
-This article describes the parameters and attributes of requests sent to the Bing Video Search API, as well as the JSON response object it returns.
--
-## Suggest search terms with the Bing Autosuggest API
-
-If you provide a search box where the user enters their search term, use the [Bing Autosuggest API](../../bing-autosuggest/get-suggested-search-terms.md) to improve the experience. The API returns suggested query strings based on partial search terms as the user types.
-
-After the user enters their search term, URL-encode it before setting the [q](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#query) query parameter. For example, if the user enters *sailing dinghies*, set `q` to `sailing+dinghies` or `sailing%20dinghies`.
-
-## Sending a request
-
-To get Video search results, you'd send a GET request to the following endpoint:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/videos/search
-```
-
-The request must use the HTTPS protocol.
-
-We recommend that all requests originate from a server. Distributing the key as part of a client application provides more opportunity for a malicious third party to access it. Making calls from a server also provides a single upgrade point for future versions of the API.
-
-
-The request must specify the [q](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#query) query parameter, which contains the user's search term. Although it's optional, the request should also specify the [mkt](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#mkt) query parameter, which identifies the market where you want the results to come from. For a list of optional query parameters such as `pricing`, see [Query Parameters](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#query-parameters). All query parameter values must be URL encoded.
-
-The request must specify the [Ocp-Apim-Subscription-Key](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#subscriptionkey) header. Although optional, you are encouraged to also specify the following headers:
-
-- [User-Agent](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#useragent) -- [X-MSEdge-ClientID](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#clientid) -- [X-Search-ClientIP](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#clientip) -- [X-Search-Location](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#location) -
-The client IP and location headers are important for returning location aware content.
-
-For a list of all request and response headers, see [Headers](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#headers).
-
-## Example search request
-
-The following shows a search request that includes all the suggested query parameters and headers. If it's your first time calling any of the Bing APIs, don't include the client ID header. Only include the client ID if you've previously called a Bing API and Bing returned a client ID for the user and device combination.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/search?q=sailing+dinghies&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Example JSON response
-
-The following shows the response to the previous request. The example also shows the Bing-specific response headers.
--
-```json
-BingAPIs-TraceId: 76DD2C2549B94F9FB55B4BD6FEB6AC
-X-MSEdge-ClientID: 1C3352B306E669780D58D607B96869
-BingAPIs-Market: en-US
-
-{
- "_type" : "Videos",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7545D5694...",
- "totalEstimatedMatches" : 1000,
- "value" : [
- {
- "name" : "How to sail - What to Wear for Dinghy Sailing",
- "description" : "An informative video on what to wear when...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7545D56...",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OVP.DYWCvh...",
- "datePublished" : "2014-03-04T11:51:53",
- "publisher" : [
- {
- "name" : "Fabrikam"
- }
- ],
- "creator" : {
- "name" : "Marcus Appel"
- },
- "contentUrl" : "https:\/\/www.fabrikam.com\/watch?v=vzmPjHZ--g",
- "hostPageUrl" : "https:\/\/www.bing.com\/cr?IG=81EF7545D56944...",
- "encodingFormat" : "h264",
- "hostPageDisplayUrl" : "https:\/\/www.fabrikam.com\/watch?v=vzmPjBZ--g",
- "width" : 1280,
- "height" : 720,
- "duration" : "PT2M47S",
- "motionThumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?id=OM.Y6...",
- "embedHtml" : "<iframe width=\"1280\" height=\"720\" src=\"https:...><\/iframe>",
- "allowHttpsEmbed" : true,
- "viewCount" : 8743,
- "thumbnail" : {
- "width" : 300,
- "height" : 168
- },
- "videoId" : "6DB795E11A6E3CBAAD636DB795E11E3CBAAD63",
- "allowMobileEmbed" : true,
- "isSuperfresh" : false
- },
- . . .
- ],
- "nextOffset" : 0,
- "pivotSuggestions" : [
- {
- "pivot" : "sailing",
- "suggestions" : []
- },
- {
- "pivot" : "dinghies",
- "suggestions" : [
- {
- "text" : "Sailing Cruising",
- "displayText" : "Cruising",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=81EF754...",
- "searchLink" : "https:\/\/api.cognitive.microsoft.com...",
- "thumbnail" : {
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?q=Sailing..."
- }
- },
- . . .
- ]
- }
- ]
-}
-```
-
-## Next steps
-
-Try out the API. Go to [Video Search API Testing Console](https://dev.cognitive.microsoft.com/docs/services/56b43f3ccf5ff8098cef3809/operations/58113fe5e31dac0a1ce6b0a8).
-
-For details about consuming the response objects, see [Searching the Web for Videos](../overview.md).
-
-For details about getting insights about a video such as related searches, see [Video Insights](../video-insights.md).
-
-For details about videos that are trending on social media, see [Trending Videos](../trending-videos.md).
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/overview.md
- Title: What is the Bing Video Search API?-
-description: Learn how to search for videos across the web, using the Bing Video Search API.
------- Previously updated : 12/18/2019--
-# What is the Bing Video Search API?
--
-The Bing Video Search API makes it easy to add video searching capabilities to your services and applications. By sending user search queries with the API, you can get and display relevant and high-quality videos similar to [Bing Video](https://www.bing.com/video). Use this API for search results that only contain videos. The [Bing Web Search API](../bing-web-search/overview.md) can return other types of web content, including webpages, videos, news and images.
-
-## Bing Video Search API features
-
-| Feature | Description |
-|--||
-| [Suggest search terms in real-time](concepts/sending-requests.md#suggest-search-terms-with-the-bing-autosuggest-api) | Improve your app experience by using the [Bing Autosuggest API](../bing-autosuggest/get-suggested-search-terms.md) to display suggested search terms as they're typed. |
-| [Filter and restrict video results](concepts/get-videos.md#filtering-videos) | Filter the videos returned by editing query parameters. |
-| [Crop, resize, and display thumbnails](../bing-web-search/resize-and-crop-thumbnails.md) | Edit and display thumbnail previews for the videos returned by Bing Video Search API. |
-| [Get trending videos](trending-videos.md) | Search for trending videos from around the world. |
-| [Get video insights](video-insights.md) | Customize a search for trending videos from around the world. |
-
-## Workflow
-
-The Bing Video Search API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON. You can use the service using either the [REST API](./quickstarts/csharp.md), or the [SDK](./quickstarts/client-libraries.md?pivots=programming-language-csharp%253fpivots%253dprogramming-language-csharp).
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/free/cognitive-services/) for free.
-2. Send a request to the API, with a valid search query.
-3. Process the API response by parsing the returned JSON message.
--
-## Next steps
-
-The Bing Video Search API [interactive demo](https://azure.microsoft.com/services/cognitive-services/bing-video-search-api/) shows how you can customize a search query and search the web for videos.
-
-Use the [quickstart](./quickstarts/csharp.md) to quickly get started with your first API request.
-
-## See also
-
-* The [Bing Video Search API v7](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference) reference page contains the list of endpoints, headers, and query parameters used to request search results.
-
-* The [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
-
-* Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing Video Search client library'-
-description: The Video Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 10/22/2020---
-# Quickstart: Use the Bing Video Search client library
-------------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/csharp.md
- Title: "Quickstart: Search for videos using the REST API and C# - Bing Video Search"-
-description: "Use this quickstart to send video search requests to the Bing Video Search REST API using C#."
------ Previously updated : 10/22/2020----
-# Quickstart: Search for videos using the Bing Video Search REST API and C#
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple C# application sends an HTTP video search query to the API and displays the JSON response. Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingVideoSearchv7.cs) with additional error handling, features, and code annotations.
-
-## Prerequisites
-
-YouΓÇÖll need to set up your machine to run .NET core. You can find the installation instructions on the [.NET Core Downloads](https://dotnet.microsoft.com/download)
-page. You can run this application on Windows, Linux, macOS, or in a Docker container. YouΓÇÖll need to install your favorite code editor. The descriptions below
-use [Visual Studio Code](https://code.visualstudio.com/), which is an open source, cross platform editor. However, you can use whatever tools you are
-comfortable with.
--
-## Create and initialize a project
-
-The first step is to create a new application. Open a command prompt and create a new directory for your application. Make that the current directory. Enter the following command in a console window:
-
-```dotnetcli
-dotnet new console --name VideoSearchClient
-```
-
-You'll need to add the following `using` directive at the top of your Main method so that the C# compiler recognizes the Task and JSON types:
-
-```csharp
-using System;
-using System.Net.Http;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-```
-
-Add variables for your subscription key, endpoint, and search term. For the `uriBase` value, you can use the global endpoint in the following code or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```csharp
-// Replace the accessKey string value with your valid access key.
-const string _accessKey = "enter your key here";
-
-// Or use the custom subdomain endpoint displayed in the Azure portal for your resource.
-const string _uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/videos/search";
-
-const string _searchTerm = "kittens";
-```
-
-Next, update the Main method so we can use Async methods. Add the async modifier, and change the return type to Task.
-
-```csharp
-static async Task Main(string[] args)
-{
-
-}
-```
-
-Now, you have a program that does nothing but does it asynchronously. Let's improve it.
-
-## Create a data structure to hold the Bing Video Search API response
-
-Define a `SearchResult` and `Video` class to contain the video search results. You can add more properties later when you need other fields from the JSON result.
-
-```cscharp
-class SearchResult
-{
- [JsonPropertyName("totalEstimatedMatches")]
- public int TotalEstimatedMatches { get; set; }
-
- [JsonPropertyName("value")]
- public List<Video> Videos { get; set; }
-}
-
-class Video
-{
- [JsonPropertyName("name")]
- public string Name { get; set; }
-
- [JsonPropertyName("description")]
- public string Description { get; set; }
-
- [JsonPropertyName("thumbnailUrl")]
- public string ThumbnailUrl { get; set; }
-
- [JsonPropertyName("contentUrl")]
- public string ContentUrl { get; set; }
-}
-```
-
-## Create and handle a video search request
-
-We use `HttpClient` to perform the call to the API. First, we need to add the header `Ocp-Apim-Subscription-Key` and your access key.
-
-```csharp
-using var client = new HttpClient();
-client.BaseAddress = new Uri(_uriBase);
-client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _accessKey);
-```
-
-Construct the URI for the search request. Format the search term `_searchTerm` before you append it to the string.
-
-```csharp
-var response = await client.GetAsync($"?q={Uri.EscapeDataString(_searchTerm)}");
-```
-
-## Process the result
-
-When the response was successful, we can process the JSON data. We deserialize the JSON string into our `SearchResult` we had created earlier. Loop to the result (if any) and print the result to the console.
-
-```csharp
-if (response.IsSuccessStatusCode)
-{
- var json = await response.Content.ReadAsStringAsync();
- var result = JsonSerializer.Deserialize<SearchResult>(json);
-
- foreach (var video in result.Videos)
- {
- Console.WriteLine($"Name: {video.Name}");
- Console.WriteLine($"ContentUrl: {video.ContentUrl}");
- Console.WriteLine();
- }
-}
-```
-
-## Example JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/java.md
- Title: "Quickstart: Search for videos using the REST API and Java - Bing Video Search"-
-description: Use this quickstart to send video search requests to the Bing Video Search REST API using Java.
------ Previously updated : 05/22/2020---
-# Quickstart: Search for videos using the Bing Video Search REST API and Java
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple Java application sends an HTTP video search query to the API and displays the JSON response. Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingVideoSearchv7.java) with additional error handling, features, and code annotations.
-
-## Prerequisites
-
-* The [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)
-
-* The [Gson library](https://github.com/google/gson)
---
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.net.*;
- import java.util.*;
- import java.io.*;
- import javax.net.ssl.HttpsURLConnection;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- ```
-
-2. Create a new class named `SearchResults` to store the headers and JSON response from the API.
-
- ```java
- // Container class for search results encapsulates relevant headers and JSON data
- class SearchResults{
- HashMap<String, String> relevantHeaders;
- String jsonResponse;
- SearchResults(HashMap<String, String> headers, String json) {
- relevantHeaders = headers;
- jsonResponse = json;
- }
- }
- ```
-
-3. Create a new method named `SearchVideos()` with variables for your API endpoint host and path, your subscription key, and search term. This method returns a `SearchResults` object. For the `host` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- public static SearchResults SearchVideos (String searchQuery) throws Exception {
- static String subscriptionKey = "enter your key here";
- static String host = "https://api.cognitive.microsoft.com";
- static String path = "/bing/v7.0/videos/search";
- static String searchTerm = "kittens";
- }
- ```
-
-## Construct and send the search request
-
-In the `SearchVideos()` method, perform the following steps:
-
-1. Construct the URL for your request by combining your API host, path, and encoded search query. Use `openConnection()` to create a connection, and then add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ```java
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8"));
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
- ```
-
-2. Get the response from the API and store the JSON string.
-
- ```java
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
- ```
-
- 3. Use `getHeaderFields()` to extract the HTTP headers from the response, and store the Bing-related ones in the `results` object. Then, close the stream and return the result.
-
- ```java
- // extract Bing-related HTTP headers
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")) {
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
- stream.close();
- return results;
- ```
-
-## Format the response
-
-Create a method named `prettify()` to format the response returned from the Bing Video API. Use the Gson library's `JsonParser` to convert a JSON string to an object. Then, use `GsonBuilder()` and `toJson()` to create the formatted string.
-
-```java
-// pretty-printer for JSON; uses GSON parser to parse and re-serialize
-public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
-}
-```
-
-## Send the request and print the response
-
-In the main method of your application, call `SearchVideos` with your search term. Then, print the HTTP headers stored in the response and the JSON string returned by the API.
-
- ```java
- public static void main (String[] args) {
-
- SearchResults result = SearchVideos(searchTerm);
- //print the Relevant HTTP Headers
- for (String header : result.relevantHeaders.keySet())
- System.out.println(header + ": " + result.relevantHeaders.get(header));
- System.out.println(prettify(result.jsonResponse));
- }
- ```
-
-## JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/nodejs.md
- Title: "Quickstart: Search for videos using the REST API and Node.js - Bing Video Search"-
-description: Use this quickstart to send video search requests to the Bing Video Search REST API using JavaScript.
------ Previously updated : 05/22/2020---
-# Quickstart: Search for videos using the Bing Video Search REST API and Node.js
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple JavaScript application sends an HTTP video search query to the API, and displays the JSON response. Although this application is written in JavaScript and uses Node.js, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingVideoSearchv7.js) with additional error handling, and code annotations.
-
-## Prerequisites
-
-* [Node.js](https://nodejs.org/en/download/).
-
-* The Request module for JavaScript. Install this module by using `npm install request`.
--
-## Initialize the application
-
-1. Create a new JavaScript file in your favorite IDE or editor. Set the strictness and add the following requirement:
-
- ```javascript
- 'use strict';
- let https = require('https');
- ```
-
-2. Create variables for your API endpoint, subscription key, and search term. For the `host` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- let subscriptionKey = 'enter key here';
- let host = 'api.cognitive.microsoft.com';
- let path = '/bing/v7.0/videos/search';
- let term = 'kittens';
- ```
-
-## Create a response handler
-
-1. Create a function called `response_handler` to take a JSON response from the API. Create a variable for the response body. Append the response when a `data` flag is received by using `response.on()`.
-
- ```javascript
- let response_handler = function (response) {
- let body = '';
- response.on('data', function (d) {
- body += d;
- });
- };
- ```
-
-1. In this function, use `response.on()` when `end` is signaled to store the bing-related headers (starting with `bingapis` or `x-msedge-`). Parse the JSON using `JSON.parse()`, convert it to a string with `JSON.stringify()`, and print it.
-
- ```javascript
- response.on('end', function () {
- for (var header in response.headers)
- // header keys are lower-cased by Node.js
- if (header.startsWith("bingapis-") || header.startsWith("x-msedge-"))
- console.log(header + ": " + response.headers[header]);
- body = JSON.stringify(JSON.parse(body), null, ' ');
- //JSON Response body
- console.log(body);
- });
- ```
-
-## Create and send the search request
-
-Create a function called `bing_video_search()`. Add the parameters for your request including your host name, and headers. Encode your search term and append it to your path parameter with the `?q=` parameter. Then, send the request with `req.end()`.
-
-```javascript
-let bing_video_search = function (search_term) {
- console.log('Searching videos for: ' + term);
-let request_params = {
- method : 'GET',
- hostname : host,
- path : path + '?q=' + encodeURIComponent(search_term),
- headers : {
- 'Ocp-Apim-Subscription-Key' : subscriptionKey,
- }
- };
- let req = https.request(request_params,
- response_handler);
- req.end();
-}
-```
-
-## JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/php.md
- Title: "Quickstart: Search for videos using the REST API and PHP - Bing Video Search"-
-description: Use this quickstart to send video search requests to the Bing Video Search REST API using PHP
------ Previously updated : 05/22/2020----
-# Quickstart: Search for videos using the Bing Video Search REST API and PHP
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple PHP application sends an HTTP video search query to the API, and displays the JSON response. The example code is written to work under PHP 5.6.
-
-Although this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* PHP 5.6 or later
--
-## Running the application
-
-The [Bing Video Search API](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference) returns video results from the Bing search engine.
-
-1. Enable secure HTTP support in your `php.ini` file by uncommenting the `;extension=php_openssl.dll` line, as described in the following code.
-2. Create a new PHP project in your favorite IDE or editor.
-3. Add the code provided below.
-4. Replace the `$accessKey` value with an access key valid for your subscription. For the `$endpoint` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-5. Run the program.
-
-```php
-<?php
-
-// NOTE: Be sure to uncomment the following line in your php.ini file.
-// ;extension=php_openssl.dll
-
-// **********************************************
-// *** Update or verify the following values. ***
-// **********************************************
-
-// Replace the accessKey string value with your valid access key.
-$accessKey = 'enter key here';
-
-// Verify the endpoint URI. At this writing, only one endpoint is used for Bing
-// search APIs. In the future, regional endpoints may be available. If you
-// encounter unexpected authorization errors, double-check this value against
-// the endpoint for your Bing Search instance in your Azure dashboard.
-$endpoint = 'https://api.cognitive.microsoft.com/bing/v7.0/videos/search';
-
-$term = 'kittens';
-
-function BingVideoSearch ($url, $key, $query) {
- // Prepare HTTP request
- // NOTE: Use the key 'http' even if you are making an HTTPS request. See:
- // https://php.net/manual/en/function.stream-context-create.php
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
- $options = array ('http' => array (
- 'header' => $headers,
- 'method' => 'GET' ));
-
- // Perform the Web request and get the JSON response
- $context = stream_context_create($options);
- $result = file_get_contents($url . "?q=" . urlencode($query), false, $context);
-
- // Extract Bing HTTP headers
- $headers = array();
- foreach ($http_response_header as $k => $v) {
- $h = explode(":", $v, 2);
- if (isset($h[1]))
- if (preg_match("/^BingAPIs-/", $h[0]) || preg_match("/^X-MSEdge-/", $h[0]))
- $headers[trim($h[0])] = trim($h[1]);
- }
-
- return array($headers, $result);
-}
-
-print "Searching videos for: " . $term . "\n";
-
-list($headers, $json) = BingVideoSearch($endpoint, $accessKey, $term);
-
-print "\nRelevant Headers:\n\n";
-foreach ($headers as $k => $v) {
- print $k . ": " . $v . "\n";
-}
-
-print "\nJSON Response:\n\n";
-echo json_encode(json_decode($json), JSON_PRETTY_PRINT);
-?>
-```
-
-## JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/python.md
- Title: "Quickstart: Search for videos using the REST API and Python - Bing Video Search"-
-description: Use this quickstart to send video search requests to the Bing Video Search REST API using Python.
------ Previously updated : 05/22/2020----
-# Quickstart: Search for videos using the Bing Video Search REST API and Python
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple Python application sends an HTTP video search query to the API, and displays the JSON response. Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingVideoSearchv7.py) with additional error handling, and code annotations.
-
-You can run this example as a Jupyter notebook on [MyBinder](https://mybinder.org) by selecting the **launch binder** badge:
-
-[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/Microsoft/cognitive-services-notebooks/master?filepath=BingVideoSearchAPI.ipynb)
--
-## Prerequisites
-
-* Python [2.x or 3.x](https://python.org)
--
-## Initialize the application
-
-1. Create a new Python file in your favorite IDE or editor, and import the following libraries:
-
- ```python
- import requests
- from IPython.display import HTML
- ```
-2. Create variables for your subscription key, search endpoint, and search term. For the `search_url` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- subscription_key = None
- assert subscription_key
- search_url = "https://api.cognitive.microsoft.com/bing/v7.0/videos/search"
- search_term = "kittens"
- ```
-
-3. Add your subscription key to a `Ocp-Apim-Subscription-Key` header by creating a new dictionary to associate the header string to your key.
-
- ```python
- headers = {"Ocp-Apim-Subscription-Key" : subscription_key}
- ```
-
-## Send your request
-
-1. Add the parameters to your request by creating a dictionary named `params`. Add your search terms to the `q` parameter: a video count of 5, `free` for the pricing of returned videos, and `short` for the video length.
-
- ```python
- params = {"q": search_term, "count":5, "pricing": "free", "videoLength":"short"}
- ```
-
-2. Use the `requests` library in Python to call the Bing Video Search API. Pass the API key and search parameters by using the `headers` and `params` dictionary.
-
- ```python
- response = requests.get(search_url, headers=headers, params=params)
- response.raise_for_status()
- search_results = response.json()
- ```
-
-3. To view one of the returned videos, get a search result from the `search_results` object. Insert the result's `embedHtml` property into an `IFrame`.
-
- ```python
- HTML(search_results["value"][0]["embedHtml"].replace("autoplay=1","autoplay=0"))
- ```
--
-## JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/quickstarts/ruby.md
- Title: "Quickstart: Search for videos using the REST API and Ruby - Bing Video Search"-
-description: Use this quickstart to send video search requests to the Bing Video Search REST API using Ruby.
------ Previously updated : 05/22/2020----
-# Quickstart: Search for videos using the Bing Video Search REST API and Ruby
--
-Use this quickstart to make your first call to the Bing Video Search API. This simple Ruby application sends an HTTP video search query to the API, and displays the JSON response. Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-The source code for this sample is available [on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/ruby/Search/BingVideoSearchv7.rb) with additional error handling, and code annotations.
-
-## Prerequisites
-
-* Ruby 2.4 or later
--
-## Create and initialize the application
-
-1. Import the following packages into your code file:
-
- ```ruby
- require 'net/https'
- require 'uri'
- require 'json'
- ```
-
-2. Create variables for the API endpoint, video API search path, your subscription key, and search term. For the `url` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```ruby
- uri = "https://api.cognitive.microsoft.com"
- path = "/bing/v7.0/videos/search"
- term = "kittens"
- accessKey = "your-subscription-key"
- ```
-
-## Create and send an API request
-
-1. Use the variables from the previous step to format a search URL for the request. Combine your uri and path, and then url-encode your search term before appending it to the `?q=` parameter.
-
- ```ruby
- uri = URI(uri + path + "?q=" + URI.escape(term))
- ```
-
-2. Add the complete search URL to the request and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
-
- ``` ruby
- request = Net::HTTP::Get.new(uri)
- request['Ocp-Apim-Subscription-Key'] = accessKey
- ```
-
-3. Send the request, and then save the response.
-
- ```ruby
- response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
- end
- ```
-
-## Process and view the response
-
-After the response is received, print the JSON response.
-
-```ruby
-puts JSON::pretty_generate(JSON(response.body))
-```
-
-## JSON response
-
-A successful response is returned in JSON, as shown in the following example:
-
-```json
-{
- "_type": "Videos",
- "instrumentation": {},
- "readLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?q=kittens",
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens",
- "totalEstimatedMatches": 1000,
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/videos/search?q=kittens&view=...",
- "name": "Top 10 cute kitten videos compilation",
- "description": "HELP HOMELESS ANIMALS AND WIN A PRIZE BY CHOOSING...",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OVP.n1aE_Oikl4MtzBb...",
- "datePublished": "2014-11-12T22:47:36.0000000",
- "publisher": [
- {
- "name": "Fabrikam"
- }
- ],
- "creator": {
- "name": "Marcus Appel"
- },
- "isAccessibleForFree": true,
- "contentUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "hostPageUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "encodingFormat": "h264",
- "hostPageDisplayUrl": "https://www.fabrikam.com/watch?v=8HVWitAW-Qg",
- "width": 480,
- "height": 360,
- "duration": "PT3M52S",
- "motionThumbnailUrl": "https://tse4.mm.bing.net/th?id=OM.j4QyJAENJphdZQ_1501386166&pid=Api",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"https://www.fabrikam.com/embed/8HVWitAW-Qg?autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 7513633,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "videoId": "655D98260D012432848F6558260D012432848F",
- "allowMobileEmbed": true,
- "isSuperfresh": false
- },
- . . .
- ],
- "nextOffset": 36,
- "queryExpansions": [
- {
- "text": "Kittens Meowing",
- "displayText": "Meowing",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Meowing...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Kittens+Meowing&pid..."
- }
- },
- {
- "text": "Funny Kittens",
- "displayText": "Funny",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Funny+Kittens...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Funny+Kittens&..."
- }
- },
- . . .
- ],
- "pivotSuggestions": [
- {
- "pivot": "kittens",
- "suggestions": [
- {
- "text": "Cat",
- "displayText": "Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Cat&pid=Api..."
- }
- },
- {
- "text": "Feral Cat",
- "displayText": "Feral Cat",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Feral+Cat...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search...",
- "thumbnail": {
- "thumbnailUrl": "https://tse3.mm.bing.net/th?q=Feral+Cat&pid=Api&..."
- }
- }
- ]
- }
- ],
- "relatedSearches": [
- {
- "text": "Kittens Being Born",
- "displayText": "Kittens Being Born",
- "webSearchUrl": "https://www.bing.com/videos/search?q=Kittens+Being+Born...",
- "searchLink": "https://api.cognitive.microsoft.com/api/v7/videos/search?...",
- "thumbnail": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?q=Kittens+Being+Born&pid=..."
- }
- },
- . . .
- ]
-}
-```
--
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a single-page web app](../tutorial-bing-video-search-single-page-app.md)
-
-## See also
-
- [What is the Bing Video Search API?](../overview.md)
cognitive-services Trending Videos https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/trending-videos.md
- Title: Search the web for trending videos using the Bing Video Search API-
-description: Learn how to use the Bing Video Search API to search the web for trending videos.
------ Previously updated : 01/31/2019---
-# Get trending videos with the Bing Video Search API
--
-The Bing Video Search API enables you to find today's trending videos from across the web, and in different categories.
-
-## GET request
-
-To get today's trending videos from the Bing Video Search API, send the following GET request:
-
-```cURL
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/trending?mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Market support
-
-The following markets support trending videos.
-
-- en-AU (English, Australia) -- en-CA (English, Canada) -- en-GB (English, Great Britain) -- en-ID (English, Indonesia) -- en-IE (English, Ireland) -- en-IN (English, India) -- en-NZ (English, New Zealand) -- en-PH (English, Philippines) -- en-SG (English, Singapore) -- en-US (English, United States) -- en-WW (English, Worldwide aggregate code) -- en-ZA (English, South Africa) -- zh-CN (Chinese, China)-
-## Example JSON response
-
-The following example shows an API response that contains trending videos, which are listed by category and subcategory. The response also contains banner videos, which are the most popular trending videos, and can come from one or more categories.
-
-```json
-{
- "_type" : "TrendingVideos",
- "bannerTiles" : [
- {
- "query" : {
- "text" : "Hello - Smith",
- "displayText" : "Hello - Smith",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3E8F5..."
- },
- "image" : {
- "description" : "Image from: contosowallpapers.com",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=RsA%2fdPlTmx4zS...",
- "headLine" : "\"Hello\" is a song by...",
- "contentUrl" : "http:\/\/www.contosowallpapers.com\/wp-content..."
- }
- },
- . . .
- ],
- "categories" : [
- {
- "title" : "Music videos",
- "subcategories" : [
- {
- "tiles" : [
- {
- "query" : {
- "text" : "Song Title - Artist Name",
- "displayText" : "Song Title - Artist Name",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3E8F5..."
- },
- "image" : {
- "description" : "Image from: contoso.com",
- "thumbnailUrl" : "https:\/\/tse2.mm.bing.net\/th?id=...",
- "contentUrl" : "http:\/\/images6.contoso.com\/image..."
- }
- },
- . . .
- ],
- "title" : "Top "
- },
- {
- "tiles" : [...],
- "title" : "Trending"
- },
- . . .
- ],
- },
- {
- "title" : "Viral videos",
- "subcategories" : [
- {
- "tiles" : [...],
- "title" : "Trending"
- },
- . . .
- ],
- },
- . . .
- ]
-}
-
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Get video insights](video-insights.md)
cognitive-services Tutorial Bing Video Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/tutorial-bing-video-search-single-page-app.md
- Title: "Tutorial: Build a single-page Bing Video Search app"-
-description: This tutorial explains how to use the Bing Video Search API in a single-page Web application.
------- Previously updated : 02/03/2020---
-# Tutorial: Single-page Video Search app
-
-The Bing Video Search API lets you search the Web and get video results relevant to a search query. In this tutorial, we build a single-page Web application that uses the Bing search API to display search results on the page. The application includes HTML, CSS, and JavaScript components.
-
-<!-- Remove until it can be replaced with a sanitized version.
-![Single-page Bing Video Search app](./media/video-search-singlepage.png)
>-
-> [!NOTE]
-> The JSON and HTTP headings at the bottom of the page when clicked show the JSON response and HTTP request information. These details can be useful when exploring the service.
-
-![JSON, HTTP raw results](./media/json-http-raw-results.png)
-
-This tutorial app illustrates how to:
-> [!div class="checklist"]
-> * Perform a Bing Video Search API call in JavaScript
-> * Pass search options to the Bing Search API
-> * Display video search results or to optionally include Web pages, news, or images
-> * Search time-frames of 24 hours, the past week, month, or all available time
-> * Page through search results
-> * Handle the Bing client ID and API subscription key
-> * Handle errors that might occur
-
-The tutorial page is entirely self-contained; it does not use any external frameworks, style sheets, or image files. It uses only widely supported JavaScript language features and works with current versions of all major Web browsers.
-
-In this tutorial, we discuss selected portions of the source code. The complete [source code]() is available. To run the example, copy and paste the source code into a text editor and save it as `bing.html`.
-
-## App components
-Like any single-page Web app, this tutorial application includes three parts:
-
-> [!div class="checklist"]
-> * HTML - Defines the structure and content of the page
-> * CSS - Defines the appearance of the page
-> * JavaScript - Defines the behavior of the page
-
-Most of the HTML and CSS is conventional, so the tutorial doesn't discuss it. The HTML contains the search form in which the user enters a query and chooses search options. The form is connected to JavaScript that does the search using the `onsubmit` attribute of the `<form>` tag:
-
-```html
-<form name="bing" onsubmit="return bingWebSearch(this)">
-```
-The `onsubmit` handler returns `false`, which keeps the form from being submitted to a server. The JavaScript code does the work of collecting the necessary information from the form and performing the search.
-
-The HTML also contains the divisions (HTML `<div>` tags) where the search results appear.
-
-## Managing subscription key
-
-To avoid having to include the Bing Search API subscription key in the code, we use the browser's persistent storage to store the key. Before the key is stored, we prompt for the user's key. If the key is later rejected by the API, we invalidate the stored key so the user will be prompted again.
-
-We define `storeValue` and `retrieveValue` functions that use either the `localStorage` object (not all browsers support it) or a cookie. The `getSubscriptionKey()` function uses these functions to store and retrieve the user's key.
-
-``` javascript
-// Cookie names for data we store
-API_KEY_COOKIE = "bing-search-api-key";
-CLIENT_ID_COOKIE = "bing-search-client-id";
-
-// ... omitted definitions of store value and retrieve value
-// Browsers differ in their support for persistent storage by
-// local HTML files. See the source code for browser-specific
-// options.
-
-// Get stored API subscription key, or prompt if it's not found.
-function getSubscriptionKey() {
- var key = retrieveValue(API_KEY_COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Search API subscription key:", "").trim();
- }
- // always set the cookie in order to update the expiration date
- storeValue(API_KEY_COOKIE, key);
- return key;
-}
-```
-The HTML `<form>` tag `onsubmit` calls the `bingWebSearch` function to return search results. `bingWebSearch` uses `getSubscriptionKey()` to authenticate each query. As shown in the previous definition, `getSubscriptionKey` prompts the user for the key if the key hasn't been entered. The key is then stored for continuing use by the application.
-
-```html
-<form name="bing" onsubmit="this.offset.value = 0; return bingWebSearch(this.query.value,
- bingSearchOptions(this), getSubscriptionKey())">
-```
-## Selecting search options
-The following figure shows the query text box and options that define a search.
-
-![Bing News Search options](media/video-search-options.png)
-
-The HTML form includes elements with the following names:
-
-|Element|Description|
-|-|-|
-| `where` | A drop-down menu for selecting the market (location and language) used for the search. |
-| `query` | The text field to enter the search terms. |
-| `modules` | Checkboxes for promoting particular modules of results, all results or related videos. |
-| `when` | Drop-down menu for optionally limiting the search to the most recent day, week, or month. |
-| `safe` | A checkbox indicating whether to use the Bing SafeSearch feature to filter out "adult" results. |
-| `count` | Hidden field. The number of search results to return on each request. Change to display fewer or more results per page. |
-| `offset`| Hidden field. The offset of the first search result in the request; used for paging. It's reset to `0` on a new request. |
-
-> [!NOTE]
-> Bing Web Search offers other query parameters. We're using only a few of them.
-
-``` javascript
-// build query options from the HTML form
-// build query options from the HTML form
-function bingSearchOptions(form) {
-
- var options = [];
- options.push("mkt=" + form.where.value);
- options.push("SafeSearch=" + (form.safe.checked ? "strict" : "moderate"));
-
- if (form.when.value.length) options.push("freshness=" + form.when.value);
- var what = [];
- for (var i = 0; i < form.what.length; i++)
- if (form.what[i].checked) what.push(form.what[i].value);
- if (what.length) {
- options.push("modules=" + what.join(","));
- options.push("answerCount=9");
- }
- options.push("count=" + form.count.value);
- options.push("offset=" + form.offset.value);
- options.push("textDecorations=true");
- options.push("textFormat=HTML");
- return options.join("&");
-}
-```
-
-For example, the `SafeSearch` parameter in an actual API call can be `strict`, or `moderate`, with `moderate` being the default.
-
-## Performing the request
-Given the query, the options string, and the API key, the `BingWebSearch` function uses an `XMLHttpRequest` object to make the request to the Bing Search endpoint. You can use the global endpoint below, or the [custom subdomain](../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```javascript
-// Search on the query, using search options, authenticated by the key.
-function bingWebSearch(query, options, key) {
-
- // scroll to top of window
- window.scrollTo(0, 0);
- if (!query.trim().length) return false; // empty query, do nothing
-
- showDiv("noresults", "Working. Please wait.");
- hideDivs("pole", "mainline", "sidebar", "_json", "_headers", "paging1", "paging2", "error");
-
- var endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/videos/search";
- var request = new XMLHttpRequest();
- var queryurl = endpoint + "?q=" + encodeURIComponent(query) + "&" + options;
-
- try {
- request.open("GET", queryurl);
- }
- catch (e) {
- renderErrorMessage("Bad request (invalid URL)\n" + queryurl);
- return false;
- }
-
- // add request headers
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
- request.setRequestHeader("Accept", "application/json");
- var clientid = retrieveValue(CLIENT_ID_COOKIE);
- if (clientid) request.setRequestHeader("X-MSEdge-ClientID", clientid);
-
- // event handler for successful response
- request.addEventListener("load", handleOnLoad);
-
- // event handler for erorrs
- request.addEventListener("error", function() {
- renderErrorMessage("Error completing request");
- });
-
- // event handler for aborted request
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-
- // send the request
- request.send();
- return false;
-}
-```
-On successful completion of the HTTP request, JavaScript calls the `load` event handler, `handleOnLoad()`, to handle a successful HTTP GET request to the API.
-
-```javascript
-// handle Bing search request results
-function handleOnLoad() {
- hideDivs("noresults");
-
- var json = this.responseText.trim();
- var jsobj = {};
-
- // try to parse JSON results
- try {
- if (json.length) jsobj = JSON.parse(json);
- } catch(e) {
- renderErrorMessage("Invalid JSON response");
- }
-
- // show raw JSON and headers
- showDiv("json", preFormat(JSON.stringify(jsobj, null, 2)));
- showDiv("http", preFormat("GET " + this.responseURL + "\n\nStatus: " + this.status + " " +
- this.statusText + "\n" + this.getAllResponseHeaders()));
-
- // if HTTP response is 200 OK, try to render search results
- if (this.status === 200) {
- var clientid = this.getResponseHeader("X-MSEdge-ClientID");
- if (clientid) retrieveValue(CLIENT_ID_COOKIE, clientid);
- if (json.length) {
- if (jsobj._type === "Videos") {//"SearchResponse" && "rankingResponse" in jsobj) {
- renderSearchResults(jsobj);
- } else {
- renderErrorMessage("No search results in JSON response");
- }
- } else {
- renderErrorMessage("Empty response (are you sending too many requests too quickly?)");
- }
- }
-
- // Any other HTTP response is an error
- else {
- // 401 is unauthorized; force re-prompt for API key for next request
- if (this.status === 401) invalidateSubscriptionKey();
-
- // some error responses don't have a top-level errors object, so gin one up
- var errors = jsobj.errors || [jsobj];
- var errmsg = [];
-
- // display HTTP status code
- errmsg.push("HTTP Status " + this.status + " " + this.statusText + "\n");
-
- // add all fields from all error responses
- for (var i = 0; i < errors.length; i++) {
- if (i) errmsg.push("\n");
- for (var k in errors[i]) errmsg.push(k + ": " + errors[i][k]);
- }
-
- // also display Bing Trace ID if it isn't blocked by CORS
- var traceid = this.getResponseHeader("BingAPIs-TraceId");
- if (traceid) errmsg.push("\nTrace ID " + traceid);
-
- // and display the error message
- renderErrorMessage(errmsg.join("\n"));
- }
-}
-```
-
-> [!IMPORTANT]
-> If an error occurs in the search operation, the Bing News Search API returns a non-200 HTTP status code and includes error information in the JSON response. Additionally, if the request was rate-limited, the API returns an empty response.
-A successful HTTP request does *not* necessarily mean that the search itself succeeded.
-
-Much of the code in both of the preceding functions is dedicated to error handling. Errors may occur at the following stages:
-
-|Stage|Potential error(s)|Handled by|
-|-|-|-|
-|Building the JavaScript request object|Invalid URL|`try`/`catch` block|
-|Making the request|Network errors, aborted connections|`error` and `abort` event handlers|
-|Performing the search|Invalid request, invalid JSON, rate limits|tests in `load` event handler|
-
-Errors are handled by calling `renderErrorMessage()` with any details known about the error. If the response passes the full gauntlet of error tests, we call `renderSearchResults()` to display the search results in the page.
-
-## Displaying search results
-The main function for displaying the search results is `renderSearchResults()`. This function takes the JSON returned by the Bing News Search service and renders the news results and the related searches, if any.
-
-```javascript
-// render the search results given the parsed JSON response
-function renderSearchResults(results) {
-
- // add Prev / Next links with result count
- var pagingLinks = renderPagingLinks(results);
- showDiv("paging1", pagingLinks);
- showDiv("paging2", pagingLinks);
-
- // Render the results to the mainline section
- for (section in { mainline: 0 }) {
- showDiv(section, renderResultsItems(section, results));
- }
-}
-```
-The search results are returned as the top-level `value` object in the JSON response. We pass them to our function `renderResultsItems()`, which iterates through them and calls a function to render each item into HTML.
-The resulting HTML is returned to `renderSearchResults()`, where it is inserted into the `results` division in the page.
-
-```javascript
-// render search results
- function renderResultsItems(section, results) {
-
- var items = results.value;
- var html = [];
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- // collection name has lowercase first letter
- var type = "videos";
- var render = searchItemRenderers[type];
- html.push(render(item, section));
- }
- return html.join("\n\n");
-}
-```
-
-The Bing News Search API returns up to four different kinds of related results, each in its own top-level object. They are:
-
-|Relation|Description|
-|-|-|
-|`pivotSuggestions`|Queries that replace a pivot word in original search with a different one. For example, if you search for "red flowers," a pivot word might be "red," and a pivot suggestion might be "yellow flowers."|
-|`queryExpansions`|Queries that narrow the original search by adding more terms. For example, if you search for "Microsoft Surface," a query expansion might be "Microsoft Surface Pro."|
-|`relatedSearches`|Queries that have also been entered by other users who entered the original search. For example, if you search for "Mount Rainier," a related search might be "Mt. Saint Helens."|
-|`similarTerms`|Queries that are similar in meaning to the original search. For example, if you search for "schools," a similar term might be "education."|
-
-As previously seen in `renderSearchResults()`, we render only the `relatedItems` suggestions and place the resulting links in the page's sidebar.
-
-## Rendering result items
-
-In the JavaScript code the object, `searchItemRenderers`, can contains *renderers:* functions that generate HTML for each kind of search result. The video search page only uses `videos`. See other tutorials for various types of renderers.
-
-```javascript
-searchItemRenderers = {
- news: function(item) { ... },
- webPages: function (item) { ... },
- images: function(item, index, count) { ... },
- videos: function (item, section, index, count) { ... },
- relatedSearches: function(item) { ... }
-}
-```
-A renderer function can accept the following parameters:
-
-|Parameter|Description|
-|-|-|
-|`item`| The JavaScript object containing the item's properties, such as its URL and its description.|
-|`index`| The index of the result item within its collection.|
-|`count`| The number of items in the search result item's collection.|
-
-The `index` and `count` parameters can be used to number results, to generate special HTML for the beginning or end of a collection, to insert line breaks after a certain number of items, and so on. If a renderer does not need this functionality, it does not need to accept these two parameters.
-
-The `video` renderer is shown in the following JavaScript excerpt. Using the Videos endpoint, all results are of type `Videos`. The `searchItemRenderers` are shown in the following code segment.
-
-```javascript
-// render functions for various types of search results
- searchItemRenderers = {
-
- videos: function (item, section, index, count) {
- var height = 60;
- var width = Math.round(height * item.thumbnail.width / item.thumbnail.height);
- var html = [];
-
- html.push("<p class='images'>");
- html.push("<a href='" + item.hostPageUrl + "'>");
- var title = escapeQuotes(item.name) + "\n" + getHost(item.hostPageDisplayUrl);
- html.push("<img src='" + item.thumbnailUrl + "&h=" + height + "&w=" + width +
- "' height=" + height + " width=" + width + " title='" + title + "' alt='" + title + "'>");
- html.push("</a>");
- html.push("<br>");
- html.push("<nobr><a href='" + item.contentUrl + "'>Video page source</a> - ");
- html.push(title.replace("\n", " (").replace(/([a-z0-9])\.([a-z0-9])/g, "$1.<wbr>$2") + ")</p>");
- return html.join("");
- }
-}
-```
-
-The renderer function:
-> [!div class="checklist"]
-> * Creates a paragraph tag, assigns it to the `images` class, and pushes it to the html array.
-> * Calculates image thumbnail size (width is fixed at 60 pixels, height calculated proportionately).
-> * Builds the HTML `<img>` tag to display the image thumbnail.
-> * Builds the HTML `<a>` tags that link to the image and the page that contains it.
-> * Builds the description that displays information about the image and the site it's on.
-
-The thumbnail size is used in both the `<img>` tag and the `h` and `w` fields in the thumbnail's URL. Bing will return a [thumbnail](../bing-web-search/resize-and-crop-thumbnails.md) of exactly that size.
-
-## Persisting client ID
-Responses from the Bing search APIs may include an `X-MSEdge-ClientID` header that should be sent back to the API with successive requests. If multiple Bing Search APIs are being used, the same client ID should be used with all of them, if possible.
-
-Providing the `X-MSEdge-ClientID` header allows the Bing APIs to associate all of a user's searches, which has two important benefits.
-
-First, it allows the Bing search engine to apply past context to searches to find results that better satisfy the user. If a user has previously searched for terms related to sailing, for example, a later search for "knots" might preferentially return information about knots used in sailing.
-
-Second, Bing may randomly select users to experience new features before they are made widely available. Providing the same client ID with each request ensures that users who see the feature always see it. Without the client ID, the user might see a feature appear and disappear, seemingly at random, in their search results.
-
-Browser security policies (CORS) may prevent the `X-MSEdge-ClientID` header from being available to JavaScript. This limitation occurs when the search response has a different origin from the page that requested it. In a production environment, you should address this policy by hosting a server-side script that does the API call on the same domain as the Web page. Since the script has the same origin as the Web page, the `X-MSEdge-ClientID` header is then available to JavaScript.
-
-> [!NOTE]
-> In a production Web application, you should perform the request server-side. Otherwise, your Bing Search API key must be included in the Web page, where it is available to anyone who views source. You are billed for all usage under your API subscription key, even requests made by unauthorized parties, so it is important not to expose your key.
-
-For development purposes, you can make the Bing Web Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that allows response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our tutorial app to access the client ID header. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then issue the following command in a command window:
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Next steps
-> [!div class="nextstepaction"]
-> [Bing Video Search API reference](/rest/api/cognitiveservices/bing-video-api-v7-reference)
cognitive-services Video Insights https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Video-Search/video-insights.md
- Title: Get video insights using the Bing Video Search API-
-description: Learn how to use the Bing Video Search API to get more information about videos, such as related videos.
------- Previously updated : 01/31/2019---
-# Get insights about a video
--
-Each video returned by the Bing Video Search API includes a video ID that you can use to get more information about it, such as related videos. To get insights about a video, get its [videoId](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video-videoid) token in the API response.
-
-```json
- "value" : [
- {
- . . .
- "name" : "How to sail - What to Wear for Dinghy Sailing",
- "description" : "An informative video on what to wear...",
- "contentUrl" : "https:\/\/www.fabrikam.com\/watch?v=vzmPjHBZ--g",
- "videoId" : "6DB795E11A6E3CBAAD636DB795E11A6E3CBAAD63",
- . . .
- }
- ],
-```
-
-Afterwards, send a GET request to the Video details endpoint with the ID. Set the [id](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#id) query parameter to the `videoId` token. To specify the insights that you want to get, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#modulesrequested) query parameter. To get all insights, set `modules` to All. The response includes all the insights that you requested, if available.
-
-```cURL
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/details?q=sailiing+dinghies&id=6DB795E11A6E3CBAAD636DB795E11A6E3CBAAD63&modules=All&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-## Getting related videos insights
-
-To get videos that are related to the specified video, set the [modules](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#modulesrequested) query parameter to `RelatedVideos`.
-
-```cURL
-GET https://api.cognitive.microsoft.com/bing/v7.0/videos/details?q=sailiing+dinghies&id=6DB795E11A6E3CBAAD636DB795E11A6E3CBAAD63&modules=RelatedVideos&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The response to this request will have a top-level [VideoDetails](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videodetails) object instead of a [Videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) object.
-
-```json
-{
- "_type" : "Api.VideoDetails.VideoDetails",
- "relatedVideos" : {
- "value" : [
- {
- "name" : "How to sail - Reefing a Sail",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=7284B07...",
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?id=OVP.zt...",
- "datePublished" : "2014-03-04T16:11:09",
- "publisher" : [
- {
- "name" : "Fabrikam"
- }
- ],
- "contentUrl" : "https:\/\/www.fabrikam.com\/watch?v=...",
- "hostPageUrl" : "https:\/\/www.bing.com\/cr?IG=7284B07...",
- "hostPageDisplayUrl" : "https:\/\/www.fabrikam.com\/watch?...",
- "duration" : "PT4M56S",
- "motionThumbnailUrl" : "https:\/\/tse1.mm.bing.net\/th?id=OM...",
- "allowHttpsEmbed" : true,
- "viewCount" : 21756,
- "videoId" : "AC1A157A4DDB571D03D6AC157A4DDB571D03D6",
- "allowMobileEmbed" : false,
- "isSuperfresh" : false
- },
- . . .
- ]
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Search for trending videos](trending-videos.md)
cognitive-services Autosuggest Bing Search Terms https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/autosuggest-bing-search-terms.md
- Title: Autosuggest search terms - Bing Web Search API-
-description: Pair the Bing Web Search API with the Bing Autosuggest API to provide users with an enhanced search experience.
------ Previously updated : 03/03/2019---
-# Autosuggest Bing search terms in your application
--
-If you provide a search box where the user enters their search term, use the [Bing Autosuggest API](../bing-autosuggest/get-suggested-search-terms.md) to improve the experience. The API returns suggested query strings based on partial search terms as the user types.
-
-After the user enters a search term, it must be URL encoded before the [q](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#query) query parameter is set. For example, if the user enters *sailing dinghies*, set `q` to `sailing+dinghies` or `sailing%20dinghies`.
-
-If the query term contains a spelling mistake, the search response includes a [QueryContext](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#querycontext) object. The object shows the original spelling and the corrected spelling that Bing used for the search.
-
-```json
-"queryContext": {
- "originalQuery": "sialing dingy for sale",
- "alteredQuery": "sailing dinghy for sale",
- "alterationOverrideQuery": "+sialing +dingy for sale"
-}
-```
-
-You can use this information to let the user know that you modified their query string when you display the search results.
-
-![Query context UX example](./media/cognitive-services-bing-web-api/bing-query-context.PNG)
-
-## Next steps
-
-* Review sample [Bing Web Search API responses](search-responses.md).
-
-## See also
-
-* [Bing Web Search API reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference)
cognitive-services Bing Api Comparison https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/bing-api-comparison.md
- Title: What are the Bing Search APIs?-
-description: Use this article to learn about the Bing Search APIs, and how you can enable cognitive internet searches in your apps and services.
------ Previously updated : 03/12/2019---
-# What are the Bing Search APIs?
--
-The Bing Search APIs let you build web-connected apps and services that find webpages, images, news, locations, and more without advertisements. By sending search requests using the Bing Search REST APIs or SDKs, you can get relevant information and content for web searches. Use this article to learn about the different Bing search APIs and how you can integrate cognitive searches into your applications and services. Pricing and rate limits may vary between APIs.
-
-## The Bing Web Search API
-
-The [Bing Web Search API](../bing-web-search/overview.md) returns webpages, images, video, news, and more. You can filter the search queries sent to this API to include or exclude certain content types.
-
-Consider using the Bing Web Search API in applications that may need to search for all types of relevant web content. If your application searches for a specific type of online content, consider one of the search APIs below:
-
-## Content-specific Bing search APIs
-
-The following Bing search APIs return specific content from the web like images, news, local businesses, and videos.
-
-| Bing API | Description |
-| -- | -- |
-| [Entity Search](../bing-entities-search/overview.md) | The Bing Entity Search API returns search results containing entities, which can be people, places, or things. Depending on the query, the API will return one or more entities that satisfy the search query. The search query can include noteworthy individuals, local businesses, landmarks, destinations, and more. |
-| [Image Search](../bing-image-search/overview.md) | The Bing Image Search API lets you search for and find high-quality static and animated images similar to [Bing.com/images](https://www.Bing.com/images). You can refine searches to include or exclude images by attribute, including size, color, license, and freshness. You can also search for trending images, upload images to gain insights about them, and display thumbnail previews. |
-| [News Search](../bing-news-search/search-the-web.md) | The Bing News Search API lets you find news stories similar to [Bing.com/news](https://www.Bing.com/news). The API returns news articles from either multiple sources or specific domains. You can search across categories to get trending articles, top stories, and headlines. |
-| [Video Search](../bing-video-search/overview.md) | The Bing Video Search API lets you find videos across the web. Get trending videos, related content, and thumbnail previews. |
-| [Visual Search](../Bing-visual-search/overview.md) | Upload an image or use a URL to get insightful information about it, like visually similar products, images, and related searches. |
- [Local Business Search](../bing-local-business-search/overview.md) | The Bing Local Business Search API lets your applications find contact and location information about local businesses based on search queries. |
-
-## The Bing Custom Search API
-
-Creating a custom search instance with the [Bing Custom Search](../bing-custom-search/overview.md) API lets you create a search experience focused only on content and topics you care about. For example, after you specify the domains, websites, and specific webpages that Bing will search, Bing Custom Search will tailor the results to that specific content. You can incorporate the Bing Custom Autosuggest, Image, and Video Search APIs to further customize your search experience.
-
-## Additional Bing Search APIs
-
-The following Bing Search APIs let you improve your search experience by combining them with other Bing search APIs.
-
-| API | Description |
-| -- | -- |
-| [Bing Autosuggest](../bing-autosuggest/get-suggested-search-terms.md) | Improve your application's search experience with the Bing Autosuggest API by returning suggested searches in real time. |
-| [Bing Statistics](bing-web-stats.md) | Bing Statistics provides analytics for the Bing Search APIs your application uses. Some of the available analytics include call volume, top query strings, and geographic distribution. |
-
-## Next steps
-
-* Bing Search API [pricing details](https://azure.microsoft.com/pricing/details/cognitive-services/search-api/)
-* The [Bing Use and Display Requirements](./use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
cognitive-services Bing Web Stats https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/bing-web-stats.md
- Title: Add analytics to the Bing Web Search API-
-description: Bing Statistics provides analytics to the Bing Image Search API. Analytics include call volume, top query strings, geographic distribution, and more.
------ Previously updated : 07/17/2019----
-# Add analytics to the Bing Search APIs
--
-Bing Statistics provides analytics for the Bing Search APIs. These analytics include call volume, top query strings, geographic distribution, and more. You can enable Bing Statistics in the [Azure portal](https://portal.azure.com) by navigating to your Azure resource and clicking **Enable Bing Statistics**.
-
-> [!IMPORTANT]
-> * Bing Statistics is not available with resources on the free `F0` pricing tier.
-> * You may not use any data available via the Bing Statistics dashboard to create applications for distribution to third parties.
-> * Enabling Bing Statistics increases your subscription rate slightly. See [pricing](https://aka.ms/bingstatisticspricing) for details.
--
-The following image shows the available analytics for each Bing Search API endpoint.
-
-![Distribution by endpoint support matrix](./media/bing-statistics/bing-statistics-matrix.png)
-
-## Access your analytics
-
-Bing updates analytics data every 24 hours and maintains up to 13 months' worth of history that you can access from the [analytics dashboard](https://bingapistatistics.com). Make sure you're signed in using the same Microsoft account (MSA) you used to sign up for Bing Statistics.
-
-> [!NOTE]
-> * It may take up to 24 hours for metrics to surface on the dashboard. The dashboard shows the date and time the data was last updated.
-> * Metrics are available from the time you enable the Bing Statistics Add-in.
-
-## Filter the data
-
-By default, the charts and graphs display all metrics and data that you have access to. You can filter the data shown in the charts and graphs by selecting the resources, markets, endpoints, and reporting period you're interested in. You can change the following filters:
--- **Resource ID**: The unique resource ID that identifies your Azure subscription. The list contains multiple IDs if you subscribe to more than one Bing Search API tier. By default, all resources are selected.
-
-- **Markets**: The markets where the results come from. For example, en-us (English, United States). By default, all markets are selected. The `en-WW` market is the market that Bing uses if the call does not specify a market and Bing is unable to determine the user's market.
-
-- **Endpoints**: The Bing Search API endpoints. The list contains all endpoints for which you have a paid subscription. By default, all endpoints are selected. --- **Time Frame**: The reporting period. You can specify:
- - **All**: Includes up to 13 months' worth of data
- - **Past 24 hours**: Includes analytics from the last 24 hours
- - **Past week**: Includes analytics from the previous 7 days
- - **Past month**: Includes analytics from the previous 30 days
- - **A custom date range**: Includes analytics from the specified date range, if available
-
-## Charts and graphs
-
-The dashboard shows charts and graphs of the metrics available for the selected endpoint. Not all metrics are available for all endpoints. The charts and graphs for each endpoint are static (you may not select the charts and graphs to display). The dashboard shows only charts and graphs for which there's data.
-
-<!--
-For example, if you don't include the User-Agent header in your calls, the dashboard will not include device-related graphs.
>-
-The following are possible metrics and endpoint restrictions.
--- **Call Volume**: Shows the number of calls made during the reporting period. If the reporting period is for a day, the chart shows the number of calls made per hour. Otherwise, the chart shows the number of calls made per day of the reporting period.
-
- > [!NOTE]
- > The call volume may differ from billing reports, which generally includes only successful calls.
--- **Top Queries**: Shows the top queries and the number of occurrences of each query during the reporting period. You can configure the number of queries shown. For example, you can show the top 25, 50, or 75 queries. Top Queries is not available for the following endpoints: -
- - /images/trending
- - /images/details
- - /images/visualsearch
- - /videos/trending
- - /videos/details
- - /news
- - /news/trendingtopics
- - /suggestions
-
- > [!NOTE]
- > Some query terms may be suppressed to remove confidential information such as emails, telephone numbers, SSN, etc.
--- **Geographic Distribution**: The markets where search results originate. For example, `en-us` (English, United States). Bing uses the `mkt` query parameter to determine the market, if specified. Otherwise, Bing uses signals such as the caller's IP address to determine the market.--- **Response Code Distribution**: The HTTP status codes of all calls during the reporting period.--- **Call Origin Distribution**: The types of browsers used by the users. For example, Microsoft Edge, Chrome, Safari, and FireFox. Calls made from outside a browser (such as bots, Postman, or using curl from a console app) are grouped under Libraries. The origin is determined using the request's User-Agent header value. If the request doesn't include the User-Agent header, Bing tries to derive the origin from other signals. --- **Safe Search Distribution**: The distribution of safe search values. For example, off, moderate, or strict. The `safeSearch` query parameter contains the value, if specified. Otherwise, Bing defaults the value to moderate. --- **Answers Requested Distribution**: The Web Search API answers that you requested in the `responseFilter` query parameter. --- **Answers Returned Distribution**: The answers that Web Search API returned in the response.--- **Response Server Distribution**: The application server that served your API requests. The possible values are Bing.com (for traffic served from desktop and laptop devices) and Bing.com-mobile (for traffic served from mobile devices). The server is determined using the request's User-Agent header value. If the request doesn't include the User-Agent header, Bing tries to derive the server from other signals.-
-## Next steps
-
-* [What are the Bing Search APIs?](bing-api-comparison.md)
-* [Bing Search API use and display requirements](use-display-requirements.md)
cognitive-services Bing Web Upgrade Guide V5 To V7 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/bing-web-upgrade-guide-v5-to-v7.md
- Title: Upgrade from API v5 to v7 - Bing Web Search API-
-description: Determine which parts of your application require updates to use the Bing Web Search v7 APIs.
------ Previously updated : 02/12/2019---
-# Upgrade from Bing Web Search API v5 to v7
--
-This upgrade guide identifies the changes between version 5 and version 7 of the Bing Web Search API. Use this guide to help you identify the parts of your application that you need to update to use version 7.
-
-## Breaking changes
-
-### Endpoints
--- The endpoint's version number has changed from v5 to v7. For example, https:\/\/api.cognitive.microsoft.com/bing/**v7.0**/search.-
-### Error response objects and error codes
--- All failed requests should now include an `ErrorResponse` object in the response body.--- Added the following fields to the `Error` object.
- - `subCode`&mdash;Partitions the error code into discrete buckets, if possible
- - `moreDetails`&mdash;Additional information about the error described in the `message` field
---- Replaced the v5 error codes with the following possible `code` and `subCode` values.-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|Bing returns ServerError whenever any of the subcode conditions occur. The response will include these errors if the HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If the error is HttpNotAllowed, the HTTP status code 410.
-|RateLimitExceeded||Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>Bing returns HTTP status code 429 if you exceeded QPS and 403 if you exceeded QPM.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This error can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
--- The following maps the previous error codes to the new codes. If you've taken a dependency on v5 error codes, update your code accordingly.-
-|Version 5 code|Version 7 code.subCode
-|-|-
-|RequestParameterMissing|InvalidRequest.ParameterMissing
-RequestParameterInvalidValue|InvalidRequest.ParameterInvalidValue
-ResourceAccessDenied|InsufficientAuthorization
-ExceededVolume|RateLimitExceeded
-ExceededQpsLimit|RateLimitExceeded
-Disabled|InsufficientAuthorization.AuthorizationDisabled
-UnexpectedError|ServerError.UnexpectedError
-DataSourceErrors|ServerError.ResourceError
-AuthorizationMissing|InvalidAuthorization.AuthorizationMissing
-HttpNotAllowed|InvalidRequest.HttpNotAllowed
-UserAgentMissing|InvalidRequest.ParameterMissing
-NotImplemented|ServerError.NotImplemented
-InvalidAuthorization|InvalidAuthorization
-InvalidAuthorizationMethod|InvalidAuthorization
-MultipleAuthorizationMethod|InvalidAuthorization.AuthorizationRedundancy
-ExpiredAuthorizationToken|InsufficientAuthorization.AuthorizationExpired
-InsufficientScope|InsufficientAuthorization
-Blocked|InvalidRequest.Blocked
--
-## Non-breaking changes
-
-### Headers
--- Added the optional [Pragma](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#pragma) request header. By default, Bing returns cached content, if available. To prevent Bing from returning cached content, set the Pragma header to no-cache (for example, Pragma: no-cache).-
-### Query parameters
--- Added the [answerCount](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#answercount) query parameter. Use this parameter to specify the number of answers that you want the response to include. The answers are chosen based on ranking. For example, if you set this parameter to three (3), the response includes the top three ranked answers. --- Added the [promote](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#promote) query parameter. Use this parameter along with `answerCount` to explicitly include one or more answer types, regardless of their ranking. For example, to promote videos and images into the response, you'd set promote to *videos, images*. The list of answers that you want to promote does not count against the `answerCount` limit. For example, if `answerCount` is 2 and `promote` is set to *videos, images*, the response might include webpages, news, videos, and images.-
-### Object changes
--- Added the `someResultsRemoved` field to the [WebAnswer](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#webanswer) object. The field contains a Boolean value that indicates whether the response excluded some results from the web answer.
cognitive-services Csharp Ranking Tutorial https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/csharp-ranking-tutorial.md
- Title: Using rank to display search results-
-description: Shows how to use the Bing RankingResponse answer to display search results in rank order.
------ Previously updated : 06/24/2020----
-# Build a console app search client in C#
--
-This tutorial shows how to build a simple .NET Core console app that allows users to query the Bing Web Search API and display ranked results.
-
-This tutorial shows how to:
--- Make a simple query to the Bing Web Search API-- Display query results in ranked order-
-## Prerequisites
-
-To follow along with the tutorial, you need:
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-* The [Visual Studio IDE](https://www.visualstudio.com/downloads/).
-
-## Create a new Console App project
-
-In Visual Studio, create a project with `Ctrl`+`Shift`+`N`.
-
-In the **New Project** dialog, click **Visual C# > Windows Classic Desktop > Console App (.NET Framework)**.
-
-Name the application **MyConsoleSearchApp**, and then click **OK**.
-
-## Add the JSON.net NuGet package to the project
-
-JSON.net allows you to work with the JSON responses returned by the API. Add its NuGet package to your project:
--- In **Solution Explorer** right-click on the project and select **Manage NuGet Packages...**.-- On the **Browse** tab, search for `Newtonsoft.Json`. Select the latest version, and then click **Install**.-- Click the **OK** button on the **Review Changes** window.-- Close the Visual Studio tab titled **NuGet: MyConsoleSearchApp**.-
-## Add a reference to System.Web
-
-This tutorial relies on the `System.Web` assembly. Add a reference to this assembly to your project:
--- In **Solution Explorer**, right-click on **References** and select **Add Reference...**-- Select **Assemblies > Framework**, then scroll down and check **System.Web**-- Select **OK**-
-## Add some necessary using statements
-
-The code in this tutorial requires three additional using statements. Add these statements below the existing `using` statements at the top of **Program.cs**:
-
-```csharp
-using System.Web;
-using System.Net.Http;
-```
-
-## Ask the user for a query
-
-In **Solution Explorer**, open **Program.cs**. Update the `Main()` method:
-
-```csharp
-static void Main()
-{
- // Get the user's query
- Console.Write("Enter Bing query: ");
- string userQuery = Console.ReadLine();
- Console.WriteLine();
-
- // Run the query and display the results
- RunQueryAndDisplayResults(userQuery);
-
- // Prevent the console window from closing immediately
- Console.WriteLine("\nHit ENTER to exit...");
- Console.ReadLine();
-}
-```
-
-This method:
--- Asks the user for a query-- Calls `RunQueryAndDisplayResults(userQuery)` to execute the query and display the results-- Waits for user input in order to prevent the console window from immediately closing.-
-## Search for query results using the Bing Web Search API
-
-Next, add a method that queries the API and displays the results:
-
-```csharp
-static void RunQueryAndDisplayResults(string userQuery)
-{
- try
- {
- // Create a query
- var client = new HttpClient();
- client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "<YOUR_SUBSCRIPTION_KEY_GOES_HERE>");
- var queryString = HttpUtility.ParseQueryString(string.Empty);
- queryString["q"] = userQuery;
- var query = "https://api.cognitive.microsoft.com/bing/v7.0/search?" + queryString;
-
- // Run the query
- HttpResponseMessage httpResponseMessage = client.GetAsync(query).Result;
-
- // Deserialize the response content
- var responseContentString = httpResponseMessage.Content.ReadAsStringAsync().Result;
- Newtonsoft.Json.Linq.JObject responseObjects = Newtonsoft.Json.Linq.JObject.Parse(responseContentString);
-
- // Handle success and error codes
- if (httpResponseMessage.IsSuccessStatusCode)
- {
- DisplayAllRankedResults(responseObjects);
- }
- else
- {
- Console.WriteLine($"HTTP error status code: {httpResponseMessage.StatusCode.ToString()}");
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
-}
-```
-
-This method:
--- Creates an `HttpClient` to query the Web Search API-- Sets the `Ocp-Apim-Subscription-Key` HTTP header, which Bing uses to authenticate the request-- Executes the request and uses JSON.net to deserialize the results-- Calls `DisplayAllRankedResults(responseObjects)` to display all results in ranked order-
-Make sure to set the value of `Ocp-Apim-Subscription-Key` to your subscription key.
-
-## Display ranked results
-
-Before showing how to display the results in ranked order, take a look at a sample web search response:
-
-```json
-{
- "_type" : "SearchResponse",
- "webPages" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=70BE289346...",
- "totalEstimatedMatches" : 982000,
- "value" : [{
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.0",
- "name" : "Contoso Sailing Club - Seattle",
- "url" : "https:\/\/www.bing.com\/cr?IG=70BE289346ED4594874FE...",
- "displayUrl" : "https:\/\/contososailingsea...",
- "snippet" : "Come sail with Contoso in Seattle...",
- "dateLastCrawled" : "2017-04-07T02:25:00"
- },
- {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/7\/#WebPages.6",
- "name" : "Contoso Sailing Lessons - Official Site",
- "url" : "http:\/\/www.bing.com\/cr?IG=70BE289346ED4594874FE...",
- "displayUrl" : "https:\/\/www.constososailinglessonsseat...",
- "snippet" : "Contoso sailing lessons in Seattle...",
- "dateLastCrawled" : "2017-04-09T14:30:00"
- },
-
- ...
-
- ],
- "someResultsRemoved" : true
- },
- "relatedSearches" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/7\/#RelatedSearches",
- "value" : [{
- "text" : "sailing lessons",
- "displayText" : "sailing lessons",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=70BE289346E..."
- }
-
- ...
-
- ]
- },
- "rankingResponse" : {
- "mainline" : {
- "items" : [{
- "answerType" : "WebPages",
- "resultIndex" : 0,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.0"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 1,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.1"
- }
- }
-
- ...
-
- ]
- },
- "sidebar" : {
- "items" : [{
- "answerType" : "RelatedSearches",
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#RelatedSearches"
- }
- }]
- }
- }
-}
-```
-
-The `rankingResponse` JSON object ([documentation](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#rankingresponse)) describes the appropriate display order for search results. It includes one or more of the following, prioritized groups:
--- `pole`: The search results to get the most visible treatment (for example, displayed above the mainline and sidebar).-- `mainline`: The search results to display in the mainline.-- `sidebar`: The search results to display in the sidebar. If there is no sidebar, display the results below the mainline.-
-The ranking response JSON may include one or more of the groups.
-
-In **Program.cs**, add the following method to display results in properly ranked order:
-
-```csharp
-static void DisplayAllRankedResults(Newtonsoft.Json.Linq.JObject responseObjects)
-{
- string[] rankingGroups = new string[] { "pole", "mainline", "sidebar" };
-
- // Loop through the ranking groups in priority order
- foreach (string rankingName in rankingGroups)
- {
- Newtonsoft.Json.Linq.JToken rankingResponseItems = responseObjects.SelectToken($"rankingResponse.{rankingName}.items");
- if (rankingResponseItems != null)
- {
- foreach (Newtonsoft.Json.Linq.JObject rankingResponseItem in rankingResponseItems)
- {
- Newtonsoft.Json.Linq.JToken resultIndex;
- rankingResponseItem.TryGetValue("resultIndex", out resultIndex);
- var answerType = rankingResponseItem.Value<string>("answerType");
- switch (answerType)
- {
- case "WebPages":
- DisplaySpecificResults(resultIndex, responseObjects.SelectToken("webPages.value"), "WebPage", "name", "url", "displayUrl", "snippet");
- break;
- case "News":
- DisplaySpecificResults(resultIndex, responseObjects.SelectToken("news.value"), "News", "name", "url", "description");
- break;
- case "Images":
- DisplaySpecificResults(resultIndex, responseObjects.SelectToken("images.value"), "Image", "thumbnailUrl");
- break;
- case "Videos":
- DisplaySpecificResults(resultIndex, responseObjects.SelectToken("videos.value"), "Video", "embedHtml");
- break;
- case "RelatedSearches":
- DisplaySpecificResults(resultIndex, responseObjects.SelectToken("relatedSearches.value"), "RelatedSearch", "displayText", "webSearchUrl");
- break;
- }
- }
- }
- }
-}
-```
-
-This method:
--- Loops over the `rankingResponse` groups that the response contains-- Displays the items in each group by calling `DisplaySpecificResults(...)`-
-In **Program.cs**, add the following two methods:
-
-```csharp
-static void DisplaySpecificResults(Newtonsoft.Json.Linq.JToken resultIndex, Newtonsoft.Json.Linq.JToken items, string title, params string[] fields)
-{
- if (resultIndex == null)
- {
- foreach (Newtonsoft.Json.Linq.JToken item in items)
- {
- DisplayItem(item, title, fields);
- }
- }
- else
- {
- DisplayItem(items.ElementAt((int)resultIndex), title, fields);
- }
-}
-
-static void DisplayItem(Newtonsoft.Json.Linq.JToken item, string title, string[] fields)
-{
- Console.WriteLine($"{title}: ");
- foreach( string field in fields )
- {
- Console.WriteLine($"- {field}: {item[field]}");
- }
- Console.WriteLine();
-}
-```
-
-These methods work together to output the search results to the console.
-
-## Run the application
-
-Run the application. The output should look similar to the following:
-
-```
-Enter Bing query: sailing lessons seattle
-
-WebPage:
-- name: Contoso Sailing Club - Seattle-- url: https://www.bing.com/cr?IG=70BE289346ED4594874FE...-- displayUrl: https://contososailingsea....-- snippet: Come sail with Contoso in Seattle...-
-WebPage:
-- name: Contoso Sailing Lessons Seattle - Official Site-- url: http://www.bing.com/cr?IG=70BE289346ED4594874FE...-- displayUrl: https://www.constososailinglessonsseat...-- snippet: Contoso sailing lessons in Seattle...-
-...
-```
-
-## Next steps
-
-Read more about [using ranking to display results](rank-results.md).
cognitive-services Filter Answers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/filter-answers.md
- Title: How to filter search results - Bing Web Search API-
-description: You can filter the types of answers that Bing includes in the response (for example images, videos, and news) by using the 'responseFilter' query parameter.
------ Previously updated : 07/08/2019---
-# Filtering the answers that the search response includes
--
-When you query the web, Bing returns all the relevant content it finds for the search. For example, if the search query is "sailing+dinghies", the response might contain the following answers:
-
-```json
-{
- "_type" : "SearchResponse",
- "webPages" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3A43C...",
- "totalEstimatedMatches" : 262000,
- "value" : [...]
- },
- "images" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Images",
- "readLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=sail...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3A43CA5CA6464E5D...",
- "isFamilyFriendly" : true,
- "value" : [...]
- },
- "rankingResponse" : {
- "mainline" : {
- "items" : [...]
- }
- }
-}
-```
-
-## Query parameters
-
-To filter the answers returned by Bing, use the below query parameters when calling the API.
-
-### ResponseFilter
-
-You can filter the types of answers that Bing includes in the response (for example images, videos, and news) by using the [responseFilter](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#responsefilter) query parameter, which is a comma-delimited list of answers. An answer will be included in the response if Bing finds relevant content for it.
-
-To exclude specific answers from the response such as images, prepend a `-` character to the answer type. For example:
-
-```
-&responseFilter=-images,-videos
-```
-
-The following shows how to use `responseFilter` to request images, videos, and news of sailing dinghies. When you encode the query string, the commas change to %2C.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies&responseFilter=images%2Cvideos%2Cnews&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: 47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following shows the response to the previous query. Because Bing didn't find relevant video and news results, the response doesn't include them.
-
-```json
-{
- "_type" : "SearchResponse",
- "images" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Images",
- "readLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images\/search?q=sail...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3AD78B183C56456C...",
- "isFamilyFriendly" : true,
- "value" : [...]
- },
- "rankingResponse" : {
- "mainline" : {
- "items" : [{
- "answerType" : "Images",
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Images"
- }
- }]
- }
- }
-}
-```
-
-Although Bing did not return video and news results in the previous response, it does not mean that video and news content does not exist. It simply means that the page didn't include them. However, if you [page](./paging-search-results.md) through more results, the subsequent pages would likely include them. Also, if you call the [Video Search API](../bing-video-search/overview.md) and [News Search API](../bing-news-search/search-the-web.md) endpoints directly, the response would likely contain results.
-
-You are discouraged from using `responseFilter` to get results from a single API. If you want content from a single Bing API, call that API directly. For example, to receive only images, send a request to the Image Search API endpoint, `https://api.cognitive.microsoft.com/bing/v7.0/images/search` or one of the other [Images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#endpoints) endpoints. Calling the single API is important not only for performance reasons but because the content-specific APIs offer richer results. For example, you can use filters that are not available to the Web Search API to filter the results.
-
-### Site
-
-To get search results from a specific domain, include the `site:` query parameter in the query string.
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies+site:contososailing.com&mkt=en-us
-```
-
-> [!NOTE]
-> Depending on the query, if you use the `site:` query operator, there is the chance that the response may contain adult content regardless of the [safeSearch](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#safesearch) setting. You should use `site:` only if you are aware of the content on the site and your scenario supports the possibility of adult content.
-
-### Freshness
-
-To limit the web answer results to webpages that Bing discovered during a specific period, set the [freshness](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#freshness) query parameter to one of the following case-insensitive values:
-
-* `Day` ΓÇö Return webpages that Bing discovered within the last 24 hours
-* `Week` ΓÇö Return webpages that Bing discovered within the last 7 days
-* `Month` ΓÇö Return webpages that discovered within the last 30 days
-
-You may also set this parameter to a custom date range in the form, `YYYY-MM-DD..YYYY-MM-DD`.
-
-`https://<host>/bing/v7.0/search?q=ipad+updates&freshness=2019-02-01..2019-05-30`
-
-To limit the results to a single date, set the freshness parameter to a specific date:
-
-`https://<host>/bing/v7.0/search?q=ipad+updates&freshness=2019-02-04`
-
-The results may include webpages that fall outside the specified period if the number of webpages that Bing matches to your filter criteria is less than the number of webpages you requested (or the default number that Bing returns).
-
-## Limiting the number of answers in the response
-
-Bing can return multiple answer types in the JSON response. For example, if you query *sailing+dinghies*, Bing might return `webpages`, `images`, `videos`, and `relatedSearches`.
-
-```json
-{
- "_type" : "SearchResponse",
- "queryContext" : {
- "originalQuery" : "sailing dinghies"
- },
- "webPages" : {...},
- "images" : {...},
- "relatedSearches" : {...},
- "videos" : {...},
- "rankingResponse" : {...}
-}
-```
-
-To limit the number of answers that Bing returns to the top two answers (webpages and images), set the [answerCount](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#answercount) query parameter to 2.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies&answerCount=2&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: 47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The response includes only `webPages` and `images`.
-
-```json
-{
- "_type" : "SearchResponse",
- "queryContext" : {
- "originalQuery" : "sailing dinghies"
- },
- "webPages" : {...},
- "images" : {...},
- "rankingResponse" : {...}
-}
-```
-
-If you add the `responseFilter` query parameter to the previous query and set it to webpages and news, the response contains only webpages because news is not ranked.
-
-```json
-{
- "_type" : "SearchResponse",
- "queryContext" : {
- "originalQuery" : "sailing dinghies"
- },
- "webPages" : {...},
- "rankingResponse" : {...}
-}
-```
-
-## Promoting answers that are not ranked
-
-If the top ranked answers that Bing returns for a query are webpages, images, videos, and relatedSearches, the response would include those answers. If you set [answerCount](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#answercount) to two (2), Bing returns the top two ranked answers: webpages and images. If you want Bing to include images and videos in the response, specify the [promote](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#promote) query parameter and set it to images and videos.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies&answerCount=2&promote=images%2Cvideos&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822)
-X-Search-ClientIP: 999.999.999.999
-X-Search-Location: 47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-```
-
-The following is the response to the above request. Bing returns the top two answers, webpages and images, and promotes videos into the answer.
-
-```json
-{
- "_type" : "SearchResponse",
- "queryContext" : {
- "originalQuery" : "sailiing dinghies"
- },
- "webPages" : {...},
- "images" : {...},
- "videos" : {...},
- "rankingResponse" : {...}
-}
-```
-
-If you set `promote` to news, the response doesn't include the news answer because it is not a ranked answer&mdash;you can promote only ranked answers.
-
-The answers that you want to promote do not count against the `answerCount` limit. For example, if the ranked answers are news, images, and videos, and you set `answerCount` to 1 and `promote` to news, the response contains news and images. Or, if the ranked answers are videos, images, and news, the response contains videos and news.
-
-You may use `promote` only if you specify the `answerCount` query parameter.
cognitive-services Hit Highlighting https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/hit-highlighting.md
- Title: How to use decoration markers to highlight text - Bing Web Search API-
-description: Learn how to use text decorations and hit highlighting in your search results using the Bing Web Search API.
------ Previously updated : 07/30/2019---
-# Using decoration markers to highlight text
--
-Bing supports hit highlighting, which marks query terms (or other terms that Bing finds relevant) in the display strings of some answers. For example, a webpage result's `name`, `displayUrl`, and `snippet` fields might contain marked query terms.
-
-By default, Bing doesn't include highlighting markers in display strings. To enable the markers, include the `textDecorations` query parameter in your request and set it to `true`.
-
-## Hit highlighting example
-
-The following example shows a web result for `Sailing Dinghy`. Bing marked the beginning and end of the query term using the E000 and E001 Unicode characters.
-
-![Hit Highlighting](./media/cognitive-services-bing-web-api/bing-hit-highlighting.png)
-
-Before displaying the result in your user interface, replace the Unicode characters with ones that are appropriate for your display format.
-
-## Marker formatting
-
-Bing provides the option of using either Unicode characters or HTML tags as markers. To specify which markers to use, include the [textFormat](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#textformat) query parameter:
-
-| Value | Marker |
-|-||
-| `textFormat=Raw` | Unicode characters (default) |
-| `textFormat=HTML` | HTML characters |
-
-## Additional text decorations
-
-Bing can return several different text decorations. For example, a `Computation` answer can contain subscript markers for the query term `log(2)` in the `expression` field.
-
-![computation markers](./media/cognitive-services-bing-web-api/bing-markers-computation.png)
-
-If the request did not specify decorations, the `expression` field would contain `log10(2)`.
-
-If `textDecorations` is `true`, Bing may include the following markers in the display strings of answers. If there is no equivalent HTML tag, the table cell is empty.
-
-|Unicode|HTML|Description
-|-|-|-
-|U+E000|\<b>|Marks the beginning of the query term (hit highlighting)
-|U+E001|\</b>|Marks the end of the query term
-|U+E002|\<i>|Marks the beginning of italicized content
-|U+E003|\</i>|Marks the end of italicized content
-|U+E004|\<br/>|Marks a line break
-|U+E005||Marks the beginning of a phone number
-|U+E006||Marks the end of a phone number
-|U+E007||Marks the beginning of an address
-|U+E008||Marks the end of an address
-|U+E009|\&nbsp;|Marks a non-breaking space
-|U+E00C|\<strong>|Marks the beginning of bold content
-|U+E00D|\</strong>|Marks the end of bold content
-|U+E00E||Marks the beginning of content whose background should be lighter than its surrounding background
-|U+E00F||Marks the end of content whose background should be lighter than its surrounding background
-|U+E010||Marks the beginning of content whose background should be darker than its surrounding background
-|U+E011||Marks the end of content whose background should be darker than its surrounding background
-|U+E012|\<del>|Marks the beginning of content that should be struck through
-|U+E013|\</del>|Marks the end of content that should be struck through
-|U+E016|\<sub>|Marks the beginning of subscript content
-|U+E017|\</sub>|Marks the end of subscript content
-|U+E018|\<sup>|Marks the beginning of superscript content
-|U+E019|\</sup>|Marks the end of superscript content
-
-## Next steps
-
-* [What is the Bing Web Search API?](overview.md)
-* [Resize and crop thumbnails](resize-and-crop-thumbnails.md)
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/language-support.md
- Title: Language support - Bing Web Search API-
-description: A list of natural languages, countries and regions that are supported by the Bing Web Search API.
------ Previously updated : 05/15/2019---
-# Language and region support for the Bing Web Search API
--
-The Bing Web Search API supports over three dozen countries or regions, many with more than one language. Specifying a country or region with a query helps refine search results based on that country or regions interests. The results may include links to Bing, and these links may localize the Bing user experience according to the specified country/region or language.
-
-You can specify a country or region using the `cc` query parameter. When a country or region is specified, you must specify one or more language codes with the [`Accept-Language` header](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#headers). Use the [Markets table](#markets) for a list of languages supported in each market.
-
-Alternatively, you can specify the market with the `mkt` query parameter, and a code from the **Markets** table. Specifying a market simultaneously specifies a country or region and a preferred language. You can explicitly set the language with the `setLang` query parameter.
-
-## Countries/regions
-
-|Country/region|Code|
-|-|-|
-|Argentina|AR|
-|Australia|AU|
-|Austria|AT|
-|Belgium|BE|
-|Brazil|BR|
-|Canada|CA|
-|Chile|CL|
-|Denmark|DK|
-|Finland|FI|
-|France|FR|
-|Germany|DE|
-|Hong Kong SAR|HK|
-|India|IN|
-|Indonesia|ID|
-|Italy|IT|
-|Japan|JP|
-|Korea|KR|
-|Malaysia|MY|
-|Mexico|MX|
-|Netherlands|NL|
-|New Zealand|NZ|
-|Norway|NO|
-|China|CN|
-|Poland|PL|
-|Portugal|PT|
-|Philippines|PH|
-|Russia|RU|
-|Saudi Arabia|SA|
-|South Africa|ZA|
-|Spain|ES|
-|Sweden|SE|
-|Switzerland|CH|
-|Taiwan|TW|
-|T├╝rkiye|TR|
-|United Kingdom|GB|
-|United States|US|
-
-## Markets
-
-|Country/region|Language|Market Code|
-|-|--|--|
-|Argentina|Spanish|es-AR|
-|Australia|English|en-AU|
-|Austria|German|de-AT|
-|Belgium|Dutch|nl-BE|
-|Belgium|French|fr-BE|
-|Brazil|Portuguese|pt-BR|
-|Canada|English|en-CA|
-|Canada|French|fr-CA|
-|Chile|Spanish|es-CL|
-|Denmark|Danish|da-DK|
-|Finland|Finnish|fi-FI|
-|France|French|fr-FR|
-|Germany|German|de-DE|
-|Hong Kong SAR|Traditional Chinese|zh-HK|
-|India|English|en-IN|
-|Indonesia|English|en-ID|
-|Italy|Italian|it-IT|
-|Japan|Japanese|ja-JP|
-|Korea|Korean|ko-KR|
-|Malaysia|English|en-MY|
-|Mexico|Spanish|es-MX|
-|Netherlands|Dutch|nl-NL|
-|New Zealand|English|en-NZ|
-|Norway|Norwegian|no-NO|
-|China|Chinese|zh-CN|
-|Poland|Polish|pl-PL|
-|Portugal|Portuguese|pt-PT|
-|Philippines|English|en-PH|
-|Russia|Russian|ru-RU|
-|Saudi Arabia|Arabic|ar-SA|
-|South Africa|English|en-ZA|
-|Spain|Spanish|es-ES|
-|Sweden|Swedish|sv-SE|
-|Switzerland|French|fr-CH|
-|Switzerland|German|de-CH|
-|Taiwan|Traditional Chinese|zh-TW|
-|T├╝rkiye|Turkish|tr-TR|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|United States|Spanish|es-US|
-
-## Next steps
-
-* [Bing Image Search API reference](/rest/api/cognitiveservices/bing-images-api-v7-reference)
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/overview.md
- Title: What is the Bing Web Search API?-
-description: The Bing Web Search API is a RESTful service that provides instant answers to web search queries. Configure results to include web pages, images, videos, news, and more. Results are provided as JSON and based on search relevance and your Bing Web Search subscriptions.
------ Previously updated : 03/31/2020----
-# What is the Bing Web Search API?
--
-The Bing Web Search API is a RESTful service that provides instant answers to user queries. Search results are easily configured to include web pages, images, videos, news, translations, and more. Bing Web Search provides the results as JSON based on search relevance and your Bing Web Search subscriptions.
-
-This API is optimal for applications that need access to all content that is relevant to a user's search query. If you're building an application that requires only a specific type of result, consider using the [Bing Image Search API](../bing-image-search/overview.md), [Bing Video Search API](../bing-video-search/overview.md), or [Bing News Search API](../bing-news-search/search-the-web.md). See [Azure AI services APIs](../../ai-services/index.yml) for a complete list of Bing Search APIs.
-
-Want to see how it works? Try our [Bing Web Search API demo](https://azure.microsoft.com/services/cognitive-services/bing-web-search-api/).
-
-## Features
-
-Bing Web Search doesn't only give you access to instant answers. It also provides additional features and functionality that allow you to customize search results for your users.
-
-| Feature | Description |
-||-|
-| [Suggest search terms in real time](../bing-autosuggest/get-suggested-search-terms.md) | Improve your application experience by using the Bing Autosuggest API to display suggested search terms as they're typed. |
-| [Filter and restrict results by content type](filter-answers.md) | Customize and refine search results with filters and query parameters for web pages, images, videos, safe search, and more. |
-| [Hit highlighting for unicode characters](hit-highlighting.md) | Identify and remove unwanted unicode characters from search results before displaying them to users with hit highlighting. |
-| [Localize search results by country, region, and/or market](./language-support.md) | Bing Web Search supports more than three dozen countries or regions. Use this feature to refine search results for a specific country/region or market. |
-| [Analyze search metrics with Bing Statistics](bing-web-stats.md) | Bing Statistics is a paid subscription that provides analytics on call volume, top query strings, geographic distribution, and more. |
-
-## Workflow
-
-The Bing Web Search API is easy to call from any programming language that can make HTTP requests and parse JSON responses. The service is accessible using the [REST API](quickstarts/python.md) or the [Bing Web Search client libraries](./quickstarts/client-libraries.md).
-
-1. [Create an Azure resource](../cognitive-services-apis-create-account.md) for the Bing Search APIs. If you don't have an Azure subscription, you can [create a free account](https://azure.microsoft.com/free/cognitive-services/).
-2. Send a [request to the Bing Web Search API](quickstarts/python.md).
-3. Parse the JSON response.
-
-## Next steps
-
-* Use our [Python quickstart](./quickstarts/client-libraries.md?pivots=programming-language-python) to make your first call to the Bing Web Search API.
-* [Build a single-page web app](tutorial-bing-web-search-single-page-app.md).
-* Review [Web Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference) documentation.
-* Learn more about [use and display requirements](./use-display-requirements.md) for Bing Web Search.
cognitive-services Paging Search Results https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/paging-search-results.md
- Title: How to page through search results - Bing Search APIs-
-description: Learn how to page through search results from the Bing Search APIs.
------ Previously updated : 10/31/2019---
-# How to page through results from the Bing Search APIs
--
-When you send a call to the Bing Web, Custom, Image, News or Video Search APIs, Bing returns a subset of the total number of results that may be relevant to the query. To get the estimated total number of available results, access the answer object's `totalEstimatedMatches` field.
-
-For example:
-
-```json
-{
- "_type" : "SearchResponse",
- "webPages" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=3A43CA...",
- "totalEstimatedMatches" : 262000,
- "value" : [...]
- }
-}
-```
-
-## Paging through search results
-
-To page through the available results, use the `count` and `offset` query parameters when sending your request.
-
-> [!NOTE]
->
-> * Paging with the Bing Video, Image, and News APIs applies only to general video (`/video/search`), news (`/news/search`) and image (`/image/search`) searches. Paging through trending topics and categories is not supported.
-> * The `TotalEstimatedMatches` field is an estimate of the total number of search results for the current query. When you set the `count` and `offset` parameters, this estimate may change.
-
-| Parameter | Description |
-|--|-|
-| `count` | Specifies the number of results to return in the response. Note that the default value of `count`, and the maximum number of results that you may request varies by API. You can find these values in the reference documentation under [Next steps](#next-steps). |
-| `offset` | Specifies the number of results to skip. The `offset` is zero-based and should be less than (`totalEstimatedMatches` - `count`). |
-
-As an example, if you want to display 15 results per page, you would set `count` to 15 and `offset` to 0 to get the first page of results. For each subsequent API call, you would increment `offset` by 15. The following example requests 15 webpages beginning at offset 45.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies&count=15&offset=45&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-Host: api.cognitive.microsoft.com
-```
-
-If you use the default `count` value, you only need to specify the `offset` query parameter in your API calls.
-
-```
-GET https://api.cognitive.microsoft.com/bing/v7.0/search?q=sailing+dinghies&offset=45&mkt=en-us HTTP/1.1
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-Host: api.cognitive.microsoft.com
-```
-
-When using the Bing Image and Video APIs, you can use the `nextOffset` value to avoid duplicate search results. Get the value from the `Images` or `Videos` response objects, and use it in your requests with the `offset` parameter.
-
-> [!NOTE]
-> The Bing Web Search API returns search results that can include webpages, images, videos, and news. When you page through search results from the Bing Web Search API, you are paging only [WebPages](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#webpage), and not other answer types such as images or news. Search results in `WebPage` objects may include results that appear in other answer types as well.
->
-> If you use the `responseFilter` query parameter without specifying any filter values, don't use the `count` and `offset` parameters.
-
-## Next steps
-
-* [What are the Bing Web Search APIs?](bing-api-comparison.md)
-* [Bing Web Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference)
-* [Bing Custom Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-custom-search-api-v7-reference)
-* [Bing News Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference)
-* [Bing Video Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference)
-* [Bing Image Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference)
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/client-libraries.md
- Title: "Quickstart: Use a Bing Web Search client library"-
-description: The Bing Web Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 10/19/2020---
-# Quickstart: Use a Bing Web Search client library
-------------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/csharp.md
- Title: "Quickstart: Perform a web search with C# - Bing Web Search REST API"-
-description: "Use this quickstart to send requests to the Bing Web Search REST API using C#, and receive a JSON response."
------ Previously updated : 10/19/2020--
-#Customer intent: "As a new developer, I want to make my first call to the Bing Web Search API and receive a response using C#."
--
-# Quickstart: Search the web using the Bing Web Search REST API and C#
--
-Use this quickstart to make your first call to the Bing Web Search API. This C# application sends a search request to the API, and shows the JSON response. Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages.
-
-This example program in this quickstart uses only .NET Core classes.
-
-## Prerequisites
-
-Here are a few things that you'll need before running this quickstart:
-
-* Windows: [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/)
-* Linux/macOS: [Visual Studio Code](https://code.visualstudio.com/) and [.NET Core](https://dotnet.microsoft.com/download)
-* [A free Azure subscription](https://azure.microsoft.com/free/dotnet)
--
-## Create a project and declare dependencies
-
-Create a console project in Visual Studio or VS Code. Use the following code to import the required namespaces and types:
-
-```csharp
-using System;
-using System.Text;
-using System.Net;
-using System.IO;
-using System.Collections.Generic;
-```
-
-## Declare a namespace and class for your program
-
-In this quickstart, we'll put most of the code in the `Program` class. Start by creating the `BingSearchApiQuickstart` namespace and `Program` class in your project.
-
-```csharp
-namespace BingSearchApisQuickstart
-{
- class Program
- {
- // The code in the following sections goes here.
- }
-}
-```
-
-## Define variables
-
-A few variables must be set before we can continue. Add this code to the `Program` class you created in the previous section:
-
-1. For the `uriBase` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-2. Confirm that `uriBase` is valid and replace the `accessKey` value with a subscription key from your Azure account.
-
-3. Optionally, customize the search query by replacing the value for `searchTerm`.
-
-```csharp
-// Enter a valid subscription key.
-const string accessKey = "enter key here";
-/*
- * If you encounter unexpected authorization errors, double-check this value
- * against the endpoint for your Bing Web search instance in your Azure
- * dashboard.
- */
-const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/search";
-const string searchTerm = "Microsoft Cognitive Services";
-```
-
-## Declare the Main method
-
-The `Main()` method is required and is the first method invoked when you start the program. In this application, the main method validates the `accessKey`, makes a request, and prints the response.
-
-The `main()` method is dependent on methods that you create in the next sections.
-
-```csharp
-static void Main()
-{
- Console.OutputEncoding = System.Text.Encoding.UTF8;
- if (accessKey.Length == 32)
- {
- Console.WriteLine("Searching the Web for: " + searchTerm);
- SearchResult result = BingWebSearch(searchTerm);
- Console.WriteLine("\nRelevant HTTP Headers:\n");
- foreach (var header in result.relevantHeaders)
- Console.WriteLine(header.Key + ": " + header.Value);
-
- Console.WriteLine("\nJSON Response:\n");
- Console.WriteLine(JsonPrettyPrint(result.jsonResult));
- }
- else
- {
- Console.WriteLine("Invalid Bing Search API subscription key!");
- Console.WriteLine("Please paste yours into the source code.");
- }
- Console.Write("\nPress Enter to exit ");
- Console.ReadLine();
-}
-```
-
-## Create a struct for search results
-
-Create a struct that returns search results with relevant headers. You call it when you make a request to the Bing Web Search API to create a result object.
-
-```csharp
-// Returns search results with headers.
-struct SearchResult
-{
- public String jsonResult;
- public Dictionary<String, String> relevantHeaders;
-}
-```
-
-## Construct a request
-
-Use this code to construct the search query, perform the GET request, and handle the response.
-
-```csharp
-/// <summary>
-/// Makes a request to the Bing Web Search API and returns data as a SearchResult.
-/// </summary>
-static SearchResult BingWebSearch(string searchQuery)
-{
- // Construct the search request URI.
- var uriQuery = uriBase + "?q=" + Uri.EscapeDataString(searchQuery);
-
- // Perform request and get a response.
- WebRequest request = HttpWebRequest.Create(uriQuery);
- request.Headers["Ocp-Apim-Subscription-Key"] = accessKey;
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
-
- // Create a result object.
- var searchResult = new SearchResult()
- {
- jsonResult = json,
- relevantHeaders = new Dictionary<String, String>()
- };
-
- // Extract Bing HTTP headers.
- foreach (String header in response.Headers)
- {
- if (header.StartsWith("BingAPIs-") || header.StartsWith("X-MSEdge-"))
- searchResult.relevantHeaders[header] = response.Headers[header];
- }
- return searchResult;
-}
-```
-
-## Format the response
-
-This method formats the JSON response, primarily by indenting and adding line breaks.
-
-```csharp
-/// <summary>
-/// Formats the JSON string by adding line breaks and indents.
-/// </summary>
-/// <param name="json">The raw JSON string.</param>
-/// <returns>The formatted JSON string.</returns>
-static string JsonPrettyPrint(string json)
-{
- if (string.IsNullOrEmpty(json))
- return string.Empty;
-
- json = json.Replace(Environment.NewLine, "").Replace("\t", "");
-
- StringBuilder sb = new StringBuilder();
- bool quote = false;
- bool ignore = false;
- char last = ' ';
- int offset = 0;
- int indentLength = 2;
-
- foreach (char ch in json)
- {
- switch (ch)
- {
- case '"':
- if (!ignore) quote = !quote;
- break;
- case '\\':
- if (quote && last != '\\') ignore = true;
- break;
- }
-
- if (quote)
- {
- sb.Append(ch);
- if (last == '\\' && ignore) ignore = false;
- }
- else
- {
- switch (ch)
- {
- case '{':
- case '[':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', ++offset * indentLength));
- break;
- case ']':
- case '}':
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', --offset * indentLength));
- sb.Append(ch);
- break;
- case ',':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', offset * indentLength));
- break;
- case ':':
- sb.Append(ch);
- sb.Append(' ');
- break;
- default:
- if (quote || ch != ' ') sb.Append(ch);
- break;
- }
- }
- last = ch;
- }
- return sb.ToString().Trim();
-}
-```
-
-## Put it all together
-
-The last step is to run your code. If you'd like to compare your code with ours, see the [sample code on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingWebSearchv7.cs).
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Microsoft Cognitive Services"
- },
- "webPages": {
- "webSearchUrl": "https://www.bing.com/search?q=Microsoft+cognitive+services",
- "totalEstimatedMatches": 22300000,
- "value": [
- {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0",
- "name": "Microsoft Cognitive Services",
- "url": "https://www.microsoft.com/cognitive-services",
- "displayUrl": "https://www.microsoft.com/cognitive-services",
- "snippet": "Knock down barriers between you and your ideas. Enable natural and contextual interaction with tools that augment users' experiences via the power of machine-based AI. Plug them in and bring your ideas to life.",
- "deepLinks": [
- {
- "name": "Face",
- "url": "https://azure.microsoft.com/services/cognitive-services/face/",
- "snippet": "Add facial recognition to your applications to detect, identify, and verify faces using the Face service from Microsoft Azure. ... Cognitive Services; Face service;"
- },
- {
- "name": "Text Analytics",
- "url": "https://azure.microsoft.com/services/cognitive-services/text-analytics/",
- "snippet": "Cognitive Services; Text Analytics API; Text Analytics API . Detect sentiment, ... you agree that Microsoft may store it and use it to improve Microsoft services, ..."
- },
- {
- "name": "Computer Vision API",
- "url": "https://azure.microsoft.com/products/ai-services?activetab=pivot:visiontab",
- "snippet": "Extract the data you need from images using optical character recognition and image analytics with Computer Vision APIs from Microsoft Azure."
- },
- {
- "name": "Emotion",
- "url": "https://www.microsoft.com/cognitive-services/en-us/emotion-api",
- "snippet": "Cognitive Services Emotion API - microsoft.com"
- },
- {
- "name": "Bing Speech API",
- "url": "https://azure.microsoft.com/services/cognitive-services/speech/",
- "snippet": "Add speech recognition to your applications, including text to speech, with a speech API from Microsoft Azure. ... Cognitive Services; Bing Speech API;"
- },
- {
- "name": "Get Started for Free",
- "url": "https://azure.microsoft.com/services/cognitive-services/",
- "snippet": "Add vision, speech, language, and knowledge capabilities to your applications using intelligence APIs and SDKs from Cognitive Services."
- }
- ]
- }
- ]
- },
- "relatedSearches": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches",
- "value": [
- {
- "text": "microsoft bot framework",
- "displayText": "microsoft bot framework",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+bot+framework"
- },
- {
- "text": "microsoft cognitive services youtube",
- "displayText": "microsoft cognitive services youtube",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+youtube"
- },
- {
- "text": "microsoft cognitive services search api",
- "displayText": "microsoft cognitive services search api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+search+api"
- },
- {
- "text": "microsoft cognitive services news",
- "displayText": "microsoft cognitive services news",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+news"
- },
- {
- "text": "ms cognitive service",
- "displayText": "ms cognitive service",
- "webSearchUrl": "https://www.bing.com/search?q=ms+cognitive+service"
- },
- {
- "text": "microsoft cognitive services text analytics",
- "displayText": "microsoft cognitive services text analytics",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+text+analytics"
- },
- {
- "text": "microsoft cognitive services toolkit",
- "displayText": "microsoft cognitive services toolkit",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+toolkit"
- },
- {
- "text": "microsoft cognitive services api",
- "displayText": "microsoft cognitive services api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+api"
- }
- ]
- },
- "rankingResponse": {
- "mainline": {
- "items": [
- {
- "answerType": "WebPages",
- "resultIndex": 0,
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0"
- }
- }
- ]
- },
- "sidebar": {
- "items": [
- {
- "answerType": "RelatedSearches",
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches"
- }
- }
- ]
- }
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Go https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/go.md
- Title: "Quickstart: Perform a web search with Go - Bing Web Search REST API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using Go, and receive a JSON response
------ Previously updated : 05/22/2020---
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using Go.
--
-# Quickstart: Search the web using the Bing Web Search REST API and Go
--
-Use this quickstart to make your first call to the Bing Web Search API. This Go application sends a search request to the API, and shows the JSON response. Although this application is written in Go, the API is a RESTful Web service compatible with most programming languages.
-
- The code examples in this quickstart require only core libraries; there are no external dependencies.
-
-## Prerequisites
-Here are a few things that you'll need before running this quickstart:
-
-* [Go binaries](https://go.dev/dl/)
-* A subscription key
--
-## Create a project and import core libraries
-
-Create a new Go project in your favorite IDE or editor. Then, import `net/http` for requests, `ioutil` to read the response, `time` and `encoding/json` to handle the JSON, and `fmt` to print the output.
-
-```go
-package main
-import (
- "fmt"
- "net/http"
- "io/ioutil"
- "time"
- "encoding/json"
-)
-```
-
-## Create a struct to format the search results
-
-The `BingAnswer` struct formats the data provided in the response.
-
-```go
-// This struct formats the answers provided by the Bing Web Search API.
-type BingAnswer struct {
- Type string `json:"_type"`
- QueryContext struct {
- OriginalQuery string `json:"originalQuery"`
- } `json:"queryContext"`
- WebPages struct {
- WebSearchURL string `json:"webSearchUrl"`
- TotalEstimatedMatches int `json:"totalEstimatedMatches"`
- Value []struct {
- ID string `json:"id"`
- Name string `json:"name"`
- URL string `json:"url"`
- IsFamilyFriendly bool `json:"isFamilyFriendly"`
- DisplayURL string `json:"displayUrl"`
- Snippet string `json:"snippet"`
- DateLastCrawled time.Time `json:"dateLastCrawled"`
- SearchTags []struct {
- Name string `json:"name"`
- Content string `json:"content"`
- } `json:"searchTags,omitempty"`
- About []struct {
- Name string `json:"name"`
- } `json:"about,omitempty"`
- } `json:"value"`
- } `json:"webPages"`
- RelatedSearches struct {
- ID string `json:"id"`
- Value []struct {
- Text string `json:"text"`
- DisplayText string `json:"displayText"`
- WebSearchURL string `json:"webSearchUrl"`
- } `json:"value"`
- } `json:"relatedSearches"`
- RankingResponse struct {
- Mainline struct {
- Items []struct {
- AnswerType string `json:"answerType"`
- ResultIndex int `json:"resultIndex"`
- Value struct {
- ID string `json:"id"`
- } `json:"value"`
- } `json:"items"`
- } `json:"mainline"`
- Sidebar struct {
- Items []struct {
- AnswerType string `json:"answerType"`
- Value struct {
- ID string `json:"id"`
- } `json:"value"`
- } `json:"items"`
- } `json:"sidebar"`
- } `json:"rankingResponse"`
-}
-```
-
-## Declare the main function and define variables
-
-This code declares the main function and sets the required variables:
-
-1. For the `endpoint` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-2. Confirm that the endpoint is correct and replace the `token` value with a valid subscription key from your Azure account.
-
-3. Optionally, customize the search query by replacing the value for `searchTerm`.
-
-```go
-// Declare the main function. This is required for all Go programs.
-func main() {
-// Verify the endpoint URI and replace the token string with a valid subscription key.
- const endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/search"
- token := "YOUR-ACCESS-KEY"
- searchTerm := "Microsoft Cognitive Services"
-
-// The remaining code in this quickstart goes in the main function.
-
-}
-```
-
-## Construct a request
-
-This code declares the HTTP request, inserts the header and payload, and instantiates the client.
-
-```go
-// Declare a new GET request.
-req, err := http.NewRequest("GET", endpoint, nil)
-if err != nil {
- panic(err)
-}
-
-// Add the payload to the request.
-param := req.URL.Query()
-param.Add("q", searchTerm)
-req.URL.RawQuery = param.Encode()
-
-// Insert the request header.
-req.Header.Add("Ocp-Apim-Subscription-Key", token)
-
-// Instantiate a client.
-client := new(http.Client)
-```
-
-## Make a request
-
-Use this code to call the Bing Web Search API and close the connection after a response is returned.
-
-```go
-// Send the request to Bing.
-resp, err := client.Do(req)
-if err != nil {
- panic(err)
-}
-
-// Close the connection.
-defer resp.Body.Close()
-body, err := ioutil.ReadAll(resp.Body)
-if err != nil {
- panic(err)
-}
-```
-
-## Handle the response
-
-Use the struct we created previously to format the response and print the search results.
-
-```go
-// Create a new answer.
-ans := new(BingAnswer)
-err = json.Unmarshal(body, &ans)
-if err != nil {
- fmt.Println(err)
-}
-// Iterate over search results and print the result name and URL.
-for _, result := range ans.WebPages.Value {
- fmt.Println(result.Name, "||", result.URL)
-}
-```
-
-## Put it all together
-
-The last step is to validate your code and run it. If you'd like to compare your code with ours, here's the complete program:
-
-```go
-package main
-import (
- "fmt"
- "net/http"
- "io/ioutil"
- "time"
- "encoding/json"
-)
-
-// The is the struct for the data returned by Bing.
-type BingAnswer struct {
- Type string `json:"_type"`
- QueryContext struct {
- OriginalQuery string `json:"originalQuery"`
- } `json:"queryContext"`
- WebPages struct {
- WebSearchURL string `json:"webSearchUrl"`
- TotalEstimatedMatches int `json:"totalEstimatedMatches"`
- Value []struct {
- ID string `json:"id"`
- Name string `json:"name"`
- URL string `json:"url"`
- IsFamilyFriendly bool `json:"isFamilyFriendly"`
- DisplayURL string `json:"displayUrl"`
- Snippet string `json:"snippet"`
- DateLastCrawled time.Time `json:"dateLastCrawled"`
- SearchTags []struct {
- Name string `json:"name"`
- Content string `json:"content"`
- } `json:"searchTags,omitempty"`
- About []struct {
- Name string `json:"name"`
- } `json:"about,omitempty"`
- } `json:"value"`
- } `json:"webPages"`
- RelatedSearches struct {
- ID string `json:"id"`
- Value []struct {
- Text string `json:"text"`
- DisplayText string `json:"displayText"`
- WebSearchURL string `json:"webSearchUrl"`
- } `json:"value"`
- } `json:"relatedSearches"`
- RankingResponse struct {
- Mainline struct {
- Items []struct {
- AnswerType string `json:"answerType"`
- ResultIndex int `json:"resultIndex"`
- Value struct {
- ID string `json:"id"`
- } `json:"value"`
- } `json:"items"`
- } `json:"mainline"`
- Sidebar struct {
- Items []struct {
- AnswerType string `json:"answerType"`
- Value struct {
- ID string `json:"id"`
- } `json:"value"`
- } `json:"items"`
- } `json:"sidebar"`
- } `json:"rankingResponse"`
-}
-
-// Verify the endpoint URI and replace the token string with a valid subscription key.
-func main() {
- const endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/search"
- token := "YOUR-ACCESS-KEY"
- searchTerm := "Microsoft Cognitive Services"
-
- // Declare a new GET request.
- req, err := http.NewRequest("GET", endpoint, nil)
- if err != nil {
- panic(err)
- }
-
- // Add the payload to the request.
- param := req.URL.Query()
- param.Add("q", searchTerm)
- req.URL.RawQuery = param.Encode()
-
- // Insert the request header.
- req.Header.Add("Ocp-Apim-Subscription-Key", token)
-
- // Create a new client.
- client := new(http.Client)
-
- // Send the request to Bing.
- resp, err := client.Do(req)
- if err != nil {
- panic(err)
- }
-
- // Close the response.
- defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- panic(err)
- }
-
- // Create a new answer.
- ans := new(BingAnswer)
- err = json.Unmarshal(body, &ans)
- if err != nil {
- fmt.Println(err)
- }
-
- // Iterate over search results and print the result name and URL.
- for _, result := range ans.WebPages.Value {
- fmt.Println(result.Name, "||", result.URL)
- }
-
-}
-```
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been formatted by using the `BingAnswer` struct and shows the `result.Name` and `result.URL`.
-
-```go
-Microsoft Cognitive Services || https://www.microsoft.com/cognitive-services
-Cognitive Services | Microsoft Azure || https://azure.microsoft.com/services/cognitive-services/
-What is Microsoft Cognitive Services? | Microsoft Docs || https://learn.microsoft.com/azure/ai-services/Welcome
-Microsoft Cognitive Toolkit || https://www.microsoft.com/en-us/cognitive-toolkit/
-Microsoft Customers || https://customers.microsoft.com/en-us/search?sq=%22Microsoft%20Cognitive%20Services%22&ff=&p=0&so=story_publish_date%20desc
-Microsoft Enterprise Services - Microsoft Enterprise || https://enterprise.microsoft.com/en-us/services/
-Microsoft Cognitive Services || https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236
-Cognitive Services - msdn.microsoft.com || https://msdn.microsoft.com/magazine/mt742868.aspx
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/java.md
- Title: "Quickstart: Use Java to call the Bing Web Search REST API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using Java, and receive a JSON response
------ Previously updated : 05/22/2020--
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using Java.
--
-# Quickstart: Use Java to search the web with the Bing Web Search REST API, an Azure cognitive service
--
-In this quickstart, you'll use a Java application to make your first call to the Bing Web Search API. This Java application sends a search request to the API, and shows the JSON response. Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-Here are a few things that you'll need before running this quickstart:
-
-* [JDK 7 or 8](/azure/developer/java/fundamentals/java-support-on-azure)
-* [Gson library](https://github.com/google/gson)
-* A subscription key
--
-## Create a project and import dependencies
-
-Create a new Java project in your favorite IDE or editor and import the following libraries. Gson is required to convert Java Objects into JSON.
-
-```java
-import java.net.*;
-import java.util.*;
-import java.io.*;
-import javax.net.ssl.HttpsURLConnection;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-```
-
-### Declare Gson in the Maven POM file
-
-If you're using Maven, declare Gson in POM.xml. Skip this step if you've installed Gson locally.
-
-```xml
-<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.8.5</version>
-</dependency>
-```
-
-## Declare the BingWebSearch class
-
-Declare the `BingWebSearch` class. It includes most of the code we review in this quickstart, including the `main()` method.
-
-```java
-public class BingWebSearch {
-
-// The code in the following sections goes here.
-
-}
-```
-
-## Define variables
-
-The following code sets the `subscriptionKey`, `host`, `path`, and `searchTerm`. Add this code to the `BingWebSearch` class described in the previous section:
-
-1. For the `host` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-2. Replace the `subscriptionKey` value with a valid subscription key from your Azure account.
-
-3. Optionally, customize the search query by replacing the value for `searchTerm`.
-
-```java
-// Enter a valid subscription key.
-static String subscriptionKey = "enter key here";
-
-/*
- * If you encounter unexpected authorization errors, double-check these values
- * against the endpoint for your Bing Web search instance in your Azure
- * dashboard.
- */
-static String host = "https://api.cognitive.microsoft.com";
-static String path = "/bing/v7.0/search";
-static String searchTerm = "Microsoft Cognitive Services";
-```
-
-## Construct a request
-
-The `SearchWeb()` method, which is included in the `BingWebSearch` class, constructs the `url`, receives and parses the response, and extracts Bing-related HTTP headers.
-
-```java
-public static SearchResults SearchWeb (String searchQuery) throws Exception {
- // Construct the URL.
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8"));
-
- // Open the connection.
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
-
- // Receive the JSON response body.
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
-
- // Construct the result object.
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
-
- // Extract Bing-related HTTP headers.
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")){
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
- stream.close();
- return results;
-}
-```
-
-## Handle the response
-
-Use Gson to parse and reserialize the response.
-
-```java
-public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
-}
-```
-
-## Declare the main method
-
-The `main()` method is required and is the first method invoked when you start the program. In this application, it includes code that validates the `subscriptionKey`, makes a request, and then prints the JSON response.
-
-```java
-public static void main (String[] args) {
- // Confirm the subscriptionKey is valid.
- if (subscriptionKey.length() != 32) {
- System.out.println("Invalid Bing Search API subscription key!");
- System.out.println("Please paste yours into the source code.");
- System.exit(1);
- }
-
- // Call the SearchWeb method and print the response.
- try {
- System.out.println("Searching the Web for: " + searchTerm);
- SearchResults result = SearchWeb(searchTerm);
- System.out.println("\nRelevant HTTP Headers:\n");
- for (String header : result.relevantHeaders.keySet())
- System.out.println(header + ": " + result.relevantHeaders.get(header));
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(result.jsonResponse));
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- System.exit(1);
- }
-}
-```
-
-## Create a container class for search results
-
-The `SearchResults` container class is defined outside of the `BingWebSearch` class. It includes relevant headers and JSON data for the response.
-
-```java
-class SearchResults{
- HashMap<String, String> relevantHeaders;
- String jsonResponse;
- SearchResults(HashMap<String, String> headers, String json) {
- relevantHeaders = headers;
- jsonResponse = json;
- }
-}
-```
-
-## Put it all together
-
-The last step is to compile your code and run it. Use the following commands:
-
-```powershell
-javac BingWebSearch.java -classpath ./gson-2.8.5.jar -encoding UTF-8
-java -cp ./gson-2.8.5.jar BingWebSearch
-```
-
-If you'd like to compare your code with ours, [sample code is available on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingWebSearchv7.java).
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Microsoft Cognitive Services"
- },
- "webPages": {
- "webSearchUrl": "https://www.bing.com/search?q=Microsoft+cognitive+services",
- "totalEstimatedMatches": 22300000,
- "value": [
- {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0",
- "name": "Microsoft Cognitive Services",
- "url": "https://www.microsoft.com/cognitive-services",
- "displayUrl": "https://www.microsoft.com/cognitive-services",
- "snippet": "Knock down barriers between you and your ideas. Enable natural and contextual interaction with tools that augment users' experiences via the power of machine-based AI. Plug them in and bring your ideas to life.",
- "deepLinks": [
- {
- "name": "Face",
- "url": "https://azure.microsoft.com/services/cognitive-services/face/",
- "snippet": "Add facial recognition to your applications to detect, identify, and verify faces using a Face service from Microsoft Azure. ... Cognitive Services; Face service;"
- },
- {
- "name": "Text Analytics",
- "url": "https://azure.microsoft.com/services/cognitive-services/text-analytics/",
- "snippet": "Cognitive Services; Text Analytics API; Text Analytics API . Detect sentiment, ... you agree that Microsoft may store it and use it to improve Microsoft services, ..."
- },
- {
- "name": "Computer Vision API",
- "url": "https://azure.microsoft.com/products/ai-services?activetab=pivot:visiontab",
- "snippet": "Extract the data you need from images using optical character recognition and image analytics with Computer Vision APIs from Microsoft Azure."
- },
- {
- "name": "Emotion",
- "url": "https://www.microsoft.com/cognitive-services/en-us/emotion-api",
- "snippet": "Cognitive Services Emotion API - microsoft.com"
- },
- {
- "name": "Bing Speech API",
- "url": "https://azure.microsoft.com/services/cognitive-services/speech/",
- "snippet": "Add speech recognition to your applications, including text to speech, with a speech API from Microsoft Azure. ... Cognitive Services; Bing Speech API;"
- },
- {
- "name": "Get Started for Free",
- "url": "https://azure.microsoft.com/services/cognitive-services/",
- "snippet": "Add vision, speech, language, and knowledge capabilities to your applications using intelligence APIs and SDKs from Cognitive Services."
- }
- ]
- }
- ]
- },
- "relatedSearches": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches",
- "value": [
- {
- "text": "microsoft bot framework",
- "displayText": "microsoft bot framework",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+bot+framework"
- },
- {
- "text": "microsoft cognitive services youtube",
- "displayText": "microsoft cognitive services youtube",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+youtube"
- },
- {
- "text": "microsoft cognitive services search api",
- "displayText": "microsoft cognitive services search api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+search+api"
- },
- {
- "text": "microsoft cognitive services news",
- "displayText": "microsoft cognitive services news",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+news"
- },
- {
- "text": "ms cognitive service",
- "displayText": "ms cognitive service",
- "webSearchUrl": "https://www.bing.com/search?q=ms+cognitive+service"
- },
- {
- "text": "microsoft cognitive services text analytics",
- "displayText": "microsoft cognitive services text analytics",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+text+analytics"
- },
- {
- "text": "microsoft cognitive services toolkit",
- "displayText": "microsoft cognitive services toolkit",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+toolkit"
- },
- {
- "text": "microsoft cognitive services api",
- "displayText": "microsoft cognitive services api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+api"
- }
- ]
- },
- "rankingResponse": {
- "mainline": {
- "items": [
- {
- "answerType": "WebPages",
- "resultIndex": 0,
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0"
- }
- }
- ]
- },
- "sidebar": {
- "items": [
- {
- "answerType": "RelatedSearches",
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches"
- }
- }
- ]
- }
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/nodejs.md
- Title: "Quickstart: Perform a web search with Node.js - Bing Web Search REST API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using Node.js, and receive a JSON response
------ Previously updated : 05/22/2020--
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using Node.js.
--
-# Quickstart: Search the web using the Bing Web Search REST API and Node.js
--
-Use this quickstart to make your first call to the Bing Web Search API. This Node.js application sends a search request to the API, and shows the JSON response. Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-Here are a few things that you'll need before running this quickstart:
-
-* [Node.js 6](https://nodejs.org/en/download/) or later
-* A subscription key
--
-## Create a project and declare required modules
-
-Create a new Node.js project in your favorite IDE or editor. Then, copy the following code snippet to your project in a file named search.js:
-
-```javascript
-// Use this simple app to query the Bing Web Search API and get a JSON response.
-// Usage: node search.js "your query".
-const https = require('https')
-```
-
-## Set the subscription key
-
-This code snippet uses the `AZURE_SUBSCRIPTION_KEY` environment variable to store your subscription key, which is a good practice to prevent the accidental exposure of your keys when deploying code.
-
-If you're unfamiliar with the use of environment variables, or you want to run this app as fast as possible, replace `process.env['AZURE_SUBSCRIPTION_KEY']` with your subscription key set as a string.
-
-```javascript
-const SUBSCRIPTION_KEY = process.env['AZURE_SUBSCRIPTION_KEY']
-if (!SUBSCRIPTION_KEY) {
- throw new Error('AZURE_SUBSCRIPTION_KEY is not set.')
-}
-```
-
-## Create a function to make the request
-
-This function makes a secure GET request and saves the search query as a query parameter in the path.
-
-1. For the `hostname` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-2. Use `encodeURIComponent` to escape invalid characters. The subscription key is passed in a header.
-
-3. The callback receives a [response](https://nodejs.org/dist/latest-v10.x/docs/api/http.html#http_class_http_serverresponse) that subscribes to the `data` event to aggregate the JSON body, the `error` event to log any issues, and the `end` event to know when the message should be considered complete.
-
-4. When the app is complete, it prints the relevant headers and message body. You can adjust the colors and set the depth to suit your preference. A depth of `1` gives a nice summary of the response.
-
-```javascript
-function bingWebSearch(query) {
- https.get({
- hostname: 'api.cognitive.microsoft.com',
- path: '/bing/v7.0/search?q=' + encodeURIComponent(query),
- headers: { 'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY },
- }, res => {
- let body = ''
- res.on('data', part => body += part)
- res.on('end', () => {
- for (var header in res.headers) {
- if (header.startsWith("bingapis-") || header.startsWith("x-msedge-")) {
- console.log(header + ": " + res.headers[header])
- }
- }
- console.log('\nJSON Response:\n')
- console.dir(JSON.parse(body), { colors: false, depth: null })
- })
- res.on('error', e => {
- console.log('Error: ' + e.message)
- throw e
- })
- })
-}
-```
-
-## Get the query
-
-Let's look at the program's arguments to find the query. The first argument is the path to the node, the second is our filename, and the third is your query. If the query is absent, a default query of "Microsoft Azure AI services" is used.
-
-```javascript
-const query = process.argv[2] || 'Microsoft Cognitive Services'
-```
-
-## Make a request and print the response
-
-Now that everything is defined, let's call our function.
-
-```javascript
-bingWebSearch(query)
-```
-
-## Put it all together
-
-The last step is to run your code with the command: `node search.js "<your query>"`.
-
-If you'd like to compare your code with ours, here's the complete program:
-
-```javascript
-const https = require('https')
-const SUBSCRIPTION_KEY = process.env['AZURE_SUBSCRIPTION_KEY']
-if (!SUBSCRIPTION_KEY) {
- throw new Error('Missing the AZURE_SUBSCRIPTION_KEY environment variable')
-}
-function bingWebSearch(query) {
- https.get({
- hostname: 'api.cognitive.microsoft.com',
- path: '/bing/v7.0/search?q=' + encodeURIComponent(query),
- headers: { 'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY },
- }, res => {
- let body = ''
- res.on('data', part => body += part)
- res.on('end', () => {
- for (var header in res.headers) {
- if (header.startsWith("bingapis-") || header.startsWith("x-msedge-")) {
- console.log(header + ": " + res.headers[header])
- }
- }
- console.log('\nJSON Response:\n')
- console.dir(JSON.parse(body), { colors: false, depth: null })
- })
- res.on('error', e => {
- console.log('Error: ' + e.message)
- throw e
- })
- })
-}
-const query = process.argv[2] || 'Microsoft Cognitive Services'
-bingWebSearch(query)
-```
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Microsoft Cognitive Services"
- },
- "webPages": {
- "webSearchUrl": "https://www.bing.com/search?q=Microsoft+cognitive+services",
- "totalEstimatedMatches": 22300000,
- "value": [
- {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0",
- "name": "Microsoft Cognitive Services",
- "url": "https://www.microsoft.com/cognitive-services",
- "displayUrl": "https://www.microsoft.com/cognitive-services",
- "snippet": "Knock down barriers between you and your ideas. Enable natural and contextual interaction with tools that augment users' experiences via the power of machine-based AI. Plug them in and bring your ideas to life.",
- "deepLinks": [
- {
- "name": "Face",
- "url": "https://azure.microsoft.com/services/cognitive-services/face/",
- "snippet": "Add facial recognition to your applications to detect, identify, and verify faces using a Face service from Microsoft Azure. ... Cognitive Services; Face service;"
- },
- {
- "name": "Text Analytics",
- "url": "https://azure.microsoft.com/services/cognitive-services/text-analytics/",
- "snippet": "Cognitive Services; Text Analytics API; Text Analytics API . Detect sentiment, ... you agree that Microsoft may store it and use it to improve Microsoft services, ..."
- },
- {
- "name": "Computer Vision API",
- "url": "https://azure.microsoft.com/products/ai-services?activetab=pivot:visiontab",
- "snippet": "Extract the data you need from images using optical character recognition and image analytics with Computer Vision APIs from Microsoft Azure."
- },
- {
- "name": "Emotion",
- "url": "https://www.microsoft.com/cognitive-services/emotion-api",
- "snippet": "Cognitive Services Emotion API - microsoft.com"
- },
- {
- "name": "Bing Speech API",
- "url": "https://azure.microsoft.com/services/cognitive-services/speech/",
- "snippet": "Add speech recognition to your applications, including text to speech, with a speech API from Microsoft Azure. ... Cognitive Services; Bing Speech API;"
- },
- {
- "name": "Get Started for Free",
- "url": "https://azure.microsoft.com/services/cognitive-services/",
- "snippet": "Add vision, speech, language, and knowledge capabilities to your applications using intelligence APIs and SDKs from Cognitive Services."
- }
- ]
- }
- ]
- },
- "relatedSearches": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches",
- "value": [
- {
- "text": "microsoft bot framework",
- "displayText": "microsoft bot framework",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+bot+framework"
- },
- {
- "text": "microsoft cognitive services youtube",
- "displayText": "microsoft cognitive services youtube",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+youtube"
- },
- {
- "text": "microsoft cognitive services search api",
- "displayText": "microsoft cognitive services search api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+search+api"
- },
- {
- "text": "microsoft cognitive services news",
- "displayText": "microsoft cognitive services news",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+news"
- },
- {
- "text": "ms cognitive service",
- "displayText": "ms cognitive service",
- "webSearchUrl": "https://www.bing.com/search?q=ms+cognitive+service"
- },
- {
- "text": "microsoft cognitive services text analytics",
- "displayText": "microsoft cognitive services text analytics",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+text+analytics"
- },
- {
- "text": "microsoft cognitive services toolkit",
- "displayText": "microsoft cognitive services toolkit",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+toolkit"
- },
- {
- "text": "microsoft cognitive services api",
- "displayText": "microsoft cognitive services api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+api"
- }
- ]
- },
- "rankingResponse": {
- "mainline": {
- "items": [
- {
- "answerType": "WebPages",
- "resultIndex": 0,
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0"
- }
- }
- ]
- },
- "sidebar": {
- "items": [
- {
- "answerType": "RelatedSearches",
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches"
- }
- }
- ]
- }
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Php https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/php.md
- Title: "Quickstart: Perform a search with PHP - Bing Web Search API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using PHP, and receive a JSON response
------ Previously updated : 05/22/2020--
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using PHP.
--
-# Quickstart: Use PHP to call the Bing Web Search API
--
-Use this quickstart to make your first call to the Bing Web Search API. This Node.js application sends a search request to the API, and shows the JSON response. Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-Here are a few things that you'll need before running this quickstart:
-
-* [PHP 5.6.x](https://php.net/downloads.php) or later
-* A subscription key
--
-## Enable secure HTTP support
-
-Before we get started, locate php.ini and uncomment this line:
-
-```php
-; extension=php_openssl.dll
-```
-
-## Create a project and define variables
-
-1. Create a new PHP project in your favorite IDE or editor. Add opening and closing tags: `<?php` and `?>`.
-
-2. For the `$endpoint` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-3. Confirm that the `$endpoint` value is correct and replace the `$accesskey` value with a valid subscription key from your Azure account.
-
-4. Optionally, customize the search query by replacing the value for `$term`.
-
-```php
-$accessKey = 'enter key here';
-$endpoint = 'https://api.cognitive.microsoft.com/bing/v7.0/search';
-$term = 'Microsoft Cognitive Services';
-```
-
-## Construct a request
-
-This code declares a function called `BingWebSearch` that's used to construct requests to the Bing Web Search API. It takes three arguments: `$url`, `$key`, and `$query`.
-
-```php
-function BingWebSearch ($url, $key, $query) {
- /* Prepare the HTTP request.
- * NOTE: Use the key 'http' even if you are making an HTTPS request.
- * See: http://php.net/manual/en/function.stream-context-create.php.
- */
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
- $options = array ('http' => array (
- 'header' => $headers,
- 'method' => 'GET'));
-
- // Perform the request and get a JSON response.
- $context = stream_context_create($options);
- $result = file_get_contents($url . "?q=" . urlencode($query), false, $context);
-
- // Extract Bing HTTP headers.
- $headers = array();
- foreach ($http_response_header as $k => $v) {
- $h = explode(":", $v, 2);
- if (isset($h[1]))
- if (preg_match("/^BingAPIs-/", $h[0]) || preg_match("/^X-MSEdge-/", $h[0]))
- $headers[trim($h[0])] = trim($h[1]);
- }
-
- return array($headers, $result);
-}
-```
-
-## Make a request and print the response
-
-This code validates the subscription key, makes a request, and prints the response.
-
-```php
-// Validates the subscription key.
-if (strlen($accessKey) == 32) {
-
- print "Searching the Web for: " . $term . "\n";
- // Makes the request.
- list($headers, $json) = BingWebSearch($endpoint, $accessKey, $term);
-
- print "\nRelevant Headers:\n\n";
- foreach ($headers as $k => $v) {
- print $k . ": " . $v . "\n";
- }
- // Prints JSON encoded response.
- print "\nJSON Response:\n\n";
- echo json_encode(json_decode($json), JSON_PRETTY_PRINT);
-
-} else {
-
- print("Invalid Bing Search API subscription key!\n");
- print("Please paste yours into the source code.\n");
-
-}
-```
-
-## Put it all together
-
-The last step is to validate your code and run it. If you'd like to compare your code with ours, here's the complete program:
-
-```php
-<?php
-$accessKey = 'enter key here';
-$endpoint = 'https://api.cognitive.microsoft.com/bing/v7.0/search';
-$term = 'Microsoft Cognitive Services';
-
-function BingWebSearch ($url, $key, $query) {
- $headers = "Ocp-Apim-Subscription-Key: $key\r\n";
- $options = array ('http' => array (
- 'header' => $headers,
- 'method' => 'GET'));
- $context = stream_context_create($options);
- $result = file_get_contents($url . "?q=" . urlencode($query), false, $context);
- $headers = array();
- foreach ($http_response_header as $k => $v) {
- $h = explode(":", $v, 2);
- if (isset($h[1]))
- if (preg_match("/^BingAPIs-/", $h[0]) || preg_match("/^X-MSEdge-/", $h[0]))
- $headers[trim($h[0])] = trim($h[1]);
- }
- return array($headers, $result);
-}
-
-if (strlen($accessKey) == 32) {
- print "Searching the Web for: " . $term . "\n";
- list($headers, $json) = BingWebSearch($endpoint, $accessKey, $term);
- print "\nRelevant Headers:\n\n";
- foreach ($headers as $k => $v) {
- print $k . ": " . $v . "\n";
- }
- print "\nJSON Response:\n\n";
- echo json_encode(json_decode($json), JSON_PRETTY_PRINT);
-
-} else {
- print("Invalid Bing Search API subscription key!\n");
- print("Please paste yours into the source code.\n");
-}
-?>
-```
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Microsoft Cognitive Services"
- },
- "webPages": {
- "webSearchUrl": "https://www.bing.com/search?q=Microsoft+cognitive+services",
- "totalEstimatedMatches": 22300000,
- "value": [
- {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0",
- "name": "Microsoft Cognitive Services",
- "url": "https://www.microsoft.com/cognitive-services",
- "displayUrl": "https://www.microsoft.com/cognitive-services",
- "snippet": "Knock down barriers between you and your ideas. Enable natural and contextual interaction with tools that augment users' experiences via the power of machine-based AI. Plug them in and bring your ideas to life.",
- "deepLinks": [
- {
- "name": "Face",
- "url": "https://azure.microsoft.com/services/cognitive-services/face/",
- "snippet": "Add facial recognition to your applications to detect, identify, and verify faces using the Face service from Microsoft Azure. ... Cognitive Services; Face service;"
- },
- {
- "name": "Text Analytics",
- "url": "https://azure.microsoft.com/services/cognitive-services/text-analytics/",
- "snippet": "Cognitive Services; Text Analytics API; Text Analytics API . Detect sentiment, ... you agree that Microsoft may store it and use it to improve Microsoft services, ..."
- },
- {
- "name": "Computer Vision API",
- "url": "https://azure.microsoft.com/products/ai-services?activetab=pivot:visiontab",
- "snippet": "Extract the data you need from images using optical character recognition and image analytics with Computer Vision APIs from Microsoft Azure."
- },
- {
- "name": "Emotion",
- "url": "https://www.microsoft.com/cognitive-services/en-us/emotion-api",
- "snippet": "Cognitive Services Emotion API - microsoft.com"
- },
- {
- "name": "Bing Speech API",
- "url": "https://azure.microsoft.com/services/cognitive-services/speech/",
- "snippet": "Add speech recognition to your applications, including text to speech, with a speech API from Microsoft Azure. ... Cognitive Services; Bing Speech API;"
- },
- {
- "name": "Get Started for Free",
- "url": "https://azure.microsoft.com/services/cognitive-services/",
- "snippet": "Add vision, speech, language, and knowledge capabilities to your applications using intelligence APIs and SDKs from Cognitive Services."
- }
- ]
- }
- ]
- },
- "relatedSearches": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches",
- "value": [
- {
- "text": "microsoft bot framework",
- "displayText": "microsoft bot framework",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+bot+framework"
- },
- {
- "text": "microsoft cognitive services youtube",
- "displayText": "microsoft cognitive services youtube",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+youtube"
- },
- {
- "text": "microsoft cognitive services search api",
- "displayText": "microsoft cognitive services search api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+search+api"
- },
- {
- "text": "microsoft cognitive services news",
- "displayText": "microsoft cognitive services news",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+news"
- },
- {
- "text": "ms cognitive service",
- "displayText": "ms cognitive service",
- "webSearchUrl": "https://www.bing.com/search?q=ms+cognitive+service"
- },
- {
- "text": "microsoft cognitive services text analytics",
- "displayText": "microsoft cognitive services text analytics",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+text+analytics"
- },
- {
- "text": "microsoft cognitive services toolkit",
- "displayText": "microsoft cognitive services toolkit",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+toolkit"
- },
- {
- "text": "microsoft cognitive services api",
- "displayText": "microsoft cognitive services api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+api"
- }
- ]
- },
- "rankingResponse": {
- "mainline": {
- "items": [
- {
- "answerType": "WebPages",
- "resultIndex": 0,
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0"
- }
- }
- ]
- },
- "sidebar": {
- "items": [
- {
- "answerType": "RelatedSearches",
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches"
- }
- }
- ]
- }
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/python.md
- Title: "Quickstart: Perform a search with Python - Bing Web Search API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using Python, and receive a JSON response
------ Previously updated : 05/22/2020--
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using Python.
--
-# Quickstart: Use Python to call the Bing Web Search API
--
-Use this quickstart to make your first call to the Bing Web Search API. This Python application sends a search request to the API, and shows the JSON response. Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-This example is run as a Jupyter notebook on [MyBinder](https://mybinder.org). To run it, select the launch binder badge:
-
-[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/Microsoft/cognitive-services-notebooks/master?filepath=BingWebSearchAPI.ipynb)
-
-## Prerequisites
-
-* [Python 2.x or 3.x](https://www.python.org/)
--
-## Define variables
-
-1. Replace the `subscription_key` value with a valid subscription key from your Azure account.
-
- ```python
- subscription_key = "YOUR_ACCESS_KEY"
- assert subscription_key
- ```
-
-2. Declare the Bing Web Search API endpoint. You can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
- search_url = "https://api.bing.microsoft.com/v7.0/search"
- ```
-
-3. Optionally, customize the search query by replacing the value for `search_term`.
-
- ```python
- search_term = "Azure Cognitive Services"
- ```
-
-## Make a request
-
-This code uses the `requests` library to call the Bing Web Search API and return the results as a JSON object. The API key is passed in the `headers` dictionary, and the search term and query parameters are passed in the `params` dictionary.
-
-For a complete list of options and parameters, see [Bing Web Search API v7](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference).
-
-```python
-import requests
-
-headers = {"Ocp-Apim-Subscription-Key": subscription_key}
-params = {"q": search_term, "textDecorations": True, "textFormat": "HTML"}
-response = requests.get(search_url, headers=headers, params=params)
-response.raise_for_status()
-search_results = response.json()
-```
-
-## Format and display the response
-
-The `search_results` object includes the search results, and such metadata as related queries and pages. This code uses the `IPython.display` library to format and display the response in your browser.
-
-```python
-from IPython.display import HTML
-
-rows = "\n".join(["""<tr>
- <td><a href=\"{0}\">{1}</a></td>
- <td>{2}</td>
- </tr>""".format(v["url"], v["name"], v["snippet"])
- for v in search_results["webPages"]["value"]])
-HTML("<table>{0}</table>".format(rows))
-```
-
-## Sample code on GitHub
-
-To run this code locally, see the complete [sample available on GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingWebSearchv7.py).
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/quickstarts/ruby.md
- Title: "Quickstart: Perform a web search with Ruby - Bing Web Search API"-
-description: Use this quickstart to send requests to the Bing Web Search REST API using Ruby, and receive a JSON response
------ Previously updated : 05/22/2020--
-#Customer intent: As a new developer, I want to make my first call to the Bing Web Search API and receive a response using Ruby.
--
-# Quickstart: Use Ruby to call the Bing Web Search API
--
-Use this quickstart to make your first call to the Bing Web Search API. This Ruby application sends a search request to the API, and shows the JSON response. Although this application is written in Ruby, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-Here are a few things that you'll need before running this quickstart:
-
-* [Ruby 2.4 or later](https://www.ruby-lang.org/en/downloads/)
-* A subscription key
--
-## Create a project and declare required modules
-
-Create a new Ruby project in your favorite IDE or editor. Then, require `net/https` for requests, `uri` for URI handling, and `json` to parse the response.
-
-```ruby
-require 'net/https'
-require 'uri'
-require 'json'
-```
-
-## Define variables
-
-A few variables must be set before we can continue:
-
-1. For the `uri` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-2. Confirm that the `uri` and `path` values are valid and replace the `accessKey` value with a subscription key from your Azure account.
-
-3. Optionally, customize the search query by replacing the value for `term`.
-
-```ruby
-accessKey = "YOUR_SUBSCRIPTION_KEY"
-uri = "https://api.cognitive.microsoft.com"
-path = "/bing/v7.0/search"
-term = "Microsoft Cognitive Services"
-
-if accessKey.length != 32 then
- puts "Invalid Bing Search API subscription key!"
- puts "Please paste yours into the source code."
- abort
-end
-```
-
-## Make a request
-
-Use this code to make a request and handle the response:
-
-```ruby
-# Construct the endpoint uri.
-
-uri = URI(uri + path + "?q=" + URI.escape(term))
-puts "Searching the Web for: " + term
-
-# Create the request.
-
-request = Net::HTTP::Get.new(uri)
-request['Ocp-Apim-Subscription-Key'] = accessKey
-
-# Get the response.
-
-response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
-end
-```
-
-## Print the response
-
-Validate the headers, format the response data as JSON, and print the results.
-
-```ruby
-puts "\nRelevant Headers:\n\n"
-response.each_header do |key, value|
- # Header names are lower-cased.
- if key.start_with?("bingapis-") or key.start_with?("x-msedge-") then
- puts key + ": " + value
- end
-end
-
-puts "\nJSON Response:\n\n"
-puts JSON::pretty_generate(JSON(response.body))
-```
-
-## Put it all together
-
-The last step is to validate your code and run it. If you'd like to compare your code with ours, here's the complete program:
-
-```ruby
-require 'net/https'
-require 'uri'
-require 'json'
-
-accessKey = "enter key here"
-uri = "https://api.cognitive.microsoft.com"
-path = "/bing/v7.0/search"
-term = "Microsoft Cognitive Services"
-
-if accessKey.length != 32 then
- puts "Invalid Bing Search API subscription key!"
- puts "Please paste yours into the source code."
- abort
-end
-
-uri = URI(uri + path + "?q=" + URI.escape(term))
-puts "Searching the Web for: " + term
-
-request = Net::HTTP::Get.new(uri)
-request['Ocp-Apim-Subscription-Key'] = accessKey
-
-response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
-end
-
-puts "\nRelevant Headers:\n\n"
-response.each_header do |key, value|
- if key.start_with?("bingapis-") or key.start_with?("x-msedge-") then
- puts key + ": " + value
- end
-end
-
-puts "\nJSON Response:\n\n"
-puts JSON::pretty_generate(JSON(response.body))
-```
-
-## Example JSON response
-
-Responses from the Bing Web Search API are returned as JSON. This sample response has been truncated to show a single result.
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "Microsoft Cognitive Services"
- },
- "webPages": {
- "webSearchUrl": "https://www.bing.com/search?q=Microsoft+cognitive+services",
- "totalEstimatedMatches": 22300000,
- "value": [
- {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0",
- "name": "Microsoft Cognitive Services",
- "url": "https://www.microsoft.com/cognitive-services",
- "displayUrl": "https://www.microsoft.com/cognitive-services",
- "snippet": "Knock down barriers between you and your ideas. Enable natural and contextual interaction with tools that augment users' experiences via the power of machine-based AI. Plug them in and bring your ideas to life.",
- "deepLinks": [
- {
- "name": "Face",
- "url": "https://azure.microsoft.com/services/cognitive-services/face/",
- "snippet": "Add facial recognition to your applications to detect, identify, and verify faces using the Face service from Microsoft Azure. ... Cognitive Services; Face service;"
- },
- {
- "name": "Text Analytics",
- "url": "https://azure.microsoft.com/services/cognitive-services/text-analytics/",
- "snippet": "Cognitive Services; Text Analytics API; Text Analytics API . Detect sentiment, ... you agree that Microsoft may store it and use it to improve Microsoft services, ..."
- },
- {
- "name": "Computer Vision API",
- "url": "https://azure.microsoft.com/products/ai-services?activetab=pivot:visiontab",
- "snippet": "Extract the data you need from images using optical character recognition and image analytics with Computer Vision APIs from Microsoft Azure."
- },
- {
- "name": "Emotion",
- "url": "https://www.microsoft.com/cognitive-services/en-us/emotion-api",
- "snippet": "Cognitive Services Emotion API - microsoft.com"
- },
- {
- "name": "Bing Speech API",
- "url": "https://azure.microsoft.com/services/cognitive-services/speech/",
- "snippet": "Add speech recognition to your applications, including text to speech, with a speech API from Microsoft Azure. ... Cognitive Services; Bing Speech API;"
- },
- {
- "name": "Get Started for Free",
- "url": "https://azure.microsoft.com/services/cognitive-services/",
- "snippet": "Add vision, speech, language, and knowledge capabilities to your applications using intelligence APIs and SDKs from Cognitive Services."
- }
- ]
- }
- ]
- },
- "relatedSearches": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches",
- "value": [
- {
- "text": "microsoft bot framework",
- "displayText": "microsoft bot framework",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+bot+framework"
- },
- {
- "text": "microsoft cognitive services youtube",
- "displayText": "microsoft cognitive services youtube",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+youtube"
- },
- {
- "text": "microsoft cognitive services search api",
- "displayText": "microsoft cognitive services search api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+search+api"
- },
- {
- "text": "microsoft cognitive services news",
- "displayText": "microsoft cognitive services news",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+news"
- },
- {
- "text": "ms cognitive service",
- "displayText": "ms cognitive service",
- "webSearchUrl": "https://www.bing.com/search?q=ms+cognitive+service"
- },
- {
- "text": "microsoft cognitive services text analytics",
- "displayText": "microsoft cognitive services text analytics",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+text+analytics"
- },
- {
- "text": "microsoft cognitive services toolkit",
- "displayText": "microsoft cognitive services toolkit",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+toolkit"
- },
- {
- "text": "microsoft cognitive services api",
- "displayText": "microsoft cognitive services api",
- "webSearchUrl": "https://www.bing.com/search?q=microsoft+cognitive+services+api"
- }
- ]
- },
- "rankingResponse": {
- "mainline": {
- "items": [
- {
- "answerType": "WebPages",
- "resultIndex": 0,
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.0"
- }
- }
- ]
- },
- "sidebar": {
- "items": [
- {
- "answerType": "RelatedSearches",
- "value": {
- "id": "https://api.cognitive.microsoft.com/api/v7/#RelatedSearches"
- }
- }
- ]
- }
- }
-}
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API single-page app tutorial](../tutorial-bing-web-search-single-page-app.md)
-
cognitive-services Rank Results https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/rank-results.md
- Title: How to use rankings to display search results - Bing Web Search API-
-description: Learn how to use ranking to display search results from the Bing Web Search API.
------ Previously updated : 03/17/2019---
-# How to use ranking to display Bing Web Search API results
--
-Each search response includes a [RankingResponse](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#rankingresponse) answer, that specifies how you must display the search results. The ranking response groups results by mainline content and sidebar content for a traditional search results page. If you do not display the results in a traditional mainline and sidebar format, you must provide the mainline content higher visibility than the sidebar content.
-
-Within each group (mainline or sidebar), the [Items](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#rankinggroup-items) array identifies the order that the content must appear in. Each item provides the following two ways to identify the result within an answer.
--- `answerType` and `resultIndex` ΓÇö The `answerType` field identifies the answer (for example, Webpage or News) and `resultIndex` identifies a result within the answer (for example, a news article). The index is zero based. --- `value` ΓÇö The `value` field contains an ID that matches the ID of either an answer or a result within the answer. Either the answer or the results contain the ID but not both. -
-Using the ID is simpler to use because you only need to match the ranking ID with the ID of an answer or one of its results. If an answer object includes an `id` field, display all the answer's results together. For example, if the `News` object includes the `id` field, display all the news articles together. If the `News` object does not include the `id` field, then each news article contains an `id` field and the ranking response mixes the news articles with the results from other answers.
-
-Using the `answerType` and `resultIndex` is a little more complicated. You use `answerType` to identify the answer that contains the results to display. Then, you use `resultIndex` to index through the answer's results to get the result to display. (The `answerType` value is the name of the field in the [SearchResponse](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#searchresponse) object.) If you're supposed to display all the answer's results together, the ranking response item doesn't include the `resultIndex` field.
-
-## Ranking response example
-
-The following shows an example [RankingResponse](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#rankingresponse). Because the Web answer does not include an `id` field, you'd display all webpages individually based on the ranking (each webpage includes an `id` field). And because the images, videos, and related searches answers do include the `id` field, you'd display the results of each of those answers together based on the ranking.
-
-```json
-{
- "_type" : "SearchResponse",
- "webPages" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF214...",
- "totalEstimatedMatches" : 835000,
- "value" : [
- {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.0",
- "name" : "Motor Sports - Live at the race track ...",
- "url" : "http:\/\/www.bing.com\/cr?IG=96C4CF214A0A43...",
- "displayUrl" : "www.contoso.com\/usa\/eventsandracing\/motorsport",
- "snippet" : "Here you will find detailed information about racing...",
- "deepLinks" : [{
- "name" : "Customer Racing",
- "url" : "http:\/\/www.bing.com\/cr?IG=96C4CF214A0A43...",
- "snippet" : "Customer racing news; General news..."
- },
- . . .
- ]
- }],
- "images" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Images",
- "readLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/images...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF214A...",
- "isFamilyFriendly" : true,
- "value" : [
- {
- "name" : "2016 Supercar Wallpapers",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4...",
- "thumbnailUrl" : "https:\/\/tse1.mm.bing.net\/th?id=OIP...",
- "datePublished" : "2017-03-25T11:14:00",
- "contentUrl" : "http:\/\/www.contoso.com\/wall...",
- "hostPageUrl" : "http:\/\/www.bing.com\/cr?IG=96C4CF214...",
- "contentSize" : "373283 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "http:\/\/www.contoso.com\/lmp-...",
- "width" : 1920,
- "height" : 1080,
- "thumbnail" : {
- "width" : 300,
- "height" : 168
- },
- "insightsSourcesSummary" : {
- "shoppingSourcesCount" : 0,
- "recipeSourcesCount" : 0
- }
- },
- . . .
- ]
- },
- "relatedSearches" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#RelatedSearches",
- "value" : [
- {
- "text" : "vintage racing teams",
- "displayText" : "vintage racing teams",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF2..."
- },
- . . .
- ]
- },
- "videos" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Videos",
- "readLink" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/videos...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF214A...",
- "isFamilyFriendly" : true,
- "value" : [
- {
- "name" : "Why We Race",
- "description" : "A new era begins in motorsports this weekend...",
- "webSearchUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF2...",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OVP.Vo1...",
- "datePublished" : "2014-01-25T16:31:48",
- "publisher" : [
- {
- "name" : "Fabrikam"
- }
- ],
- "contentUrl" : "https:\/\/www.fabrikam.com\/watch?v=oL...",
- "hostPageUrl" : "https:\/\/www.bing.com\/cr?IG=96C4CF214...",
- "encodingFormat" : "mp4",
- "hostPageDisplayUrl" : "https:\/\/www.fabrikam.com\/watch?v=oLAZgD...",
- "width" : 480,
- "height" : 360,
- "duration" : "PT2M42S",
- "motionThumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OM...",
- "embedHtml" : "<iframe width=\"1280\" height=\"720\" src=\"http:\/\/www.you...<\/iframe>",
- "allowHttpsEmbed" : true,
- "viewCount" : 47325,
- "thumbnail" : {
- "width" : 300,
- "height" : 168
- },
- "allowMobileEmbed" : true,
- "isSuperfresh" : false
- },
- . . .
- ]
- },
- "rankingResponse" : {
- "mainline" : {
- "items" : [{
- "answerType" : "WebPages",
- "resultIndex" : 0,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.0"
- }
- },
- {
- "answerType" : "Images",
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Images"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 1,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.1"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 2,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.2"
- }
- },
- {
- "answerType" : "Videos",
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#Videos"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 3,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.3"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 4,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.4"
- }
- },
- {
- "answerType" : "WebPages",
- "resultIndex" : 5,
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.5"
- }
- }]
- },
- "sidebar" : {
- "items" : [{
- "answerType" : "RelatedSearches",
- "value" : {
- "id" : "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#RelatedSearches"
- }
- }]
- }
- }
-}
-```
-
-Based on this ranking response, the mainline would display the following search results:
--- The first webpage result-- All the images -- The second and third webpage results -- All the videos -- The 4th, 5th, and 6th webpage results -
-And the sidebar would display the following search results:
--- All the related searches --
-## Next steps
-
-For information about promoting unranked results, see [Promoting answers that are not ranked](./filter-answers.md#promoting-answers-that-are-not-ranked).
-
-For information about limiting the number of ranked answers in the response, see [Limiting the number of answers in the response](./filter-answers.md#limiting-the-number-of-answers-in-the-response).
-
-For a C# example that uses ranking to display results, see [C# ranking tutorial](./csharp-ranking-tutorial.md).
cognitive-services Resize And Crop Thumbnails https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/resize-and-crop-thumbnails.md
- Title: Resize and crop image thumbnails - Bing Web Search API-
-description: Some answers from the Bing Search APIs include URLs to thumbnail images served by Bing, which you can resize and crop, and may contain query parameters.
------ Previously updated : 07/08/2019---
-# Resize and crop thumbnail images
--
-Some answers from the Bing Search APIs include URLs to thumbnail images served by Bing, which you can resize and crop, and may contain query parameters. For example:
-
-`https://<host>/th?id=AMMS_92772df988...&w=110&h=73&rs=1&qlt=80&cdv=1&pid=16.1`
-
-If you display a subset of these thumbnails, provide an option to view the remaining images.
-
-> [!NOTE]
-> Be sure that cropping and resizing thumbnail images will provide a search scenario that respects third party rights, as required by the Bing Search API [use and display requirements](use-display-requirements.md).
-
-## Resize a thumbnail
-
-To resize a thumbnail, Bing recommends that you specify only one the `w` (width) or `h` (height) query parameters in the thumbnail's URL. Specifying only the height or width lets Bing maintain the image's original aspect. Specify the width and height in pixels.
-
-For example, if the original thumbnail is 480x620:
-
-`https://<host>/th?id=JN.5l3yzwy%2f%2fHj59U6XhssIQ&pid=Api&w=480&h=620`
-
-And you want to decrease its size, set the `w` parameter to a new value (for example `336`), and remove the `h` parameter:
-
-`https://<host>/th?id=JN.5l3yzwy%2f%2fHj59U6XhssIQ&pid=Api&w=336`
-
-If you specify only the height or width of a thumbnail, the image's original aspect ratio will be maintained. If you specify both parameters, and the aspect ratio isn't maintained, Bing will add white padding to the border of the image.
-
-For example, if you resize a 480x359 image to 200x200 without cropping, the full width will contain the image but the height will contain 25 pixels of white padding at the top and bottom of the image. If the image was 359x480, the left and right borders would contain white padding. If you crop the image, white padding is not added.
-
-The following picture shows the original size of a thumbnail image (480x300).
-
-![Original landscape image](./media/resize-crop/bing-resize-crop-landscape.png)
-
-The following picture shows the image resized to 200x200. The aspect ratio is maintained and the top and bottom borders are padded with white (the black border here is included to show the padding).
-
-![Resized landscape image](./media/resize-crop/bing-resize-crop-landscape-resized.png)
-
-If you specify dimensions that are greater than the imageΓÇÖs original width and height, Bing will add white padding to the left and top borders.
-
-## Request different thumbnail sizes
-
-To request a different thumbnail image size, remove all query parameters from the thumbnail's URL, except the `id` and `pid` parameters. Then add either the `&w` (width) or `&h` (height) query parameter with the desired image size in pixels, but not both. Bing will maintain the image's original aspect ratio.
-
-To increase the width of the image specified by the above URL to 165 pixels, you would use the following URL:
-
-`https://<host>/th?id=AMMS_92772df988...&w=165&pid=16.1`
-
-If you request an image thatΓÇÖs larger than the imageΓÇÖs original size, Bing adds white padding around the image as needed. For example, if the imageΓÇÖs original size is 474x316 and you set `&w` to 500, Bing will return a 500x333 image. This image will have 8.5 pixels of white padding along the top and bottom edges, and 13 pixels of padding on the left and right edges.
-
-To prevent Bing from adding white padding if the requested size is greater than the imageΓÇÖs original size, set the `&p` query parameter to 0. For example, if you include the `&p=0` parameter in the above URL, Bing will return a 474x316 image instead of a 500x333 image:
-
-`https://<host>/th?id=AMMS_92772df988...&w=500&p=0&pid=16.1`
-
-If you specify both `&w` and `&h` query parameters, Bing will maintain the imageΓÇÖs aspect ratio and adds white padding as needed. For example, if the imageΓÇÖs original size is 474x316 and you set the width and height parameters to 200x200 (`&w=200&h=200`), Bing returns an image that contains 33 pixels of white padding on the top and bottom. If you include the `&p` query parameter, Bing returns an 200x134 image.
-
-## Crop a thumbnail
-
-To crop an image, include the `c` (crop) query parameter. You can use the following values:
-
-- `4` &mdash; Blind Ratio -- `7` &mdash; Smart Ratio -
-### Smart Ratio cropping
-
-If you request Smart Ratio cropping (by setting the `c` parameter to `7`), Bing will crop an image from the center of its region of interest outward, while maintaining the imageΓÇÖs aspect ratio. The region of interest is the area of the image that Bing determines contains the most import parts. The following shows an example region of interest.
-
-![Region of interest](./media/resize-crop/bing-resize-crop-regionofinterest.png)
-
-If you resize an image and request Smart Ratio cropping, Bing reduces the image to the requested size while maintaining the aspect ratio. Bing then crops the image based on the resized dimensions. For example, if the resized width is less than or equal to the height, Bing will crop the image to the left and right of the center of the region of interest. Otherwise, Bing will crop it to the top and bottom of the center of the region of interest.
-
-
-The following shows the image reduced to 200x200 using Smart Ratio cropping. Because Bing measures the image from the top-left corner, the bottom part of the image is cropped.
-
-![Landscape image cropped to 200x200](./media/resize-crop/bing-resize-crop-landscape200x200c7.png)
-
-The following shows the image reduced to 200x100 using Smart Ratio cropping. Because Bing measures the image from the top-left corner, the bottom part of the image is cropped.
-
-![Landscape image cropped to 200x100](./media/resize-crop/bing-resize-crop-landscape200x100c7.png)
-
-The following shows the image reduced to 100x200 using Smart Ratio cropping. Because Bing measures the image from the center, the left and right parts of the image are cropped.
-
-![Landscape image cropped to 100x200](./media/resize-crop/bing-resize-crop-landscape100x200c7.png)
-
-If Bing cannot determine the imageΓÇÖs region of interest, the service will use Blind Ratio cropping.
-
-### Blind Ratio cropping
-
-If you request Blind Ratio cropping (by setting the `c` parameter to `4`), Bing uses the following rules to crop the image.
-
-- If `(Original Image Width / Original Image Height) < (Requested Image Width / Requested Image Height)`, the image is measured from top-left corner and cropped at the bottom. -- If `(Original Image Width / Original Image Height) > (Requested Image Width / Requested Image Height)`, the image is measured from the center and cropped to the left and right. -
-The following shows a portrait image thatΓÇÖs 225x300.
-
-![Original sunflower image](./media/resize-crop/bing-resize-crop-sunflower.png)
-
-The following shows the image reduced to 200x200 using Blind Ratio cropping. The image is measured from the top-left corner resulting in the bottom part of the image being cropped.
-
-![Sunflower image cropped to 200x200](./media/resize-crop/bing-resize-crop-sunflower200x200c4.png)
-
-The following shows the image reduced to 200x100 using Blind Ratio cropping. The image is measured from the top-left corner resulting in the bottom part of the image being cropped.
-
-![Sunflower image cropped to 200x100](./media/resize-crop/bing-resize-crop-sunflower200x100c4.png)
-
-The following shows the image reduced to 100x200 using Blind Ratio cropping. The image is measured from the center resulting in the left and right parts of the image being cropped.
-
-![Sunflower image cropped to 100x200](./media/resize-crop/bing-resize-crop-sunflower100x200c4.png)
-
-## Next steps
-
-* [What are the Bing Search APIs?](bing-api-comparison.md)
-* [Bing Search API use and display requirements](use-display-requirements.md)
cognitive-services Sdk Samples https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/sdk-samples.md
- Title: Bing Web Search SDK samples-
-description: Use the Bing Web Search SDK to add search capabilities to your Python, Node.js, C#, or Java application.
------- Previously updated : 05/15/2019---
-# Bing Web Search SDK samples
--
-The Bing Web Search SDK is available in Python, Node.js, C#, and Java. Code samples, prerequisites, and build instructions are provided on GitHub. The following scenarios are covered:
-
-* Query a single word and print the name and URL of the first result for web pages, images, news articles, and videos.
-* Query a phrase, verify the number of results, and print out the name and URL of first result.
-* Query a search term with response filters set to `news` and print the details of news results.
-* Query a search term with `answerCount` and `promote` parameters, then print details of results.
-
-## SDKs and libraries
-
-Use these links to access the SDK for your preferred language.
-
-* Get started with [Python samples](https://github.com/Azure-Samples/cognitive-services-python-sdk-samples)
- * See also [Python libraries](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cognitiveservices/azure-cognitiveservices-search-websearch) for definitions and dependencies.
-* Get started with [Node.js samples](https://github.com/Azure-Samples/cognitive-services-node-sdk-samples)
- * See also [Node.js Web Search](https://github.com/Azure/azure-sdk-for-node/tree/master/lib/services/cognitiveServicesWebSearch).
-* Get started with [.NET samples](https://github.com/Azure-Samples/cognitive-services-dotnet-sdk-samples/tree/master/BingSearchv7)
- * [NuGet package](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.WebSearch/1.2.0)
- * See also [.NET libraries](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/cognitiveservices/Search.BingWebSearch) for definitions and dependencies.
-* Get started with [Java samples](https://github.com/Azure-Samples/cognitive-services-java-sdk-samples)
- * See also [Java libraries](https://github.com/Azure-Samples/cognitive-services-java-sdk-samples/tree/master/Search/BingWebSearch) for definitions and dependencies.
cognitive-services Search Responses https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/search-responses.md
- Title: Bing Web Search API response structure and answer types -
-description: When you send Bing Web Search a search request, it returns a `SearchResponse` object in the response body.
------ Previously updated : 06/25/2019----
-# Bing Web Search API response structure and answer types
--
-When you send Bing Web Search a search request, it returns a [`SearchResponse`](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#searchresponse) object in the response body. The object includes a field for each answer that Bing determined was relevant to query. This example illustrates a response object if Bing returned all answers:
-
-```json
-{
- "_type": "SearchResponse",
- "queryContext": {...},
- "webPages": {...},
- "images": {...},
- "relatedSearches": {...},
- "videos": {...},
- "news": {...},
- "spellSuggestion": {...},
- "computation": {...},
- "timeZone": {...},
- "rankingResponse": {...}
-}, ...
-```
-
-Typically, Bing Web Search returns a subset of the answers. For example, if the query term was *sailing dinghies*, the response might include `webPages`, `images`, and `rankingResponse`. Unless you've used [responseFilter](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#responsefilter) to filter out webpages, the response always includes the `webpages` and `rankingResponse` answers.
--
-## Webpages answer
-
-The [webPages](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#webanswer) answer contains a list of links to webpages that Bing Web Search determined were relevant to the query. Each [web page](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#webpage) in the list will include: the page's name, url, display URL, a short description of the content, and the date Bing found the content.
-
-```json
-{
- "id": "https:\/\/api.cognitive.microsoft.com\/api\/v7\/#WebPages.0",
- "name": "Dinghy sailing",
- "url": "https:\/\/www.bing.com\/cr?IG=3A43CA5...",
- "displayUrl": "https:\/\/en.contoso.com\/wiki\/Dinghy_sailing",
- "snippet": "Dinghy sailing is the activity of sailing small boats...",
- "dateLastCrawled": "2017-04-05T16:25:00"
-}, ...
-```
-
-Use `name` and `url` to create a hyperlink that takes the user to the webpage.
-
-<!-- Remove until this can be replaced with a sanitized version.
-The following shows an example of how you might display the webpage in a search results page.
-
-![Rendered webpage example](./media/cognitive-services-bing-web-api/bing-rendered-webpage-example.PNG)
>-
-## Images answer
-
-The [images](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#images) answer contains a list of images that Bing thought were relevant to the query. Each [image](/rest/api/cognitiveservices-bingsearch/bing-images-api-v7-reference#image) in the list includes the URL of the image, its size, its dimensions, and its encoding format. The image object also includes the URL of a thumbnail of the image and the thumbnail's dimensions.
-
-```json
-{
- "name": "Rich Passage Sailing Dinghy",
- "webSearchUrl": "https:\/\/www.bing.com\/cr?IG=3A43CA5CA64...",
- "thumbnailUrl": "https:\/\/tse1.mm.bing.net\/th?id=OIP....",
- "datePublished": "2011-10-29T11:26:00",
- "contentUrl": "http:\/\/upload.contoso.com\/sailing\/...",
- "hostPageUrl": "http:\/\/www.bing.com\/cr?IG=3A43CA5CA6464....",
- "contentSize": "79239 B",
- "encodingFormat": "jpeg",
- "hostPageDisplayUrl": "http:\/\/en.contoso.com\/wiki\/File...",
- "width": 526,
- "height": 688,
- "thumbnail": {
- "width": 229,
- "height": 300
- },
- "insightsSourcesSummary": {
- "shoppingSourcesCount": 0,
- "recipeSourcesCount": 0
- }
-}, ...
-```
-
-Depending on the user's device, you'd typically display a subset of the thumbnails, with an option for the user to [page through](./paging-search-results.md) the remaining images.
-
-<!-- Remove until this can be replaced with a sanitized version.
-![List of thumbnail images](./media/cognitive-services-bing-web-api/bing-web-image-thumbnails.PNG)
>-
-You can also expand the thumbnail as the user hovers the cursor over it. Be sure to attribute the image if you expand it. For example, by extracting the host from `hostPageDisplayUrl` and displaying it below the image. For information about resizing the thumbnail, see [Resizing and Cropping Thumbnails](./resize-and-crop-thumbnails.md).
-
-<!-- Remove until this can be replaced with a sanitized version.
-![Expanded view of thumbnail image](./media/cognitive-services-bing-web-api/bing-web-image-thumbnail-expansion.PNG)
>-
-If the user clicks the thumbnail, use `webSearchUrl` to take the user to Bing's search results page for images, which contains a collage of the images.
-
-For details about the image answer and images, see [Image Search API](../bing-image-search/overview.md).
-
-## Related searches answer
-
-The [relatedSearches](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#searchresponse-relatedsearches) answer contains a list of the most popular related queries made by other users. Each [query](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#query_obj) in the list includes a query string (`text`), a query string with hit highlighting characters (`displayText`), and a URL (`webSearchUrl`) to Bing's search results page for that query.
-
-```json
-{
- "text": "dinghy racing teams",
- "displayText": "dinghy racing teams",
- "webSearchUrl": "https:\/\/www.bing.com\/cr?IG=96C4CF214A0..."
-}, ...
-```
-
-Use the `displayText` query string and the `webSearchUrl` URL to create a hyperlink that takes the user to the Bing search results page for the related query. You could also use the `text` query string in your own Web Search API query and display the results yourself.
-
-For information about how to handle the highlighting markers in `displayText`, see [Hit Highlighting](../bing-web-search/hit-highlighting.md).
-
-The following shows an example of the related queries usage in Bing.com.
-
-![Related searches example on Bing](./media/cognitive-services-bing-web-api/bing-web-rendered-relatedsearches.GIF)
-
-## Videos answer
-
-The [videos](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#videos) answer contains a list of videos that Bing thought were relevant to the query. Each [video](/rest/api/cognitiveservices-bingsearch/bing-video-api-v7-reference#video) in the list includes the URL of the video, its duration, its dimensions, and its encoding format. The video object also includes the URL of a thumbnail of the video and the thumbnail's dimensions.
-
-```json
-{
- "name": "Sailing dinghy",
- "description": "Northwind Traders is a 12 foot gunter rigged...",
- "webSearchUrl": "https:\/\/www.bing.com\/cr?IG=1CAE739681D84...",
- "thumbnailUrl": "https:\/\/tse2.mm.bing.net\/th?id=OVP.wsKiL...",
- "datePublished": "2013-11-06T01:56:28",
- "publisher": [{
- "name": "Fabrikam"
- }],
- "contentUrl": "https:\/\/www.fabrikam.com\/watch?v=MrVBWZpJjX",
- "hostPageUrl": "https:\/\/www.bing.com\/cr?IG=1CAE739681D8400DB...",
- "encodingFormat": "mp4",
- "hostPageDisplayUrl": "https:\/\/www.fabrikam.com\/watch?v=MrBWZpJjXo",
- "width": 1280,
- "height": 720,
- "duration": "PT3M47S",
- "motionThumbnailUrl": "https:\/\/tse2.mm.bing.net\/th?id=OM.oa...",
- "embedHtml": "<iframe width=\"1280\" height=\"720\" src=\"http:\/\/www....><\/iframe>",
- "allowHttpsEmbed": true,
- "viewCount": 19089,
- "thumbnail": {
- "width": 300,
- "height": 168
- },
- "allowMobileEmbed": true,
- "isSuperfresh": false
-}, ...
-```
-
-Depending on the user's device, you'd typically display a subset of the videos with an option for the user to view the remaining videos. You'd display a thumbnail of the video with the video's length, description (name), and attribution (publisher).
-
-<!-- Remove until this can be replaced with a sanitized version.
-![List of video thumbnails](./media/cognitive-services-bing-web-api/bing-web-video-thumbnails.PNG)
>-
-As the user hovers over the thumbnail you can use `motionThumbnailUrl` to play a thumbnail version of the video. Be sure to attribute the motion thumbnail when you display it.
-
-<!-- Remove until this can be replaced with a sanitized version.
-![Motion thumbnail of a video](./media/cognitive-services-bing-web-api/bing-web-video-motion-thumbnail.PNG)
>-
-If the user clicks the thumbnail, the following are the video viewing options:
--- Use `hostPageUrl` to view the video on the host website (for example, YouTube)-- Use `webSearchUrl` to view the video in the Bing video browser-- Use `embedHtml` to embed the video in your own experience-
-For details about the video answer and videos, see [Video Search API](../bing-video-search/overview.md).
-
-## News answer
-
-The [news](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#news) answer contains a list of news articles that Bing thought were relevant to the query. Each [news article](/rest/api/cognitiveservices-bingsearch/bing-news-api-v7-reference#newsarticle) in the list includes the article's name, description, and URL to the article on the host's website. If the article contains an image, the object includes a thumbnail of the image.
-
-```json
-{
- "name": "WC Sailing Qualifies for America Trophy with...",
- "url": "http:\/\/www.bing.com\/cr?IG=3445EEF15DAF4FFFBF7...",
- "image": {
- "contentUrl": "http:\/\/www.contoso.com\/sports\/sail...",
- "thumbnail": {
- "contentUrl": "https:\/\/www.bing.com\/th?id=ON.1...",
- "width": 400,
- "height": 272
- }
- },
- "description": "The WC sailing team qualified for a...",
- "provider": [{
- "_type": "Organization",
- "name": "contoso.com"
- }],
- "datePublished": "2017-04-16T21:56:00"
-}, ...
-```
-
-Depending on the user's device, you'd display a subset of the news articles with an option for the user to view the remaining articles. Use `name` and `url` to create a hyperlink that takes the user to the news article on the host's site. If the article includes an image, make the image clickable using `url`. Be sure to use `provider` to attribute the article.
-
-<!-- Remove until this can be replaced with a sanitized version.
-The following shows an example of how you might display articles in a search results page.
-
-![List of news articles](./media/cognitive-services-bing-web-api/bing-web-news-list.PNG)
>-
-For details about the news answer and news articles, see [News Search API](../bing-news-search/search-the-web.md).
-
-## Computation answer
-
-If the user enters a mathematical expression or a unit conversion query, the response may contain a [Computation](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#computation) answer. The `computation` answer contains the normalized expression and its result.
-
-A unit conversion query is a query that converts one unit to another. For example, *How many feet in 10 meters?* or *How many tablespoons in a 1/4 cup?*
-
-The following shows the `computation` answer for *How many feet in 10 meters?*
-
-```json
-"computation": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#Computation",
- "expression": "10 meters",
- "value": "32.808399 feet"
-}, ...
-```
-
-The following shows examples of mathematical queries and their corresponding `computation` answers.
-
-```
-Query: (5+3)(10/2)+8
-Encoded query: %285%2B3%29%2810%2F2%29%2B8
-```
-
-```json
-"computation": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#Computation",
- "expression": "((5+3)*(10\/2))+8",
- "value": "48"
-}
-```
-
-```
-Query: sqrt(4^2+8^2)
-Encoded query: sqrt%284^2%2B8^2%29
-```
-
-```json
-"computation": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#Computation",
- "expression": "sqrt((4^2)+(8^2))",
- "value": "8.94427191"
-}
-```
-
-```
-Query: 30 6/8 - 18 8/16
-Encoded query: 30%206%2F8%20-%2018%208%2F16
-```
-
-```json
-"computation": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#WolframAlpha",
- "expression": "30 6\/8-18 8\/16",
- "value": "12.25"
-}
-```
-
-```
-Query: 8^2+11^2-2*8*11*cos(37)
-Encoded query: 8^2%2B11^2-2*8*11*cos%2837%29
-```
-
-```json
-"computation": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#Computation",
- "expression": "(8^2)+(11^2)-(2*8*11*cos(37))",
- "value": "44.4401502"
-}
-```
-
-A mathematical expression may contain the following symbols:
-
-|Symbol|Description|
-||--|
-|+|Addition|
-|-|Subtraction|
-|/|Division|
-|*|Multiplication|
-|^|Power|
-|!|Factorial|
-|.|Decimal|
-|()|Precedence grouping|
-|[]|Function|
-
-A mathematical expression may contain the following constants:
-
-|Symbol|Description|
-||--|
-|Pi|3.14159...|
-|Degree|Degree|
-|i|Imaginary number|
-|e|e, 2.71828...|
-|GoldenRatio|Golden ratio, 1.61803...|
-
-A mathematical expression may contain the following functions:
-
-|Symbol|Description|
-||--|
-|Sort|Square root|
-|Sin[x], Cos[x], Tan[x]<br />Csc[x], Sec[x], Cot[x]|Trigonometric functions (with arguments in radians)|
-|ArcSin[x], ArcCos[x], ArcTan[x]<br />ArcCsc[x], ArcSec[x], ArcCot[x]|Inverse trigonometric functions (giving results in radians)|
-|Exp[x], E^x|Exponential function|
-|Log[x]|Natural logarithm|
-|Sinh[x], Cosh[x], Tanh[x]<br />Csch[x], Sech[x], Coth[x]|Hyperbolic functions|
-|ArcSinh[x], ArcCosh[x], ArcTanh[x]<br />ArcCsch[x], ArcSech[x], ArcCoth[x]|Inverse hyperbolic functions|
-
-Mathematical expressions that contain variables (for example, 4x+6=18, where x is the variable) are not supported.
-
-## TimeZone answer
-
-If the user enters a time or date query, the response may contain a [TimeZone](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#timezone) answer. This answer supports implicit or explicit queries. An implicit query, such as *What time is it?*, returns the local time based on the user's location. An explicit query, such as *What time is it in Seattle?*, returns the local time for Seattle, WA.
-
-The `timeZone` answer provides the name of the location, the current UTC date and time at the specified location, and the UTC offset. If the boundary of the location is within multiple time zones, the answer contains the current UTC date and time of all time zones within the boundary. For example, because Florida State falls within two time zones, the answer contains the local date and time of both time zones.
-
-If the query requests the time of a state or country/region, Bing determines the primary city within the location's geographical boundary and returns it in the `primaryCityTime` field. If the boundary contains multiple time zones, the remaining time zones are returned in the `otherCityTimes` field.
-
-The following shows example queries that return the `timeZone` answer.
-
-```
-Query: What time is it?
-
-"timeZone": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#TimeZone",
- "primaryCityTime": {
- "location": "Redmond, Washington, United States",
- "time": "2015-10-27T08:38:12.1189231Z",
- "utcOffset": "UTC-7"
- }
-}
-
-Query: What time is it in the Pacific time zone?
-
-"timeZone": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#TimeZone",
- "primaryCityTime": {
- "location": "Pacific Time Zone",
- "time": "2015-10-23T12:33:19.0728146Z",
- "utcOffset": "UTC-7"
- }
-}
-
-Query: Time in Florida?
-
-"timeZone": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#TimeZone",
- "primaryCityTime": {
- "location": "Tallahassee, Florida, United States",
- "time": "2015-10-23T13:04:56.6774389Z",
- "utcOffset": "UTC-4"
- },
- "otherCityTimes": [{
- "location": "Pensacola",
- "time": "2015-10-23T12:04:56.6664294Z",
- "utcOffset": "UTC-5"
- }]
-}
-
-Query: What time is it in the U.S.
-
-"timeZone": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#TimeZone",
- "primaryCityTime": {
- "location": "Washington, D.C., United States",
- "time": "2015-10-23T15:27:59.8892745Z",
- "utcOffset": "UTC-4"
- },
- "otherCityTimes": [{
- "location": "Honolulu",
- "time": "2015-10-23T09:27:59.8892745Z",
- "utcOffset": "UTC-10"
- },
- {
- "location": "Anchorage",
- "time": "2015-10-23T11:27:59.8892745Z",
- "utcOffset": "UTC-8"
- },
- {
- "location": "Phoenix",
- "time": "2015-10-23T12:27:59.8892745Z",
- "utcOffset": "UTC-7"
- },
- {
- "location": "Los Angeles",
- "time": "2015-10-23T12:27:59.8942788Z",
- "utcOffset": "UTC-7"
- },
- {
- "location": "Denver",
- "time": "2015-10-23T13:27:59.8812681Z",
- "utcOffset": "UTC-6"
- },
- {
- "location": "Chicago",
- "time": "2015-10-23T14:27:59.8892745Z",
- "utcOffset": "UTC-5"
- }]
-}
-```
-
-## SpellSuggestion answer
-
-If Bing determines that the user may have intended to search for something different, the response includes a [SpellSuggestions](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#spellsuggestions) object. For example, if the user searches for *carlos pen*, Bing may determine that the user likely intended to search for Carlos Pena instead (based on past searches by others of *carlos pen*). The following shows an example spell response.
-
-```json
-"spellSuggestions": {
- "id": "https:\/\/www.bing.com\/api\/v7\/#SpellSuggestions",
- "value": [{
- "text": "carlos pena",
- "displayText": "carlos pena"
- }]
-}, ...
-```
-
-## Response headers
-
-Responses from the Bing Web Search API may contain the following headers:
-
-| Header | Description |
-|-|-|
-|`X-MSEdge-ClientID`|The unique ID that Bing has assigned to the user|
-|`BingAPIs-Market`|The market that was used to fulfill the request|
-|`BingAPIs-TraceId`|The log entry on the Bing API server for this request (for support)|
-
-It is particularly important to persist the client ID and return it with subsequent requests. When you do this, the search will use past context in ranking search results and also provide a consistent user experience.
-
-However, when you call the Bing Web Search API from JavaScript, your browser's built-in security features (CORS) might prevent you from accessing the values of these headers.
-
-To gain access to the headers, you can make the Bing Web Search API request through a CORS proxy. The response from such a proxy has an `Access-Control-Expose-Headers` header that filters response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our [tutorial app](tutorial-bing-web-search-single-page-app.md) to access the optional client headers. First, if you don't already have it, [install Node.js](https://nodejs.org/en/download/). Then enter the following command at a command prompt.
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search API endpoint in the HTML file to:\
-`http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search`
-
-Finally, start the CORS proxy with the following command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the tutorial app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, you can now see the `X-MSEdge-ClientID` header (among others) and verify that it is the same for each request.
-
-## Response headers in production
-
-The CORS proxy approach described in the previous answer is appropriate for development, testing, and learning.
-
-In a production environment, you should host a server-side script on the same domain as the Web page that uses the Bing Web Search API. This script should make API calls upon request from the Web page JavaScript and pass all results, including headers, back to the client. Since the two resources (page and script) share an origin, CORS is not used and the special headers are accessible to the JavaScript on the Web page.
-
-This approach also protects your API key from exposure to the public, since only the server-side script needs it. The script can use another method to make sure the request is authorized.
-
-The following shows how Bing uses the spelling suggestion.
-
-![Bing spelling suggestion example](./media/cognitive-services-bing-web-api/bing-web-spellingsuggestion.GIF)
-
-## Next steps
-
-* Review [request throttling](throttling-requests.md) documentation.
-
-## See also
-
-* [Bing Web Search API reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference)
cognitive-services Throttling Requests https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/throttling-requests.md
- Title: Throttling requests - Bing Web Search API-
-description: The service and your subscription type determine the number of queries per second (QPS) that you can make.
------ Previously updated : 03/04/2019---
-# Throttling requests to the Bing Web Search API
---
-## Next steps
-
-* [Bing Web Search API reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference)
cognitive-services Tutorial Bing Web Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/tutorial-bing-web-search-single-page-app.md
- Title: "Tutorial: Create a single-page web app - Bing Web Search API"-
-description: This single-page app demonstrates how the Bing Web Search API can be used to retrieve, parse, and display relevant search results in a single-page app.
------ Previously updated : 03/05/2020----
-# Tutorial: Create a single-page app using the Bing Web Search API
--
-This single-page app demonstrates how to retrieve, parse, and display search results from the Bing Web Search API. The tutorial uses boilerplate HTML and CSS, and focuses on the JavaScript code. HTML, CSS, and JS files are available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/tree/master/Tutorials/Bing-Web-Search) with quickstart instructions.
-
-This sample app can:
-
-> [!div class="checklist"]
-> * Call the Bing Web Search API with search options
-> * Display web, image, news, and video results
-> * Paginate results
-> * Manage subscription keys
-> * Handle errors
-
-To use this app, an [Azure AI services account](../cognitive-services-apis-create-account.md) with Bing Search APIs is required.
-
-## Prerequisites
-
-Here are a few things that you'll need to run the app:
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://ms.portal.azure.com/#create/Microsoft.BingSearch" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-* Node.js 8 or later
-
-The first step is to clone the repository with the sample app's source code.
-
-```console
-git clone https://github.com/Azure-Samples/cognitive-services-REST-api-samples.git
-```
-
-Then run `npm install`. For this tutorial, Express.js is the only dependency.
-
-```console
-cd <path-to-repo>/cognitive-services-REST-api-samples/Tutorials/bing-web-search
-npm install
-```
-
-## App components
-
-The sample app we're building is made up of four parts:
-
-* `bing-web-search.js` - Our Express.js app. It handles request/response logic and routing.
-* `public/https://docsupdatetracker.net/index.html` - The skeleton of our app; it defines how data is presented to the user.
-* `public/css/styles.css` - Defines page styles, such as fonts, colors, text size.
-* `public/js/scripts.js` - Contains the logic to make requests to the Bing Web Search API, manage subscription keys, handle and parse responses, and display results.
-
-This tutorial focuses on `scripts.js` and the logic required to call the Bing Web Search API and handle the response.
-
-## HTML form
-
-The `https://docsupdatetracker.net/index.html` includes a form that enables users to search and select search options. The `onsubmit` attribute fires when the form is submitted, calling the `bingWebSearch()` method defined in `scripts.js`. It takes three arguments:
-
-* Search query
-* Selected options
-* Subscription key
-
-```html
-<form name="bing" onsubmit="return bingWebSearch(this.query.value,
- bingSearchOptions(this), getSubscriptionKey())">
-```
-
-## Query options
-
-The HTML form includes options that map to query parameters in the [Bing Web Search API v7](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#query-parameters). This table provides a breakdown of how users can filter search results using the sample app:
-
-| Parameter | Description |
-|--|-|
-| `query` | A text field to enter a query string. |
-| `where` | A drop-down menu to select the market (location and language). |
-| `what` | Checkboxes to promote specific result types. Promoting images, for example, increases the ranking of images in search results. |
-| `when` | A drop-down menu that allows the user to limit the search results to today, this week, or this month. |
-| `safe` | A checkbox to enable Bing SafeSearch, which filters out adult content. |
-| `count` | Hidden field. The number of search results to return on each request. Change this value to display fewer or more results per page. |
-| `offset` | Hidden field. The offset of the first search result in the request, which is used for paging. It's reset to `0` with each new request. |
-
-> [!NOTE]
-> The Bing Web Search API offers additional query parameters to help refine search results. This sample only uses a few. For a complete list of available parameters, see [Bing Web Search API v7 reference](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference#query-parameters).
-
-The `bingSearchOptions()` function converts these options to match the format required by the Bing Search API.
-
-```javascript
-// Build query options from selections in the HTML form.
-function bingSearchOptions(form) {
-
- var options = [];
- // Where option.
- options.push("mkt=" + form.where.value);
- // SafeSearch option.
- options.push("SafeSearch=" + (form.safe.checked ? "strict" : "moderate"));
- // Freshness option.
- if (form.when.value.length) options.push("freshness=" + form.when.value);
- var what = [];
- for (var i = 0; i < form.what.length; i++)
- if (form.what[i].checked) what.push(form.what[i].value);
- // Promote option.
- if (what.length) {
- options.push("promote=" + what.join(","));
- options.push("answerCount=9");
- }
- // Count option.
- options.push("count=" + form.count.value);
- // Offset option.
- options.push("offset=" + form.offset.value);
- // Hardcoded text decoration option.
- options.push("textDecorations=true");
- // Hardcoded text format option.
- options.push("textFormat=HTML");
- return options.join("&");
-}
-```
-
-`SafeSearch` can be set to `strict`, `moderate`, or `off`, with `moderate` being the default setting for Bing Web Search. This form uses a checkbox, which has two states: `strict` or `moderate`.
-
-If any of the **Promote** checkboxes are selected, the `answerCount` parameter is added to the query. `answerCount` is required when using the `promote` parameter. In this snippet, the value is set to `9` to return all available result types.
-> [!NOTE]
-> Promoting a result type doesn't *guarantee* that it will be included in the search results. Rather, promotion increases the ranking of those kinds of results relative to their usual ranking. To limit searches to particular kinds of results, use the `responseFilter` query parameter, or call a more specific endpoint such as Bing Image Search or Bing News Search.
-
-The `textDecoration` and `textFormat` query parameters are hardcoded into the script, and cause the search term to be boldfaced in the search results. These parameters aren't required.
-
-## Manage subscription keys
-
-To avoid hardcoding the Bing Search API subscription key, this sample app uses a browser's persistent storage to store the subscription key. If no subscription key is stored, the user is prompted to enter one. If the subscription key is rejected by the API, the user is prompted to re-enter a subscription key.
-
-The `getSubscriptionKey()` function uses the `storeValue` and `retrieveValue` functions to store and retrieve a user's subscription key. These functions use the `localStorage` object, if supported, or cookies.
-
-```javascript
-// Cookie names for stored data.
-API_KEY_COOKIE = "bing-search-api-key";
-CLIENT_ID_COOKIE = "bing-search-client-id";
-
-BING_ENDPOINT = "https://api.cognitive.microsoft.com/bing/v7.0/search";
-
-// See source code for storeValue and retrieveValue definitions.
-
-// Get stored subscription key, or prompt if it isn't found.
-function getSubscriptionKey() {
- var key = retrieveValue(API_KEY_COOKIE);
- while (key.length !== 32) {
- key = prompt("Enter Bing Search API subscription key:", "").trim();
- }
- // Always set the cookie in order to update the expiration date.
- storeValue(API_KEY_COOKIE, key);
- return key;
-}
-```
-
-As we saw earlier, when the form is submitted, `onsubmit` fires, calling `bingWebSearch`. This function initializes and sends the request. `getSubscriptionKey` is called on each submission to authenticate the request.
-
-## Call Bing Web Search
-
-Given the query, the options string, and the subscription key, the `BingWebSearch` function creates an `XMLHttpRequest` object to call the Bing Web Search endpoint.
-
-```javascript
-// Perform a search constructed from the query, options, and subscription key.
-function bingWebSearch(query, options, key) {
- window.scrollTo(0, 0);
- if (!query.trim().length) return false;
-
- showDiv("noresults", "Working. Please wait.");
- hideDivs("pole", "mainline", "sidebar", "_json", "_http", "paging1", "paging2", "error");
-
- var request = new XMLHttpRequest();
- var queryurl = BING_ENDPOINT + "?q=" + encodeURIComponent(query) + "&" + options;
-
- // Initialize the request.
- try {
- request.open("GET", queryurl);
- }
- catch (e) {
- renderErrorMessage("Bad request (invalid URL)\n" + queryurl);
- return false;
- }
-
- // Add request headers.
- request.setRequestHeader("Ocp-Apim-Subscription-Key", key);
- request.setRequestHeader("Accept", "application/json");
- var clientid = retrieveValue(CLIENT_ID_COOKIE);
- if (clientid) request.setRequestHeader("X-MSEdge-ClientID", clientid);
-
- // Event handler for successful response.
- request.addEventListener("load", handleBingResponse);
-
- // Event handler for errors.
- request.addEventListener("error", function() {
- renderErrorMessage("Error completing request");
- });
-
- // Event handler for an aborted request.
- request.addEventListener("abort", function() {
- renderErrorMessage("Request aborted");
- });
-
- // Send the request.
- request.send();
- return false;
-}
-```
-
-Following a successful request, the `load` event handler fires and calls the `handleBingResponse` function. `handleBingResponse` parses the result object, displays the results, and contains error logic for failed requests.
-
-```javascript
-function handleBingResponse() {
- hideDivs("noresults");
-
- var json = this.responseText.trim();
- var jsobj = {};
-
- // Try to parse results object.
- try {
- if (json.length) jsobj = JSON.parse(json);
- } catch(e) {
- renderErrorMessage("Invalid JSON response");
- return;
- }
-
- // Show raw JSON and the HTTP request.
- showDiv("json", preFormat(JSON.stringify(jsobj, null, 2)));
- showDiv("http", preFormat("GET " + this.responseURL + "\n\nStatus: " + this.status + " " +
- this.statusText + "\n" + this.getAllResponseHeaders()));
-
- // If the HTTP response is 200 OK, try to render the results.
- if (this.status === 200) {
- var clientid = this.getResponseHeader("X-MSEdge-ClientID");
- if (clientid) retrieveValue(CLIENT_ID_COOKIE, clientid);
- if (json.length) {
- if (jsobj._type === "SearchResponse" && "rankingResponse" in jsobj) {
- renderSearchResults(jsobj);
- } else {
- renderErrorMessage("No search results in JSON response");
- }
- } else {
- renderErrorMessage("Empty response (are you sending too many requests too quickly?)");
- }
- }
-
- // Any other HTTP response is considered an error.
- else {
- // 401 is unauthorized; force a re-prompt for the user's subscription
- // key on the next request.
- if (this.status === 401) invalidateSubscriptionKey();
-
- // Some error responses don't have a top-level errors object, if absent
- // create one.
- var errors = jsobj.errors || [jsobj];
- var errmsg = [];
-
- // Display the HTTP status code.
- errmsg.push("HTTP Status " + this.status + " " + this.statusText + "\n");
-
- // Add all fields from all error responses.
- for (var i = 0; i < errors.length; i++) {
- if (i) errmsg.push("\n");
- for (var k in errors[i]) errmsg.push(k + ": " + errors[i][k]);
- }
-
- // Display Bing Trace ID if it isn't blocked by CORS.
- var traceid = this.getResponseHeader("BingAPIs-TraceId");
- if (traceid) errmsg.push("\nTrace ID " + traceid);
-
- // Display the error message.
- renderErrorMessage(errmsg.join("\n"));
- }
-}
-```
-
-> [!IMPORTANT]
-> A successful HTTP request *doesn't* mean that the search itself succeeded. If an error occurs in the search operation, the Bing Web Search API returns a non-200 HTTP status code and includes error information in the JSON response. If the request was rate-limited, the API returns an empty response.
-
-Much of the code in both of the preceding functions is dedicated to error handling. Errors may occur at the following stages:
-
-| Stage | Potential error(s) | Handled by |
-|-|--||
-| Building the request object | Invalid URL | `try` / `catch` block |
-| Making the request | Network errors, aborted connections | `error` and `abort` event handlers |
-| Performing the search | Invalid request, invalid JSON, rate limits | Tests in `load` event handler |
-
-Errors are handled by calling `renderErrorMessage()`. If the response passes all of the error tests, `renderSearchResults()` is called to display the search results.
-
-## Display search results
-
-There are [use and display requirements](./use-display-requirements.md) for results returned by the Bing Web Search API. Since a response may include various result types, it isn't enough to iterate through the top-level `WebPages` collection. Instead, the sample app uses `RankingResponse` to order the results to spec.
-
-> [!NOTE]
-> If you only want a single result type, use the `responseFilter` query parameter, or consider using one of the other Bing Search endpoints, such as Bing Image Search.
-
-Each response has a `RankingResponse` object that may include up to three collections: `pole`, `mainline`, and `sidebar`. `pole`, if present, is the most relevant search result and must be prominently displayed. `mainline` contains most of the search results, and is displayed immediately after `pole`. `sidebar` includes auxiliary search results. If possible, these results should be displayed in the sidebar. If screen limits make a sidebar impractical, these results should appear after the `mainline` results.
-
-Each `RankingResponse` includes a `RankingItem` array that specifies how results must be ordered. Our sample app uses the `answerType` and `resultIndex` parameters to identify the result.
-
-> [!NOTE]
-> There are additional ways to identify and rank results. For more information, see [Using ranking to display results](rank-results.md).
-
-Let's take a look at the code:
-
-```javascript
-// Render the search results from the JSON response.
-function renderSearchResults(results) {
-
- // If spelling was corrected, update the search field.
- if (results.queryContext.alteredQuery)
- document.forms.bing.query.value = results.queryContext.alteredQuery;
-
- // Add Prev / Next links with result count.
- var pagingLinks = renderPagingLinks(results);
- showDiv("paging1", pagingLinks);
- showDiv("paging2", pagingLinks);
-
- // Render the results for each section.
- for (section in {pole: 0, mainline: 0, sidebar: 0}) {
- if (results.rankingResponse[section])
- showDiv(section, renderResultsItems(section, results));
- }
-}
-```
-
-The `renderResultsItems()` function iterates through the items in each `RankingResponse` collection, maps each ranking result to a search result using the `answerType` and `resultIndex` values, and calls the appropriate rendering function to generate the HTML. If `resultIndex` isn't specified for an item, `renderResultsItems()` iterates through all results of that type and calls the rendering function for each item. The resulting HTML is inserted into the appropriate `<div>` element in `https://docsupdatetracker.net/index.html`.
-
-```javascript
-// Render search results from the RankingResponse object per rank response and
-// use and display requirements.
-function renderResultsItems(section, results) {
-
- var items = results.rankingResponse[section].items;
- var html = [];
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- // Collection name has lowercase first letter while answerType has uppercase
- // e.g. `WebPages` RankingResult type is in the `webPages` top-level collection.
- var type = item.answerType[0].toLowerCase() + item.answerType.slice(1);
- if (type in results && type in searchItemRenderers) {
- var render = searchItemRenderers[type];
- // This ranking item refers to ONE result of the specified type.
- if ("resultIndex" in item) {
- html.push(render(results[type].value[item.resultIndex], section));
- // This ranking item refers to ALL results of the specified type.
- } else {
- var len = results[type].value.length;
- for (var j = 0; j < len; j++) {
- html.push(render(results[type].value[j], section, j, len));
- }
- }
- }
- }
- return html.join("\n\n");
-}
-```
-
-## Review renderer functions
-
-In our sample app, the `searchItemRenderers` object includes functions that generate HTML for each type of search result.
-
-```javascript
-// Render functions for each result type.
-searchItemRenderers = {
- webPages: function(item) { ... },
- news: function(item) { ... },
- images: function(item, section, index, count) { ... },
- videos: function(item, section, index, count) { ... },
- relatedSearches: function(item, section, index, count) { ... }
-}
-```
-
-> [!IMPORTANT]
-> The sample app has renderers for web pages, news, images, videos, and related searches. Your application will need renderers for any type of results it may receive, which could include computations, spelling suggestions, entities, time zones, and definitions.
-
-Some of the rendering functions accept only the `item` parameter. Others accept additional parameters, which can be used to render items differently based on context. A renderer that doesn't use this information doesn't need to accept these parameters.
-
-The context arguments are:
-
-| Parameter | Description |
-||-|
-| `section` | The results section (`pole`, `mainline`, or `sidebar`) in which the item appears. |
-| `index`<br>`count` | Available when the `RankingResponse` item specifies that all results in a given collection are to be displayed; `undefined` otherwise. The index of the item within its collection and the total number of items in that collection. You can use this information to number the results, to generate different HTML for the first or last result, and so on. |
-
-In the sample app, both the `images` and `relatedSearches` renderers use the context arguments to customize the generated HTML. Let's take a closer look at the `images` renderer:
-
-```javascript
-searchItemRenderers = {
- // Render image result with thumbnail.
- images: function(item, section, index, count) {
- var height = 60;
- var width = Math.round(height * item.thumbnail.width / item.thumbnail.height);
- var html = [];
- if (section === "sidebar") {
- if (index) html.push("<br>");
- } else {
- if (!index) html.push("<p class='images'>");
- }
- html.push("<a href='" + item.hostPageUrl + "'>");
- var title = escape(item.name) + "\n" + getHost(item.hostPageDisplayUrl);
- html.push("<img src='"+ item.thumbnailUrl + "&h=" + height + "&w=" + width +
- "' height=" + height + " width=" + width + " title='" + title + "' alt='" + title + "'>");
- html.push("</a>");
- return html.join("");
- },
- // Other renderers are omitted from this sample...
-}
-```
-
-The image renderer:
-
-* Calculates the image thumbnail size (width varies, while height is fixed at 60 pixels).
-* Inserts the HTML that precedes the image result based on context.
-* Builds the HTML `<a>` tag that links to the page that contains the image.
-* Builds the HTML `<img>` tag to display the image thumbnail.
-
-The image renderer uses the `section` and `index` variables to display results differently depending on where they appear. A line break (`<br>` tag) is inserted between image results in the sidebar, so that the sidebar displays a column of images. In other sections, the first image result `(index === 0)` is preceded by a `<p>` tag.
-
-The thumbnail size is used in both the `<img>` tag and the `h` and `w` fields in the thumbnail's URL. The `title` and `alt` attributes (a textual description of the image) are constructed from the image's name and the hostname in the URL.
-
-Here's an example of how images are displayed in the sample app:
-
-![[Bing image results]](media/cognitive-services-bing-web-api/web-search-spa-images.png)
-
-## Persist the client ID
-
-Responses from the Bing search APIs may include a `X-MSEdge-ClientID` header that should be sent back to the API with each successive request. If more than one of the Bing Search APIs is used by your app, make sure the same client ID is sent with each request across services.
-
-Providing the `X-MSEdge-ClientID` header allows the Bing APIs to associate a user's searches. First, it allows the Bing search engine to apply past context to searches to find results that better satisfy the request. If a user has previously searched for terms related to sailing, for example, a later search for "knots" might preferentially return information about knots used in sailing. Second, Bing may randomly select users to experience new features before they are made widely available. Providing the same client ID with each request ensures that users who have been chosen to see a feature will always see it. Without the client ID, the user might see a feature appear and disappear, seemingly at random, in their search results.
-
-Browser security policies, such as Cross-Origin Resource Sharing (CORS), may prevent the sample app from accessing the `X-MSEdge-ClientID` header. This limitation occurs when the search response has a different origin from the page that requested it. In a production environment, you should address this policy by hosting a server-side script that does the API call on the same domain as the Web page. Since the script has the same origin as the Web page, the `X-MSEdge-ClientID` header is then available to JavaScript.
-
-> [!NOTE]
-> In a production Web application, you should perform the request server-side anyway. Otherwise, your Bing Search API subscription key must be included in the web page, where it's available to anyone who views source. You are billed for all usage under your API subscription key, even requests made by unauthorized parties, so it is important not to expose your key.
-
-For development purposes, you can make a request through a CORS proxy. The response from this type of proxy has an `Access-Control-Expose-Headers` header that filters response headers and makes them available to JavaScript.
-
-It's easy to install a CORS proxy to allow our sample app to access the client ID header. Run this command:
-
-```console
-npm install -g cors-proxy-server
-```
-
-Next, change the Bing Web Search endpoint in `script.js` to:
-
-```javascript
-http://localhost:9090/https://api.cognitive.microsoft.com/bing/v7.0/search
-```
-
-Start the CORS proxy with this command:
-
-```console
-cors-proxy-server
-```
-
-Leave the command window open while you use the sample app; closing the window stops the proxy. In the expandable HTTP Headers section below the search results, the `X-MSEdge-ClientID` header should be visible. Verify that it's the same for each request.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Bing Web Search API v7 reference](/rest/api/cognitiveservices/bing-web-api-v7-reference)
cognitive-services Use Display Requirements https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/use-display-requirements.md
- Title: Use and display requirements for the Bing Search APIs-
-description: The requirements for displaying search results from the Bing Search APIs in your applications.
------ Previously updated : 01/12/2023---
-# Bing Search API use and display requirements
--
-These use and display requirements apply to any implementation of the content and associated information from the following Bing Search APIs, including relationships, metadata, and other signals.
--- Bing Custom Search-- Bing Entity Search-- Bing Image Search-- Bing News Search-- Bing Video Search-- Bing Visual Search-- Bing Web Search-- Bing Spell Check-- Bing Autosuggest-
-## Definitions
-
-|Term |Description |
-|||
-|Answer | A category of results returned in a response. For example, a response from the Bing Web Search API can include answers in the categories of webpage results, image, video, and news. |
-|Response | Any and all answers and associated data received in response to a single call to a Search API. |
-|Result | An item of information in an answer. For example, the set of data connected with a single news article is a result in a news answer. |
-|Search APIs | collectively, the Bing Custom Search, Entity Search, Image Search, News Search, Video Search, Visual Search, Local Business Search, and Web Search APIs. |
-
-## Bing Spell Check and Bing Autosuggest API restrictions
-
-Do not:
--- Copy, store, or cache any data you receive from the Bing Spell Check or Bing Autosuggest APIs.-- Use data you receive from Bing Spell Check or Bing Autosuggest APIs as part of any machine learning or similar algorithmic activity. Do not use this data to train, evaluate, or improve new or existing services that you or third parties might offer.-- Display data received from the Bing Spell Check or Bing Autosuggest APIs on the same page as content from any general web search engine, large language models or advertising network.-
-## Bing Search APIs
-
-> [!NOTE]
-> The requirements in this section apply to only the Search APIs, which does not include Bing Spell Check or Bing Autosuggest.
-
-### Internet search experience requirements
-
-All data returned in responses may only be used in internet search experiences. An internet search experience means the content displayed:
--- Is relevant and responsive to the end user's direct query, or other indication of their search interest and intent (for example, a user-indicated search query).--- Helps users find and navigate to the response's data sources. For example, providing clickable links from hyperlinks in the response.--- Includes multiple results for the user to select from.--- Are in a placement that enables users to search.--- Includes a visible indication that the content is an internet search result. For example, a statement that the content is "from the web".--- Includes any other appropriate measures to ensure your Bing Search API data does not violate any applicable laws or third-party rights. Consult your legal advisors to determine what measures may be appropriate.-
-The only exception to these internet search experience requirements is for URL discovery, as described later in this article.
-
-### Restrictions
-
-Do not:
--- Copy, store, or cache any data from responses (except retention to the extent permitted by [continuity of service](#continuity-of-service).--- Use data received from the Search APIs as part of any machine learning or similar algorithmic activity. Do not use this data to train, evaluate, or improve new or existing services that you or third parties might offer.--- Display data received from the Search APIs on the same page as content from any general web search engine, large language models or advertising network.--- Modify the content of results (other than to reformat them in a way that does not violate any other requirement), unless required by law or agreed to by Microsoft.--- Omit attribution information and URLs associated with result content.--- Reorder, including by omission, the results displayed in an answer when an order or ranking is provided, unless required by law or agreed to by Microsoft.-
- > [!NOTE]
- > This requirement does not apply to reordering implemented through the portal for the Bing Custom Search API.
--- Display other content within any part of a response in a way that would lead a user to believe that the other content is part of the response.--- Display advertising that is not provided by Microsoft on any page that displays any part of a response.--- Display any advertising on pages with responses:
- - From the Bing Image, News Search, Video Search, or Visual Search APIs
- - That are filtered or limited primarily (or solely) to image, news and/or video or visual search results.
-
-### Notices and branding
-
-Do:
--- Prominently include a functional hyperlink to the [Microsoft Privacy Statement](https://go.microsoft.com/fwlink/?LinkId=521839), near each point in the user experience (UX) that offers a user the ability to input a search query. Label the hyperlink **Microsoft Privacy Statement**.--- Prominently display Bing branding, consistent with the [Bing Trademark Usage Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks), near each point in the UX that offers a user the ability to input a search query. Such branding must clearly state to the user that Microsoft is powering the internet search experience.--- You can attribute each response (or portion of a response) displayed from the Bing Web Search, Image Search, News Search, Video Search, and Visual Search APIs to Microsoft, unless Microsoft specifies otherwise in writing for your use. This is described in [Bing Trademark Usage Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks).-
-Do not:
--- Attribute responses (or portions of responses) displayed from the Bing Custom Search API to Microsoft, unless Microsoft specifies otherwise in writing for your particular use.-
-### Transferring responses
-
-If you enable a user to transfer a response from a Search API to another user, such as through a messaging app or social media posting, the following apply:
--- Transferred responses must:
- - Consist of content that is unmodified from the content of the responses displayed to the transferring user. Formatting changes are permissible.
- - Not include any data in metadata form.
- - For responses from the Bing Web, Image, News, Video, and Visual APIs, display language indicating the response was obtained through an internet search experience powered by Bing. For example, you can display language such as "Powered by Bing" or "Learn more about this image on Bing," or you can use the Bing logo.
- - For responses from the Bing Custom Search API, display language indicating the response was obtained through an internet search experience. For example, you can display language such as "Learn more about this search result.ΓÇ¥
- - Prominently display the full query used to generate the response.
- - Include a prominent link or similar attribution to the underlying source of the response, either directly or through the search engine (bing.com, m.bing.com, or your custom search service, as applicable).
-- You may not automate the transfer of responses. A transfer must be initiated by a user action clearly evidencing an intent to transfer a response.-- You may only enable a user to transfer responses that were displayed in response to the transferring user's query.-
-### Continuity of service
-
-Do not copy, store, or cache any data from Search API responses. However, to enable continuity of service access and data rendering, you may retain results solely under the following conditions:
-
-#### Device
-
-You may enable a user to retain results on a device for the lesser of (i) 24 hours from the time of the query, or (ii) until a user submits another query for updated results, provided that retained results may be used only:
--- To enable the user to access results previously returned to that user on that device (for example, in case of service interruption).-- To store results returned for your proactive query personalized in anticipation of the user's needs, based on that user's signals (for example, in case of anticipated service interruption).-
-#### Server
-
-You may retain results specific to a single user securely on a server you control, and display the retained results only:
--- To enable the user to access a historical report of results previously returned to that user in your solution. The results may not be (i) retained for more than 21 days from the time of the end user's initial query, and (ii) displayed in response to a user's new or repeated query.-- To store results returned for your proactive query personalized in anticipation of the user's needs, based on that user's signals. You can store these results for the lesser of (i) 24 hours from the time of the query, or (ii) until a user submits another query for updated results.-
-Whenever retained, results for a specific user cannot be commingled with results for another user. That is, the results of each user must be retained and delivered separately.
-
-### General
-
-For all presentation of retained results:
--- Include a clear, visible notice of the time the query was sent.-- Present the user with a button or similar means to re-query and obtain updated results.-- Retain the Bing branding in the presentation of the results.-- Delete (and refresh with a new query if needed) the stored results within the timeframes specified.-
-### Non-display URL discovery
-
-You may only use search responses in a non-internet search experience for the sole purpose of discovering URLs of sources of information responsive to a query from your user or customer. You may copy such URLs in a report or similar response you provide:
--- Only to that user or customer, in response to that query.-- Only if it includes significant additional valuable content, relevant to the query.-
-The previous sections of Search APIs use and display requirements do not apply to this non-display use, except for the following:
--- Do not cache, copy, or store any data or content from, or derived from, the search response, other than the limited URL copying described previously.-- Ensure your use of data (including the URLs) received from the Search APIs does not violate any applicable laws or third-party rights.-- Do not use the data (including the URLs) received from the Search APIs as part of any search index or machine learning or similar algorithmic activity. Do not use this data to create train, evaluate, or improve services that you or third parties might offer.-
-## GDPR compliance
-
-With respect to any personal data subject to the European Union General Data Protection Regulation (GDPR) and that is processed in connection with calls to the Search APIs, Bing Spell Check API, or Bing Autosuggest API, you understand that you and Microsoft are independent data controllers under the GDPR. You are independently responsible for your compliance with the GDPR.
cognitive-services Web Search Endpoints https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/Bing-Web-Search/web-search-endpoints.md
- Title: Web search endpoint-
-description: To get web search results, send a `GET` request to the following endpoint. The headers and URL parameters define further specifications.
------ Previously updated : 11/14/2018---
-# Web Search endpoint
--
-The **Web Search API** returns Web pages, news, images, videos, and [entities](../bing-entities-search/overview.md). Entities have summary information about a person, place, or topic.
-
-## Endpoint
-
-To get Web search results using the Bing API, send a `GET` request to the following endpoint. The headers and URL parameters define further specifications.
-
-**Endpoint**: Returns Web results that are relevant to the user's search query defined by `?q=""`.
-
-```http
-GET https://api.cognitive.microsoft.com/bing/v7.0/search
-```
-
-Endpoint: For details about headers, parameters, market codes, response objects, errors, and more, see the [Bing Web API v7](/rest/api/cognitiveservices-bingsearch/bing-web-api-v7-reference) reference.
-
-## Response JSON
-
-The response to a Web search request includes all results as JSON objects. Parsing the result requires procedures that handle the elements of each type. See the [tutorial](./tutorial-bing-web-search-single-page-app.md) and [source code](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/tree/master/Tutorials/Bing-Web-Search) for examples.
-
-## Next steps
-
-The **Bing** APIs support search actions that return results according to their type. All search endpoints return results as JSON response objects.  All endpoints support queries that return a specific language and location by longitude, latitude, and search radius.
-
-For complete information about the parameters supported by each endpoint, see the reference pages for each type.
-For examples of basic requests using the Web search API, see [Search the Web Quick-starts](./overview.md).
cognitive-services Local Categories https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/local-categories.md
- Title: Search categories for the Bing Local Business Search API-
-description: Use this article to learn how to specify search categories for the Bing Local Business search API endpoint.
------ Previously updated : 11/01/2018---
-# Search categories for the Bing Local Business Search API
--
-The Bing Local Business Search API enables you to search for local business entities in a variety of categories, with priority given to results close a user's location. You can include these searches in searches along with the `localCircularView` and `localMapView` [parameters](specify-geographic-search.md).
--
-## TopLevel Categories
-
-The following types define major categories of search. More than one category can be specified using a comma-delimited list assigned to the `localCategories` parameter.ΓÇ»
-- EatDrink -- SeeDo -- Shop -- HotelsAndMotels -- BanksAndCreditUnions -- Parking -- Hospitals -
-## Sub Categories
-Subcategories are passed the same way as `localCategories`. Subcategories are more specific categories. They are subordinate in the sense that if you specify a category C and one of its subcategories S in the same comma-delimited list, you will receive the same results as if you specified C alone.
-
-### Eat Drink
-
-> BreweriesAndBrewPubs, CocktailLounges, AfricanRestaurants, AmericanRestaurants, Bagels, BarbecueRestaurants, Taverns, SportsBars, Bars, BarsGrillsAndPubs, BuffetRestaurants| BelgianRestaurants, BritishRestaurants, CafeRestaurants, CaribbeanRestaurants, ChineseRestaurants, CoffeeAndTea, Delicatessens, DeliveryService, Diners, DiscountStores, Donuts, FastFood, FrenchRestaurants, FrozenYogurt, GermanRestaurants, Supermarkets, GreekRestaurants, Grocers, HawaiianRestaurants, HungarianRestaurants, IceCreamAndFrozenDesserts, IndianRestaurants, ItalianRestaurants, JapaneseRestaurants, Juices, KoreanRestaurants, LiquorStores, MexicanRestaurants, MiddleEasternRestaurants, Pizza, PolishRestaurants, PortugueseRestaurants, Pretzels, Restaurants, RussianAndUkrainianRestaurants, Sandwiches, SeafoodRestaurants, SpanishRestaurants, SteakHouseRestaurants, SushiRestaurants, TakeAway, ThaiRestaurants, TurkishRestaurants, VegetarianAndVeganRestaurants, VietnameseRestaurants
-
-### See Do
-
-> AmusementParks, Attractions, Carnivals, Casinos, LandmarksAndHistoricalSites, MiniatureGolfCourses, MovieTheaters, Museums, Parks, SightseeingTours, TouristInformation, Zoos
-
-### Shop
-
-> AntiqueStores, Bookstores, CDAndRecordStores, ChildrensClothingStores, CigarAndTobaccoShops, ComicBookStores, DepartmentStores, DiscountStores, FleaMarketsAndBazaars, FurnitureStores, HomeImprovementStores, JewelryAndWatchesStores, KitchenwareStores, LiquorStores, MallsAndShoppingCenters, MensClothingStores, MusicStores, OutletStores, PetShops, PetSupplyStores, SchoolAndOfficeSupplyStores, ShoeStores, SportingGoodsStores, ToyAndGameStores, VitaminAndSupplementStores, WomensClothingStores
--
-## Examples of Local Categories search
-
-The following examples GET results according to the `localCategories` parameter:
-
-`https://api.cognitive.microsoft.com/localbusinesses/v7.0/search?&q=&mkt=en-US&localcategories=HotelsAndMotels`
-
-`https://api.cognitive.microsoft.com/localbusinesses/v7.0/search?&q=&mkt=en-US&localcategories=EatDrink`
-
-`https://api.cognitive.microsoft.com/localbusinesses/v7.0/search?&q=&mkt=en-US&localcategories=Shop`
-
-`https://api.cognitive.microsoft.com/localbusinesses/v7.0/search?&q=&mkt=en-US&localcategories=Hospitals`
-
-The following query limits the number of 'hospital' results to first three returned from the Bing Local Business Search API:
-
-`https://api.cognitive.microsoft.com/localbusinesses/v7.0/search?&q=&mkt=en-US&localCategories=Hospitals&count=3&offset=0`
-
-The following example JSON response includes three hospitals in the greater Seattle area:
-
-```json
-BingAPIs-TraceId: 68AFB51807C6485CAB8AAF20E232EFFF
-BingAPIs-SessionId: F89E7B8539B34BF58AAF811485E83B20
-X-MSEdge-ClientID: 1C44E64DBFAA6BCA1270EADDBE7D6A22
-BingAPIs-Market: en-US
-X-MSEdge-Ref: Ref A: 68AFB51807C6485CAB8AAF20E232EFFF Ref B: CO1EDGE0108 Ref C: 2018-10-22T18:52:28Z
-
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": ""
- },
- "places": {
- "readLink": "https:\/\/www.bingapis.com\/api\/v7\/places\/search?q=",
- "totalEstimatedMatches": 0,
- "value": [
- {
- "_type": "LocalBusiness",
- "id": "https:\/\/www.bingapis.com\/api\/v7\/#Places.0",
- "name": "Overlake Hospital Medical Center",
- "url": "http:\/\/www.overlakehospital.org\/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "geo": {
- "latitude": 47.6204986572266,
- "longitude": -122.185829162598
- },
- "routablePoint": {
- "latitude": 47.6204986572266,
- "longitude": -122.185668945312
- },
- "address": {
- "streetAddress": "1035 116th Ave NE",
- "addressLocality": "Bellevue",
- "addressRegion": "WA",
- "postalCode": "98004",
- "addressCountry": "US",
- "neighborhood": "",
- "text": "1035 116th Ave NE, Bellevue, WA, 98004"
- },
- "telephone": "(425) 688-5000"
- },
- {
- "_type": "LocalBusiness",
- "id": "https:\/\/www.bingapis.com\/api\/v7\/#Places.1",
- "name": "Virginia Mason University Village Medical Center",
- "url": "https:\/\/virginiamason.org\/Seattle",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "geo": {
- "latitude": 47.6095390319824,
- "longitude": -122.327941894531
- },
- "routablePoint": {
- "latitude": 47.6093978881836,
- "longitude": -122.328277587891
- },
- "address": {
- "streetAddress": "1100 9th Ave",
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98101",
- "addressCountry": "US",
- "neighborhood": "University District",
- "text": "1100 9th Ave, Seattle, WA, 98101"
- },
- "telephone": "(206) 223-6600"
- },
- {
- "_type": "LocalBusiness",
- "id": "https:\/\/www.bingapis.com\/api\/v7\/#Places.2",
- "name": "Seattle ChildrenΓÇÖs Hospital",
- "url": "http:\/\/www.seattlechildrens.org\/",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": [
- "Place",
- "LocalBusiness"
- ]
- },
- "geo": {
- "latitude": 47.6625061035156,
- "longitude": -122.283760070801
- },
- "routablePoint": {
- "latitude": 47.6631507873535,
- "longitude": -122.284614562988
- },
- "address": {
- "streetAddress": "4800 Sand Point Way NE",
- "addressLocality": "Seattle",
- "addressRegion": "WA",
- "postalCode": "98105",
- "addressCountry": "US",
- "neighborhood": "Laurelhurst",
- "text": "4800 Sand Point Way NE, Seattle, WA, 98105"
- },
- "telephone": "(206) 987-2000"
- }
- ],
- "searchAction": {
-
- }
- }
-}
-```
-
-## Next steps
-- [Geographic search boundaries](specify-geographic-search.md)-- [Query and response](local-search-query-response.md)-- [Quickstart in C#](quickstarts/local-quickstart.md)
cognitive-services Local Search Query Response https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/local-search-query-response.md
- Title: Sending and using API queries and responses - Bing Local Business Search-
-description: Use this article to learn how to send and use search queries with the Bing Local Business Search API.
------ Previously updated : 06/26/2018---
-# Sending and using Bing Local Business Search API queries and responses
--
-You can get local results from the Bing Local Business Search API by sending a search query to its endpoint and including the `Ocp-Apim-Subscription-Key` header, which is required. Along with available [headers](local-search-reference.md#headers) and [parameters](local-search-reference.md#query-parameters), Searches can be customized by specifying [geographic boundaries](specify-geographic-search.md) for the area to be searched, and the [categories](local-search-query-response.md) of places returned.
-
-## Creating a request
-
-To send a request to the Bing Local Business Search API, append a search term to the `q=` parameter before adding it to the API endpoint, and including the `Ocp-Apim-Subscription-Key` header. For example:
-
-`https://api.cognitive.microsoft.com/bing/localbusinesses/v7.0/search?q=restaurant+in+Bellevue`
-
-The full request URL syntax is shown below. See the Bing Local Business Search API [quickstarts](quickstarts/local-quickstart.md), and reference content for [headers](local-search-reference.md#headers) and [parameters](local-search-reference.md#query-parameters) for more information on sending requests.
-
-For information on local search categories, see [Search categories for the Bing Local Business Search API](local-categories.md).
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search[?q][&localCategories][&cc][&mkt][&safesearch][&setlang][&count][&first][&localCircularView][&localMapView]
-```
-
-## Using responses
-
-JSON responses from the Bing Local Business Search API contain a `SearchResponse` object. The API will return relevant search results in the `places` field. if no results are found, the `places` field will not be included in the response.
--
-```
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "restaurant in Bellevue"
- },
- "places": {
- "totalEstimatedMatches": 10,
-. . .
-```
-
-### Search result attributes
-
-The JSON results returned by the API include the following attributes:
-
-* _type
-* address
-* entityPresentationInfo
-* geo
-* id
-* name
-* routeablePoint
-* telephone
-* url
-
-For general information about headers, parameters, market codes, response objects, errors, etc., see the [Bing Local Search API v7](local-search-reference.md) reference.
-
-> [!NOTE]
-> You, or a third party on your behalf, may not use, retain, store, cache, share, or distribute any data from the Local Search API for the purpose of testing, developing, training, distributing or making available any non-Microsoft service or feature.
--
-## Example JSON response
-
-The following JSON response includes search results specified by the query `?q=restaurant+in+Bellevue`.
-
-```json
-Vary: Accept-Encoding
-BingAPIs-TraceId: 5376FFEB65294E24BB9F91AD70545826
-BingAPIs-SessionId: 06ED7CEC80F746AA892EDAAC97CB0CB4
-X-MSEdge-ClientID: 112C391E72C0624204153594738C63DE
-X-MSAPI-UserState: aeab
-BingAPIs-Market: en-US
-X-Search-ResponseInfo: InternalResponseTime=659,MSDatacenter=CO4
-X-MSEdge-Ref: Ref A: 5376FFEB65294E24BB9F91AD70545826 Ref B: BY3EDGE0306 Ref C: 2018-10-16T16:26:15Z
-apim-request-id: fe54f585-7c54-4bf5-8b92-b9bede2b710a
-Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
-x-content-type-options: nosniff
-Cache-Control: max-age=0, private
-Date: Tue, 16 Oct 2018 16:26:15 GMT
-P3P: CP="NON UNI COM NAV STA LOC CURa DEVa PSAa PSDa OUR IND"
-Content-Length: 978
-Content-Type: application/json; charset=utf-8
-Expires: Tue, 16 Oct 2018 16:25:15 GMT
-
-{
- "_type": "SearchResponse",
- "queryContext": {
- "originalQuery": "restaurant Bellevue"
- },
- "places": {
- "totalEstimatedMatches": 50,
- "value": [{
- "_type": "LocalBusiness",
- "id": "https:\/\/cognitivegblppe.azure-api.net\/api\/v7\/#Places.0",
- "name": "Facing East Taiwanese Restaurant",
- "url": "http:\/\/litadesign.wix.com\/facingeastrestaurant",
- "entityPresentationInfo": {
- "entityScenario": "ListItem",
- "entityTypeHints": ["Place", "LocalBusiness", "Restaurant"]
- },
- "geo": {
- "latitude": 47.6199188232422,
- "longitude": -122.202796936035
- },
- "routablePoint": {
- "latitude": 47.6199188232422,
- "longitude": -122.201713562012
- },
- "address": {
- "streetAddress": "1075 Bellevue Way NE Ste B2",
- "addressLocality": "Bellevue",
- "addressRegion": "WA",
- "postalCode": "98004",
- "addressCountry": "US",
- "neighborhood": "Bellevue",
- "text": "1075 Bellevue Way NE Ste B2, Bellevue, WA 98004"
- },
- "telephone": "(425) 688-2986"
- }],
- "searchAction": {
- "location": [{
- "name": "Bellevue, Washington"
- }],
- "query": "restaurant"
- }
- }
-}
-
-```
-
-## Throttling requests
---
-## Next steps
-- [Local Business Search quickstart](quickstarts/local-quickstart.md)-- [Local Business Search Java quickstart](quickstarts/local-search-java-quickstart.md)-- [Local Business Search Node quickstart](quickstarts/local-search-node-quickstart.md)-- [Local Business Search Python quickstart](quickstarts/local-search-python-quickstart.md)
cognitive-services Local Search Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/local-search-reference.md
- Title: Bing Local Business Search API v7 Reference-
-description: This article provides technical details about the response objects, and the query parameters and headers that affect the search results.
------ Previously updated : 11/01/2018---
-# Bing Local Business Search API v7 reference
--
-The Local Business Search API sends a search query to Bing to get results that include restaurants, hotels, or other local businesses. For places, the query can specify the name of the local business or a category (for example, restaurants near me). Entity results include persons, places, or things. Place in this context is business entities, states, countries/regions, etc.
-
-This section provides technical details about the response objects, and the query parameters and headers that affect the search results. For examples that show how to make requests, see [Local Business Search C# quickstart](quickstarts/local-quickstart.md) or [Local Business Search Java quickstart](quickstarts/local-search-java-quickstart.md).
-
-For information about headers that requests should include, see [Headers](#headers).
-
-For information about query parameters that requests should include, see [Query parameters](#query-parameters).
-
-For information about the JSON objects that the response includes, see [Response objects](#response-objects).
-
-For information about permitted use and display of results, see [Use and display requirements](../bing-web-search/use-display-requirements.md).
--
-
-## Endpoint
-To request local business results, send a GET request to:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search
-
-```
-
-The request must use the HTTPS protocol.
-
-> [!NOTE]
-> The maximum URL length is 2,048 characters. To ensure that your URL length does not exceed the limit, the maximum length of your query parameters should be less than 1,500 characters. If the URL exceeds 2,048 characters, the server returns 404 Not found.
-
-
-## Headers
-The following are the headers that a request and response may include.
-
-|Header|Description|
-||--|
-|Accept|Optional request header.<br /><br /> The default media type is application/json. To specify that the response use [JSON-LD](https://json-ld.org/), set the Accept header to application/ld+json.|
-|<a name="acceptlanguage"></a>Accept-Language|Optional request header.<br /><br /> A comma-delimited list of languages to use for user interface strings. The list is in decreasing order of preference. For more information, including expected format, see [RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).<br /><br /> This header and the [setLang](#setlang) query parameter are mutually exclusive&mdash;do not specify both.<br /><br /> If you set this header, you must also specify the cc query parameter. To determine the market to return results for, Bing uses the first supported language it finds from the list and combines it with the `cc` parameter value. If the list does not include a supported language, Bing finds the closest language and market that supports the request or it uses an aggregated or default market for the results. To determine the market that Bing used, see the BingAPIs-Market header.<br /><br /> Use this header and the `cc` query parameter only if you specify multiple languages. Otherwise, use the [mkt](#mkt) and [setLang](#setlang) query parameters.<br /><br /> A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Any links to Bing.com properties in the response objects apply the specified language.|
-|<a name="market"></a>BingAPIs-Market|Response header.<br /><br /> The market used by the request. The form is \<languageCode\>-\<countryCode\>. For example, en-US.|
-|<a name="traceid"></a>BingAPIs-TraceId|Response header.<br /><br /> The ID of the log entry that contains the details of the request. When an error occurs, capture this ID. If you are not able to determine and resolve the issue, include this ID along with the other information that you provide the Support team.|
-|<a name="subscriptionkey"></a>Ocp-Apim-Subscription-Key|Required request header.<br /><br /> The subscription key that you received when you signed up for this service in [Azure AI services](https://www.microsoft.com/cognitive-services/).|
-|<a name="pragma"></a>Pragma|Optional request header<br /><br /> By default, Bing returns cached content, if available. To prevent Bing from returning cached content, set the Pragma header to no-cache (for example, Pragma: no-cache).
-|<a name="useragent"></a>User-Agent|Optional request header.<br /><br /> The user agent originating the request. Bing uses the user agent to provide mobile users with an optimized experience. Although optional, you are encouraged to always specify this header.<br /><br /> The user-agent should be the same string that any commonly used browser sends. For information about user agents, see [RFC 2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).<br /><br /> The following are examples of user-agent strings.<br /><ul><li>Windows Phone&mdash;Mozillash;Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53</li></ul>|
-|<a name="clientid"></a>X-MSEdge-ClientID|Optional request and response header.<br /><br /> Bing uses this header to provide users with consistent behavior across Bing API calls. Bing often flights new features and improvements, and it uses the client ID as a key for assigning traffic on different flights. If you do not use the same client ID for a user across multiple requests, then Bing may assign the user to multiple conflicting flights. Being assigned to multiple conflicting flights can lead to an inconsistent user experience. For example, if the second request has a different flight assignment than the first, the experience may be unexpected. Also, Bing can use the client ID to tailor web results to that client IDΓÇÖs search history, providing a richer experience for the user.<br /><br /> Bing also uses this header to help improve result rankings by analyzing the activity generated by a client ID. The relevance improvements help with better quality of results delivered by Bing APIs and in turn enables higher click-through rates for the API consumer.<br /><br /> **IMPORTANT:** Although optional, you should consider this header required. Persisting the client ID across multiple requests for the same end user and device combination enables 1) the API consumer to receive a consistent user experience, and 2) higher click-through rates via better quality of results from the Bing APIs.<br /><br /> The following are the basic usage rules that apply to this header.<br /><ul><li>Each user that uses your application on the device must have a unique, Bing generated client ID.<br /><br/>If you do not include this header in the request, Bing generates an ID and returns it in the X-MSEdge-ClientID response header. The only time that you should NOT include this header in a request is the first time the user uses your app on that device.<br /><br/></li><li>Use the client ID for each Bing API request that your app makes for this user on the device.<br /><br/></li><li>**ATTENTION:** You must ensure that this Client ID is not linkable to any authenticatable user account information.</li><br/><li>Persist the client ID. To persist the ID in a browser app, use a persistent HTTP cookie to ensure the ID is used across all sessions. Do not use a session cookie. For other apps such as mobile apps, use the device's persistent storage to persist the ID.<br /><br/>The next time the user uses your app on that device, get the client ID that you persisted.</li></ul><br /> **NOTE:** Bing responses may or may not include this header. If the response includes this header, capture the client ID and use it for all subsequent Bing requests for the user on that device.<br /><br /> **NOTE:** If you include the X-MSEdge-ClientID, you must not include cookies in the request.|
-|<a name="clientip"></a>X-MSEdge-ClientIP|Optional request header.<br /><br /> The IPv4 or IPv6 address of the client device. The IP address is used to discover the user's location. Bing uses the location information to determine safe search behavior.<br /><br /> **NOTE:** Although optional, you are encouraged to always specify this header and the X-Search-Location header.<br /><br /> Do not obfuscate the address (for example, by changing the last octet to 0). Obfuscating the address results in the location not being anywhere near the device's actual location, which may result in Bing serving erroneous results.|
-|<a name="location"></a>X-Search-Location|Optional request header.<br /><br /> A semicolon-delimited list of key/value pairs that describe the client's geographical location. Bing uses the location information to determine safe search behavior and to return relevant local content. Specify the key/value pair as \<key\>:\<value\>. The following are the keys that you use to specify the user's location.<br /><br /><ul><li>lat&mdash;The latitude of the client's location, in degrees. The latitude must be greater than or equal to -90.0 and less than or equal to +90.0. Negative values indicate southern latitudes and positive values indicate northern latitudes.<br /><br /></li><li>long&mdash;The longitude of the client's location, in degrees. The longitude must be greater than or equal to -180.0 and less than or equal to +180.0. Negative values indicate western longitudes and positive values indicate eastern longitudes.<br /><br /></li><li>re&mdash; The radius, in meters, which specifies the horizontal accuracy of the coordinates. Pass the value returned by the device's location service. Typical values might be 22m for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP lookup.<br /><br /></li><li>ts&mdash; The UTC UNIX timestamp of when the client was at the location. (The UNIX timestamp is the number of seconds since January 1, 1970.)<br /><br /></li><li>head&mdash;Optional. The client's relative heading or direction of travel. Specify the direction of travel as degrees from 0 through 360, counting clockwise relative to true north. Specify this key only if the `sp` key is nonzero.<br /><br /></li><li>sp&mdash; The horizontal velocity (speed), in meters per second, that the client device is traveling.<br /><br /></li><li>alt&mdash; The altitude of the client device, in meters.<br /><br /></li><li>are&mdash;Optional. The radius, in meters, that specifies the vertical accuracy of the coordinates. Radius defaults to 50 Kilometers. Specify this key only if you specify the `alt` key.<br /><br /></li></ul> **NOTE:** Although these keys are optional, the more information that you provide, the more accurate the location results are.<br /><br /> **NOTE:** You are encouraged to always specify the user's geographical location. Providing the location is especially important if the client's IP address does not accurately reflect the user's physical location (for example, if the client uses VPN). For optimal results, you should include this header and the X-MSEdge-ClientIP header, but at a minimum, you should include this header.|
-
-> [!NOTE]
-> Remember that the Terms of Use require compliance with all applicable laws, including regarding use of these headers. For example, in certain jurisdictions, such as Europe, there are requirements to obtain user consent before placing certain tracking devices on user devices.
-
-
-## Query parameters
-The request may include the following query parameters. See the Required column for required parameters. You must URL encode the query parameters.
-
-
-|Name|Value|Type|Required|
-|-|--|-|--|
-|<a name="count"></a>count|The number of results to return, starting with the index specified by the `offset` parameter.|String|No|
-|<a name="localCategories"></a>localCategories|List of options that define search by business category. See [Local Business Categories search](local-categories.md)|String|No|
-|<a name="mkt"></a>mkt|The market where the results come from. <br /><br />For a list of possible market values, see Market Codes.<br /><br /> **NOTE:** The Local Business Search API currently only supports en-us market and language.<br /><br />|String|Yes|
-|<a name="offset"></a>offset|The index to start results specified by the `count` parameter.|Integer|No|
-|<a name="query"></a>q|The user's search term.|String|No|
-|<a name="responseformat"></a>responseFormat|The media type to use for the response. The following are the possible case-insensitive values.<br /><ul><li>JSON</li><li>JSONLD</li></ul><br /> The default is JSON. For information about the JSON objects that the response contains, see [Response Objects](#response-objects).<br /><br /> If you specify JsonLd, the response body includes JSON-LD objects that contain the search results. For information about the JSON-LD, see [JSON-LD](https://json-ld.org/).|String|No|
-|<a name="safesearch"></a>safeSearch|A filter used to filter adult content. The following are the possible case-insensitive filter values.<br /><ul><li>Off&mdash;Return webpages with adult text, images, or videos.<br /><br/></li><li>Moderate&mdash;Return webpages with adult text, but not adult images or videos.<br /><br/></li><li>Strict&mdash;Do not return webpages with adult text, images, or videos.</li></ul><br /> The default is Moderate.<br /><br /> **NOTE:** If the request comes from a market that Bing's adult policy requires that `safeSearch` is set to Strict, Bing ignores the `safeSearch` value and uses Strict.<br/><br/>**NOTE:** If you use the `site:` query operator, there is the chance that the response may contain adult content regardless of what the `safeSearch` query parameter is set to. Use `site:` only if you are aware of the content on the site and your scenario supports the possibility of adult content. |String|No|
-|<a name="setlang"></a>setLang|The language to use for user interface strings. Specify the language using the ISO 639-1 2-letter language code. For example, the language code for English is EN. The default is EN (English).<br /><br /> Although optional, you should always specify the language. Typically, you set `setLang` to the same language specified by `mkt` unless the user wants the user interface strings displayed in a different language.<br /><br /> This parameter and the [Accept-Language](#acceptlanguage) header are mutually exclusive&mdash;do not specify both.<br /><br /> A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects apply the specified language.|String|No|
--
-## Response Objects
-The following are the JSON response objects that the response may include. If the request succeeds, the top-level object in the response is the [SearchResponse](#searchresponse) object. If the request fails, the top-level object is the [ErrorResponse](#errorresponse) object.
--
-|Object|Description|
-||--|
-|[Place](#place)|Defines information about a local business such as a restaurant or hotel.|
-
-
-### Error
-Defines the error that occurred.
-
-|Element|Description|Type|
-|-|--|-|
-|<a name="error-code"></a>code|The error code that identifies the category of error. For a list of possible codes, see [Error Codes](#error-codes).|String|
-|<a name="error-message"></a>message|A description of the error.|String|
-|<a name="error-moredetails"></a>moreDetails|A description that provides additional information about the error.|String|
-|<a name="error-parameter"></a>parameter|The query parameter in the request that caused the error.|String|
-|<a name="error-subcode"></a>subCode|The error code that identifies the error. For example, if `code` is InvalidRequest, `subCode` may be ParameterInvalid or ParameterInvalidValue. |String|
-|<a name="error-value"></a>value|The query parameter's value that was not valid.|String|
-
-
-### ErrorResponse
-The top-level object that the response includes when the request fails.
-
-|Name|Value|Type|
-|-|--|-|
-|_type|Type hint.|String|
-|<a name="errors"></a>errors|A list of errors that describe the reasons why the request failed.|[Error](#error)[]|
-
-
-
-### License
-Defines the license under which the text or photo may be used.
-
-|Name|Value|Type|
-|-|--|-|
-|name|The name of the license.|String|
-|url|The URL to a website where the user can get more information about the license.<br /><br /> Use the name and URL to create a hyperlink.|String|
--
-### Link
-Defines the components of a hyperlink.
-
-|Name|Value|Type|
-|-|--|-|
-|_type|Type hint.|String|
-|text|The display text.|String|
-|url|A URL. Use the URL and display text to create a hyperlink.|String|
-
--
-
-### Organization
-Defines a publisher.
-
-Note that a publisher may provide their name or their website or both.
-
-|Name|Value|Type|
-|-|--|-|
-|name|The publisher's name.|String|
-|url|The URL to the publisher's website.<br /><br /> Note that the publisher may not provide a website.|String|
-
-
-
-### Place
-Defines information about a local business, such as a restaurant or hotel.
-
-|Name|Value|Type|
-|-|--|-|
-|_type|Type hint, which may be set to one of the following:<br /><br /><ul><li>Hotel</li><li>LocalBusiness<br /></li><li>Restaurant</ul><li>|String|
-|address|The postal address of where the entity is located.|PostalAddress|
-|entityPresentationInfo|Additional information about the entity such as hints that you can use to determine the entity's type. For example, whether it's a restaurant or hotel. The `entityScenario` field is set to ListItem.|EntityPresentationInfo|
-|name|The entity's name.|String|
-|telephone|The entity's telephone number.|String|
-|url|The URL to the entity's website.<br /><br /> Use this URL along with the entity's name to create a hyperlink that when clicked takes the user to the entity's website.|String|
-|webSearchUrl|The URL to Bing's search result for this place.|String|
-
-
-### QueryContext
-Defines the query context that Bing used for the request.
-
-|Element|Description|Type|
-|-|--|-|
-|adultIntent|A Boolean value that indicates whether the specified query has adult intent. The value is **true** if the query has adult intent; otherwise, **false**.|Boolean|
-|alterationOverrideQuery|The query string to use to force Bing to use the original string. For example, if the query string is *saling downwind*, the override query string will be *+saling downwind*. Remember to encode the query string which results in *%2Bsaling+downwind*.<br /><br /> This field is included only if the original query string contains a spelling mistake.|String|
-|alteredQuery|The query string used by Bing to perform the query. Bing uses the altered query string if the original query string contained spelling mistakes. For example, if the query string is `saling downwind`, the altered query string will be `sailing downwind`.<br /><br /> This field is included only if the original query string contains a spelling mistake.|String|
-|askUserForLocation|A Boolean value that indicates whether Bing requires the user's location to provide accurate results. If you specified the user's location by using the [X-MSEdge-ClientIP](#clientip) and [X-Search-Location](#location) headers, you can ignore this field.<br /><br /> For location aware queries, such as "today's weather" or "restaurants near me" that need the user's location to provide accurate results, this field is set to **true**.<br /><br /> For location aware queries that include the location (for example, "Seattle weather"), this field is set to **false**. This field is also set to **false** for queries that are not location aware, such as "best sellers".|Boolean|
-|originalQuery|The query string as specified in the request.|String|
-
-### Identifiable
-
-|Name|Value|Type|
-|-|--|-|
-|id|A resource identifier|String|
-
-### RankingGroup
-Defines a search results group, such as mainline.
-
-|Name|Value|Type|
-|-|--|-|
-|items|A list of search results to display in the group.|RankingItem|
-
-### RankingItem
-Defines a search result item to display.
-
-|Name|Value|Type|
-|-|--|-|
-|resultIndex|A zero-based index of the item in the answer to display. If the item does not include this field, display all items in the answer. For example, display all news articles in the News answer.|Integer|
-|answerType|The answer that contains the item to display. For example, News.<br /><br />Use the type to find the answer in the SearchResponse object. The type is the name of a SearchResponse field.<br /><br /> However, use the answer type only if this object includes the value field; otherwise, ignore it.|String|
-|textualIndex|The index of the answer in textualAnswers to display.| Unsigned Integer|
-|value|The ID that identifies either an answer to display or an item of an answer to display. If the ID identifies an answer, display all items of the answer.|Identifiable|
-
-### RankingResponse
-Defines where on the search results page content should be placed and in what order.
-
-|Name|Value|
-|-|--|
-|<a name="ranking-mainline"></a>mainline|The search results to display in the mainline.|
-|<a name="ranking-pole"></a>pole|The search results that should be afforded the most visible treatment (for example, displayed above the mainline and sidebar).|
-|<a name="ranking-sidebar"></a>sidebar|The search results to display in the sidebar.|
-
-### SearchResponse
-Defines the top-level object that the response includes when the request succeeds.
-
-Note that if the service suspects a denial of service attack, the request will succeed (HTTP status code is 200 OK); however, the body of the response will be empty.
-
-|Name|Value|Type|
-|-|--|-|
-|_type|Type hint, which is set to SearchResponse.|String|
-|places|A list of entities that are relevant to the search query.|JSON object|
-|queryContext|An object that contains the query string that Bing used for the request.<br /><br /> This object contains the query string as entered by the user. It may also contain an altered query string that Bing used for the query if the query string contained a spelling mistake.|[QueryContext](#querycontext)|
--
-## Error codes
-
-The following are the possible HTTP status codes that a request returns.
-
-|Status Code|Description|
-|--|--|
-|200|Success.|
-|400|One of the query parameters is missing or not valid.|
-|401|The subscription key is missing or is not valid.|
-|403|The user is authenticated (for example, they used a valid subscription key) but they donΓÇÖt have permission to the requested resource.<br /><br /> Bing may also return this status if the caller exceeded their queries per month quota.|
-|410|The request used HTTP instead of the HTTPS protocol. HTTPS is the only supported protocol.|
-|429|The caller exceeded their queries per second quota.|
-|500|Unexpected server error.|
-
-If the request fails, the response contains an [ErrorResponse](#errorresponse) object, which contains a list of [Error](#error) objects that describe what caused of error. If the error is related to a parameter, the `parameter` field identifies the parameter that is the issue. And if the error is related to a parameter value, the `value` field identifies the value that is not valid.
-
-```json
-{
- "_type": "ErrorResponse",
- "errors": [
- {
- "code": "InvalidRequest",
- "subCode": "ParameterMissing",
- "message": "Required parameter is missing.",
- "parameter": "q"
- }
- ]
-}
-
-{
- "_type": "ErrorResponse",
- "errors": [
- {
- "code": "InvalidAuthorization",
- "subCode": "AuthorizationMissing",
- "message": "Authorization is required.",
- "moreDetails": "Subscription key is not recognized."
- }
- ]
-}
-```
-
-The following are the possible error code and sub-error code values.
-
-|Code|SubCode|Description
-|-|-|-
-|ServerError|UnexpectedError<br/>ResourceError<br/>NotImplemented|HTTP status code is 500.
-|InvalidRequest|ParameterMissing<br/>ParameterInvalidValue<br/>HttpNotAllowed<br/>Blocked|Bing returns InvalidRequest whenever any part of the request is not valid. For example, a required parameter is missing or a parameter value is not valid.<br/><br/>If the error is ParameterMissing or ParameterInvalidValue, the HTTP status code is 400.<br/><br/>If you use the HTTP protocol instead of HTTPS, Bing returns HttpNotAllowed, and the HTTP status code is 410.
-|RateLimitExceeded|No sub-codes|Bing returns RateLimitExceeded whenever you exceed your queries per second (QPS) or queries per month (QPM) quota.<br/><br/>If you exceed QPS, Bing returns HTTP status code 429, and if you exceed QPM, Bing returns 403.
-|InvalidAuthorization|AuthorizationMissing<br/>AuthorizationRedundancy|Bing returns InvalidAuthorization when Bing cannot authenticate the caller. For example, the `Ocp-Apim-Subscription-Key` header is missing or the subscription key is not valid.<br/><br/>Redundancy occurs if you specify more than one authentication method.<br/><br/>If the error is InvalidAuthorization, the HTTP status code is 401.
-|InsufficientAuthorization|AuthorizationDisabled<br/>AuthorizationExpired|Bing returns InsufficientAuthorization when the caller does not have permissions to access the resource. This can occur if the subscription key has been disabled or has expired. <br/><br/>If the error is InsufficientAuthorization, the HTTP status code is 403.
-
-## Next steps
-- [Local Business Search quickstart](quickstarts/local-quickstart.md)-- [Local Business Search Java quickstart](quickstarts/local-search-java-quickstart.md)-- [Local Business Search Node quickstart](quickstarts/local-search-node-quickstart.md)-- [Local Business Search Python quickstart](quickstarts/local-search-python-quickstart.md)
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/overview.md
- Title: What is the Bing Local Business Search API?-
-description: The Bing Local Business Search API is a RESTful service that enables your applications to find information about local places and businesses based on search queries.
------ Previously updated : 03/24/2020---
-# What is Bing Local Business Search?
-
-The Bing Local Business Search API is a RESTful service that enables your applications to find information about local businesses based on search queries. For example, `q=<business-name> in Redmond, Washington`, or `q=Italian restaurants near me`.
-
-## Features
-| Feature | Description |
-| -- | -- |
-| [Find local businesses and locations](quickstarts/local-quickstart.md) | The Bing Local Business Search API gets localized results from a query. Results include a URL for the business's website and display text, phone number, and geographical location, including: GPS coordinates, city, street address |
-| [Filter local results with geographic boundaries](specify-geographic-search.md) | Add coordinates as search parameters to limit results to a specific geographic area, specified by either a circular area or square bounding box. |
-| [Filter local business results by category](local-categories.md) | Search for local business results by category. This option uses reverse IP location or GPS coordinates of the caller to return localized results in various categories of business.|
-
-## Workflow
-Call the Bing Local Business Search API from any programming language that can make HTTP requests and parse JSON responses. This service is accessible using the REST API.
-
-1. Create an [Azure AI services API account](../cognitive-services-apis-create-account.md) with access to the Bing Search APIs. If you don't have an Azure subscription, you can [create a free account](https://azure.microsoft.com/free/cognitive-services/).
-2. URL encode your search terms for the `q=""` query parameter. For example, `q=nearby+restaurant` or `q=nearby%20restaurant`. Set pagination as well, if needed.
-3. Send a [request to the Bing Local Business Search API](quickstarts/local-quickstart.md)
-4. Parse the JSON response
-
-> [!NOTE]
-> Currently, Local Business Search:
-> * Only supports only the `en-US` market.
-> * Does not support Bing Autosuggest.
-
-## Next steps
-- [Query and response](local-search-query-response.md)-- [Local Business Search quickstart](quickstarts/local-quickstart.md)-- [Local Business Search API reference](local-search-reference.md)-- [Use and display requirements](../bing-web-search/use-display-requirements.md)
cognitive-services Local Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/quickstarts/local-quickstart.md
- Title: "Quickstart - Send a query to the API in C# using Bing Local Business Search"-
-description: "Use this quickstart to begin sending requests in C# to the Bing Local Business Search API, which is an Azure Cognitive Service."
------ Previously updated : 10/22/2020----
-# Quickstart: Send a query to the Bing Local Business Search API in C#
--
-Use this quickstart to learn how to send requests to the Bing Local Business Search API, which is an Azure Cognitive Service. Although this simple application is written in C#, the API is a RESTful Web service compatible with any programming language capable of making HTTP requests and parsing JSON.
-
-This example application gets local response data from the API for a search query.
-
-## Prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Any edition of [Visual Studio 2019](https://www.visualstudio.com/downloads/).
-* If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-## Create the request
-
-The following code creates a `WebRequest`, sets the access key header, and adds a query string for *restaurant in Bellevue*. It then sends the request and assigns the response to a string to contain the JSON text.
-
-```csharp
- // Replace the accessKey string value with your valid access key.
- const string accessKey = "enter key here";
-
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search";
-
- const string searchTerm = "restaurant in Bellevue";
- // Construct the URI of the search request
- var uriQuery = uriBase + "?q=" + Uri.EscapeDataString(searchQuery) + mkt=en-us;
-
- // Run the Web request and get response.
- WebRequest request = HttpWebRequest.Create(uriQuery);
- request.Headers["Ocp-Apim-Subscription-Key"] = accessKey;
-
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
-```
-
-## Run the complete application
-
-The following code uses the Bing Local Business Search API to return localized search results from the Bing search engine. You can use this code by following these steps:
-1. Create a new console solution in Visual Studio (the Community Edition is sufficient).
-2. Replace Program.cs with the code provided below.
-3. Replace the `accessKey` value with an access key valid for your subscription.
-4. Run the program.
-
-```csharp
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Net;
-using System.IO;
-
-namespace localSearch
-{
- class Program
- {
- // **********************************************
- // *** Update or verify the following values. ***
- // **********************************************
-
- // Replace the accessKey string value with your valid access key.
- const string accessKey = "enter key here";
-
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search";
-
- const string searchTerm = "restaurant in Bellevue";
-
- // Returns search results including relevant headers
- struct SearchResult
- {
- public String jsonResult;
- public Dictionary<String, String> relevantHeaders;
- }
-
- static void Main()
- {
- Console.OutputEncoding = System.Text.Encoding.UTF8;
- Console.WriteLine("Searching locally for: " + searchTerm);
-
- SearchResult result = BingLocalSearch(searchTerm, accessKey);
-
- Console.WriteLine("\nRelevant HTTP Headers:\n");
- foreach (var header in result.relevantHeaders)
- Console.WriteLine(header.Key + ": " + header.Value);
-
- Console.WriteLine("\nJSON Response:\n");
- Console.WriteLine(JsonPrettyPrint(result.jsonResult));
-
- Console.Write("\nPress Enter to exit ");
- Console.ReadLine();
- }
-
- /// <summary>
- /// Performs a Bing Local business search and return the results as a SearchResult.
- /// </summary>
- static SearchResult BingLocalSearch(string searchQuery, string key)
- {
- // Construct the URI of the search request
- var uriQuery = uriBase + "?q=" + Uri.EscapeDataString(searchQuery) + "&mkt=en-us";
-
- // Perform the Web request and get the response
- WebRequest request = HttpWebRequest.Create(uriQuery);
- request.Headers["Ocp-Apim-Subscription-Key"] = key;
-
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
-
- // Create result object for return
- var searchResult = new SearchResult();
- searchResult.jsonResult = json;
- searchResult.relevantHeaders = new Dictionary<String, String>();
-
- // Extract Bing HTTP headers
- foreach (String header in response.Headers)
- {
- if (header.StartsWith("BingAPIs-") || header.StartsWith("X-MSEdge-"))
- searchResult.relevantHeaders[header] = response.Headers[header];
- }
-
- return searchResult;
- }
-
- /// <summary>
- /// Formats the given JSON string by adding line breaks and indents.
- /// </summary>
- /// <param name="json">The raw JSON string to format.</param>
- /// <returns>The formatted JSON string.</returns>
- static string JsonPrettyPrint(string json)
- {
- if (string.IsNullOrEmpty(json))
- return string.Empty;
-
- json = json.Replace(Environment.NewLine, "").Replace("\t", "");
-
- StringBuilder sb = new StringBuilder();
- bool quote = false;
- bool ignore = false;
- int offset = 0;
- int indentLength = 3;
-
- foreach (char ch in json)
- {
- switch (ch)
- {
- case '"':
- if (!ignore) quote = !quote;
- break;
- case '\'':
- if (quote) ignore = !ignore;
- break;
- }
-
- if (quote)
- sb.Append(ch);
- else
- {
- switch (ch)
- {
- case '{':
- case '[':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', ++offset * indentLength));
- break;
- case '}':
- case ']':
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', --offset * indentLength));
- sb.Append(ch);
- break;
- case ',':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', offset * indentLength));
- break;
- case ':':
- sb.Append(ch);
- sb.Append(' ');
- break;
- default:
- if (ch != ' ') sb.Append(ch);
- break;
- }
- }
- }
-
- return sb.ToString().Trim();
- }
- }
-}
-
-```
-
-## Next steps
-- [Local Business Search Java quickstart](local-search-java-quickstart.md)-- [Local Business Search Node.js quickstart](local-search-node-quickstart.md)-- [Local Business Search Python quickstart](local-search-python-quickstart.md)
cognitive-services Local Search Java Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/quickstarts/local-search-java-quickstart.md
- Title: Quickstart - Send a query to the API using Java - Bing Local Business Search-
-description: Use this quickstart to begin sending requests in Java to the Bing Local Business Search API, which is an Azure Cognitive Service.
---- Previously updated : 05/12/2020------
-# Quickstart: Send a query to the Bing Local Business Search API using Java
--
-Use this quickstart to learn how to send requests to the Bing Local Business Search API, which is an Azure Cognitive Service. Although this simple application is written in Java, the API is a RESTful Web service compatible with any programming language capable of making HTTP requests and parsing JSON.
-
-This example application gets local response data from the API for a search query.
-
-## Prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* The [Java Development Kit (JDK)](https://www.oracle.com/technetwork/java/javase/downloads/https://docsupdatetracker.net/index.html).
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-## Create the request
-
-The following code creates a `WebRequest`, sets the access key header, and adds a query string for *hotel in Bellevue*. It then sends the request and assigns the response to a string to contain the JSON text.
-
-```java
- // construct URL of search request (endpoint + query string)
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8") + &mkt=en-us");
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
-
- // receive JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
-
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
-```
-
-## Run the complete application
-
-The following code uses the Bing Local Business Search API to return search results from the Bing search engine. Run this code by following these steps:
-1. Download or install the gson library.
-2. Create a new Java project in your favorite IDE or editor.
-3. Add the code provided below.
-4. Replace the `subscriptionKey` value with an access key valid for your subscription.
-5. Run the program.
-
-```java
-package localSearch;
-import java.net.*;
-import java.util.*;
-import java.io.*;
-import javax.net.ssl.HttpsURLConnection;
-
-/*
- * Gson: https://github.com/google/gson
- * Maven info:
- * groupId: com.google.code.gson
- * artifactId: gson
- * version: 2.8.1
- *
- * Once you have compiled or downloaded gson-2.8.1.jar, assuming you have placed it in the
- * same folder as this file (localSearch.java), you can compile and run this program at
- * the command line as follows.
- *
- * javac localSearch.java -classpath .;gson-2.8.1.jar -encoding UTF-8
- * java -cp .;gson-2.8.1.jar localSearch
- */
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-public class LocalSearchCls {
-
- // ***********************************************
- // *** Update or verify the following values. ***
- // **********************************************
-
- // Replace the subscriptionKey string value with your valid subscription key.
- static String subscriptionKey = "YOUR-ACCESS-KEY";
-
- static String host = "https://api.cognitive.microsoft.com/bing";
- static String path = "/v7.0/localbusinesses/search";
-
- static String searchTerm = "Hotel in Bellevue";
-
- public static SearchResults SearchLocal (String searchQuery) throws Exception {
- // construct URL of search request (endpoint + query string)
- URL url = new URL(host + path + "?q=" + URLEncoder.encode(searchQuery, "UTF-8") + "&mkt=en-us");
- HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
- connection.setRequestProperty("Ocp-Apim-Subscription-Key", subscriptionKey);
-
- // receive JSON body
- InputStream stream = connection.getInputStream();
- String response = new Scanner(stream).useDelimiter("\\A").next();
-
- // construct result object for return
- SearchResults results = new SearchResults(new HashMap<String, String>(), response);
-
- // extract Bing-related HTTP headers
- Map<String, List<String>> headers = connection.getHeaderFields();
- for (String header : headers.keySet()) {
- if (header == null) continue; // may have null key
- if (header.startsWith("BingAPIs-") || header.startsWith("X-MSEdge-")) {
- results.relevantHeaders.put(header, headers.get(header).get(0));
- }
- }
-
- stream.close();
- return results;
- }
-
- // pretty-printer for JSON; uses GSON parser to parse and re-serialize
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
-
- public static void main (String[] args) {
- try {
- System.out.println("Searching the Web for: " + searchTerm);
-
- SearchResults result = SearchLocal(searchTerm);
-
- System.out.println("\nRelevant HTTP Headers:\n");
- for (String header : result.relevantHeaders.keySet())
- System.out.println(header + ": " + result.relevantHeaders.get(header));
-
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(result.jsonResponse));
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- System.exit(1);
- }
- }
- }
-
- // Container class for search results encapsulates relevant headers and JSON data
- class SearchResults{
- HashMap<String, String> relevantHeaders;
- String jsonResponse;
- SearchResults(HashMap<String, String> headers, String json) {
- relevantHeaders = headers;
- jsonResponse = json;
- }
- }
-
-```
-
-## Next steps
-- [Local Business Search C# quickstart](local-quickstart.md)-- [Local Business Search Node.js quickstart](local-search-node-quickstart.md)-- [Local Business Search Python quickstart](local-search-python-quickstart.md)
cognitive-services Local Search Node Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/quickstarts/local-search-node-quickstart.md
- Title: Quickstart - Send a query to the API using Node.js - Bing Local Business Search-
-description: Use this quickstart to begin sending requests to the Bing Local Business Search API, which is an Azure Cognitive Service.
------ Previously updated : 05/12/2020----
-# Quickstart: Send a query to the Bing Local Business Search API using Node.js
--
-Use this quickstart to learn how to send requests to the Bing Local Business Search API, which is an Azure Cognitive Service. Although this simple application is written in Node.js, the API is a RESTful Web service compatible with any programming language capable of making HTTP requests and parsing JSON.
-
-This example application gets local response data from the API for a search query.
-
-## Prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* The latest version of [Node.js](https://nodejs.org/en/download/).
-* The [JavaScript Request Library](https://github.com/request/request).
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
--
-## Code scenario
-
-The following code defines and sends the request, which is implemented in the following steps:
-
-1. Declare variables to specify the endpoint by host and path.
-2. Specify the query, and add the query parameter.
-3. Create a handler function for the response.
-4. Define the Search function that creates the request and adds the `Ocp-Apim-Subscription-Key` header.
-5. Run the search function.
--
-```javascript
-'use strict';
-
-let https = require('https');
-
-// Replace the subscriptionKey string value with your valid subscription key.
-let subscriptionKey = 'your-access-key';
-
-let host = 'api.cognitive.microsoft.com/bing';
-let path = '/v7.0/localbusinesses/search';
-
-let mkt = 'en-US';
-let q = 'hotel in Bellevue';
-
-let params = '?q=' + encodeURI(q) + "&mkt=" + mkt;
-
-let response_handler = function (response) {
- let body = '';
- response.on('data', function (d) {
- body += d;
- });
- response.on('end', function () {
- let body_ = JSON.parse(body);
- let body__ = JSON.stringify(body_, null, ' ');
- console.log(body__);
- });
- response.on('error', function (e) {
- console.log('Error: ' + e.message);
- });
-};
-
-let Search = function () {
- let request_params = {
- method: 'GET',
- hostname: host,
- path: path + params,
- headers: {
- 'Ocp-Apim-Subscription-Key': subscriptionKey,
- }
- };
-
- let req = https.request(request_params, response_handler);
- req.end();
-}
-
-Search();
-
-```
-
-## Next steps
-
-* [Local Business Search C# quickstart](local-quickstart.md)
-* [Local Business Search Java quickstart](local-search-java-quickstart.md)
-* [Local Business Search Python quickstart](local-search-python-quickstart.md)
cognitive-services Local Search Python Quickstart https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/quickstarts/local-search-python-quickstart.md
- Title: Quickstart - Send a query to the API in Python - Bing Local Business Search-
-description: Use this quickstart to start using the Bing Local Business Search API in Python.
---- Previously updated : 05/12/2020-----
-# Quickstart: Send a query to the Bing Local Business Search API in Python
--
-Use this quickstart to learn how to send requests to the Bing Local Business Search API, which is an Azure Cognitive Service. Although this simple application is written in Python, the API is a RESTful Web service compatible with any programming language capable of making HTTP requests and parsing JSON.
-
-This example application gets local response data from the API for a search query.
-
-## Prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* [Python](https://www.python.org/) 2.x or 3.x.
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-
-## Run the complete application
-
-The following example gets localized results, which are implemented in the following steps:
-1. Declare variables to specify the endpoint by host and path.
-2. Specify the query parameter.
-3. Define the search function that creates the request and adds the `Ocp-Apim-Subscription-Key` header.
-4. Set the `Ocp-Apim-Subscription-Key` header.
-5. Make the connection and send the request.
-6. Print the JSON results.
-
-The complete code for this demo is as follows:
-
-```python
-import http.client, urllib.parse
-import json
-
-# Replace the subscriptionKey string value with your valid subscription key.
-
-subscriptionKey = 'YOUR-SUBSCRIPTION-KEY'
-
-host = 'api.cognitive.microsoft.com'
-path = '/bing/v7.0/localbusinesses/search'
-
-query = 'restaurant in Bellevue'
-
-params = '?q=' + urllib.parse.quote (query) + '&mkt=en-us'
-
-def get_local():
- headers = {'Ocp-Apim-Subscription-Key': subscriptionKey}
- conn = http.client.HTTPSConnection (host)
- conn.request ("GET", path + params, None, headers)
- response = conn.getresponse ()
- return response.read ()
-
-result = get_local()
-print (json.dumps(json.loads(result), indent=4))
-
-```
-
-## Next steps
-- [Local Business Search Java quickstart](local-search-java-quickstart.md)-- [Local Business Search C# quickstart](local-quickstart.md)-- [Local Business Search Node.js quickstart](local-search-node-quickstart.md)
cognitive-services Specify Geographic Search https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-local-business-search/specify-geographic-search.md
- Title: Use geographic boundaries to filter results from the Bing Local Business Search API-
-description: Use this article to learn how to filter search results from the Bing Local Business Search API.
------ Previously updated : 11/01/2018---
-# Use geographic boundaries to filter results from the Bing Local Business Search API
--
-The Bing Local Business Search API enables you to set boundaries on the specific geographic area you'd like to search by using the `localCircularView` or `localMapView` query parameters. Be sure to use only one parameter in your queries.
-
-If a search term contains an explicit geographic location, The Bing Local Business API will automatically use it to set boundaries for the search results. For example, if the search term is `sailing in San Diego`, then `San Diego` will be used as the location and any other specified locations in the query parameters or user headers will be ignored.
-
-If a geographic location isn't detected in the search term, and no geographic location is specified using the query parameters, The Bing Local Business Search API will attempt to determine location from the request's `X-Search-ClientIP` or `X-Search-Location` headers. If neither header is specified, The API will determine location from either the client IP of the request, or GPS coordinates for mobile devices.
-
-## localCircularView
-
-The `localCircularView` parameter creates a circular geographic area around a set of latitude/longitude coordinates, defined by a radius. When using this parameter, responses from the Bing Local Business Search API will only include locations within this circle, unlike the `localMapView` parameter which may include locations slightly outside the search area.
-
-To specify a circular geographic search area, pick a latitude and longitude to serve as the center of the circle, and a radius in meters. This parameter can then be appended to a query string, for example: `q=Restaurants&localCircularView=47.6421,-122.13715,5000`.
-
-Complete query:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search?q=restaurant&localCircularView=47.6421,-122.13715,5000&appid=0123456789ABCDEF&mkt=en-us&form=monitr
-```
-
-## localMapView
-
-The `localMapView` parameter specifies a rectangular geographic area to search, using two sets of coordinates to specify its southeast and northwest corners. When using this parameter, responses from the Bing Local Business Search API may include locations within and just outside the specified area, unlike the `localCircularView` parameter, which only includes locations within the search area.
-
-To specify a rectangular search area, pick two sets of latitude/longitude coordinates to serve as the southeast and northwest corners of the boundary. Be sure to define the southeast coordinates first, as in the following example: `localMapView=47.619987,-122.181671,47.6421,-122.13715`.
-
-Complete query:
-
-```
-https://api.cognitive.microsoft.com/bing/v7.0/localbusinesses/search?q=restaurant&localMapView=47.619987,-122.181671,47.6421,-122.13715&appid=0123456789ABCDEF&mkt=en-us&form=monitr
-```
-
-## Next steps
-- [Local Business Search Java Quickstart](quickstarts/local-search-java-quickstart.md)-- [Local Business Search C# Quickstart](quickstarts/local-quickstart.md)-- [Local Business Search Node Quickstart](quickstarts/local-search-node-quickstart.md)-- [Local Business Search Python quickstart](quickstarts/local-search-python-quickstart.md)
cognitive-services Bing Insights Usage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/bing-insights-usage.md
- Title: Examples of Bing insights - Bing Visual Search-
-description: This article contains examples of how Bing Visual Search might use and display image insights on Bing.com.
------- Previously updated : 04/03/2019---
-# Examples of Bing insights usage
--
-This article contains examples of how Bing might use and display image insights on Bing.com.
-
-## PagesIncluding insight example
-
-The following displays a link to the first webpage and lets the user expand and collapse the list of other webpages that include the image:
-
-![Expanded pages including](./media/pages-including.PNG)
-
-## ShoppingSources insight example
-
-The following shows how Bing might display shopping sources for products seen in the image:
-
-![Shopping sources](./media/shopping-sources.PNG)
-
-## VisualSearch insight example
-
-The following shows how Bing might display visually similar images (see **Related images** in the example):
-
-![Visually similar images](./media/similar-images.PNG)
-
-## Recipes insight example
-
-The following shows how Bing might display recipes for the food shown in the image. The example lets the user know there are recipes available:
-
-![Recipes and pages including](./media/recipes-pages-including.PNG)
-
- And provides the link to the recipes when the user expands the list:
-
-![Expanded recipe pages including](./media/expanded-recipes-pages-including.PNG)
-
-## RelatedSearches insight example
-
-The following shows how Bing might display related searches of images made by others. If the user clicks the image, the user is taken to the Bing.com/images search results page for that related query.
-
-![Related searches for images](./media/bordered-related-searches.PNG)
-
-## Entity insight example
-
-The following shows how Bing might display information about the entity (person, place, or thing) shown in the image. If the user clicks the entity link, the user is taken to the Bing.com search results page for the entity:
-
-![Entity shown in image](./media/entity.PNG)
-
-## Displaying other insights that the user might explore
-
-The following shows how Bing might display other information about the image that the user can explore.
-
-![Explore other insights about the image](./media/apple-pie-more-tags.PNG)
-
-## Bounding boxes and hot spots
-
-Non-default tags include the bounding box that identifies the area of interest in the image that the tag applies to. If the bounding box does not identify the entire image, use the bounding box to create a hot spot on the image. The user can click the hot spot to get information related to the content found under the hot spot (or rectangle). For example, if the image is a high-fashion image, the results may contain tags (and bounding boxes) for accessories shown in the image, such as a purse, jewelry, scarfs, and so on. The following example shows a hot-spot rectangle for the sunglasses shown in the image:
-
-![Bounding box and hot spot](./media/click-to-search.PNG)
-
-## Next steps
-
-To get started with your first request, see the quickstarts:
-
-* [C#](quickstarts/csharp.md)
-
-* [Java](quickstarts/java.md)
-
-* [Node.js](quickstarts/nodejs.md)
-
-* [Python](quickstarts/python.md)
cognitive-services Sending Queries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/concepts/sending-queries.md
- Title: "Sending search queries to the Bing Visual Search API"-
-description: This article describes the parameters and attributes of requests sent to the Bing Visual Search API, as well as the response object.
------- Previously updated : 01/08/2019---
-# Sending search queries to the Bing Visual Search API
--
-This article describes the parameters and attributes of requests sent to the Bing Visual Search API, as well as the response object.
-
-You can get insights about an image in three ways:
--- Using an insights token that you get from an image in a previous call to one of the [Bing Image Search API](/rest/api/cognitiveservices/bing-images-api-v7-reference) endpoints.-- Sending the URL of an image.-- Uploading an image (in binary format).-
-## Bing Visual Search requests
-
-If you send Visual Search an image token or URL, the following snippet shows the JSON object that you must include in the body of the POST:
-
-```json
-{
- "imageInfo" : {
- "url" : "",
- "imageInsightsToken" : "",
- "cropArea" : {
- "top" : 0.1,
- "left" : 0.5,
- "right" : 0.9,
- "bottom" : 0.9
- }
- },
- "knowledgeRequest" : {
- "filters" : {
- "site" : ""
- }
- }
-}
-```
-
-The `imageInfo` object must include either the `url` or `imageInsightsToken` field but not both. Set the `url` field to the URL of an Internet-accessible image. The maximum supported image size is 1 MB.
-
-The `imageInsightsToken` must be set to an insights token. To get an insights token, call the Bing Image API. The response contains a list of `Image` objects. Each `Image` object contains an `imageInsightsToken` field, which contains the token.
-
-The `cropArea` field is optional. The crop area specifies the top-left corner and bottom-right corner of a region of interest. Specify the values in the range 0.0 through 1.0. The values are a percentage of the overall width or height. For example, the above example marks the right half of the image as the region of interest. Include it if you want to limit the insights request to the region of interest.
-
-The `filters` object contains a site filter (see the `site` field) that you can use to restrict the similar images and similar products results to a specific domain. For example, if the image is of a Surface Book, you can set `site` to `www.microsoft.com`.
-
-If you want to get insights about a local copy of an image, upload the image as binary data.
-
-For details about including these options in the body of the POST, see [Content form types](#content-form-types).
-
-### Search endpoint
-
-The Visual Search endpoint is: https:\/\/api.cognitive.microsoft.com/bing/v7.0/images/visualsearch.
-
-Requests must be sent as HTTP POST requests only.
-
-### Query parameters
-
-The following are the query parameters your request should specify. At a minimum, you should include the `mkt` query parameter:
-
-| Name | Value | Type | Required |
-| | | | |
-| <a name="cc"></a>cc | A two-character country code that represents where the results come from.<br /><br /> If you set this parameter, you must also specify the [Accept-Language](#acceptlanguage) header. Bing uses the first supported language it finds from the list of languages, and combines the language with the country code that you specify to determine the market to return results from. If the languages list does not include a supported language, Bing finds the closest language and market that supports the request. Or it may use an aggregated or default market for the results instead of the specified one.<br /><br /> You should use this query parameter and the `Accept-Language` query parameter only if you specify multiple languages; otherwise, you should use the `mkt` and `setLang` query parameters.<br /><br /> This parameter and the [mkt](#mkt) query parameter are mutually exclusive&mdash;do not specify both. | String | No |
-| <a name="mkt"></a>mkt | The market where the results come from. <br /><br /> **NOTE:** You should always specify the market, if known. Specifying the market helps Bing route the request and return an appropriate and optimal response.<br /><br /> This parameter and the [cc](#cc) query parameter are mutually exclusive&mdash;do not specify both. | String | Yes |
-| <a name="safesearch"></a>safeSearch | A filter for adult content. The following are the possible case-insensitive filter values.<br /><ul><li>Off&mdash;Return webpages with adult text or images.<br /><br/></li><li>Moderate&mdash;Return webpages with adult text, but not adult images.<br /><br/></li><li>Strict&mdash;Do not return webpages with adult text or images.</li></ul><br /> The default is Moderate.<br /><br /> **NOTE:** If the request comes from a market that Bing's adult policy requires that `safeSearch` be set to Strict, Bing ignores the `safeSearch` value and uses Strict.<br/><br/>**NOTE:** If you use the `site:` query operator, there is a chance that the response may contain adult content regardless of what the `safeSearch` query parameter is set to. Use `site:` only if you are aware of the content on the site and your scenario supports the possibility of adult content. | String | No |
-| <a name="setlang"></a>setLang | The language to use for user interface strings. Specify the language using the ISO 639-1 two-letter language code. For example, the language code for English is EN. The default is EN (English).<br /><br /> Although optional, you should always specify the language. Typically, you set `setLang` to the same language specified by `mkt` unless the user wants the user interface strings displayed in a different language.<br /><br /> This parameter and the [Accept-Language](#acceptlanguage) header are mutually exclusive&mdash;do not specify both.<br /><br /> A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects apply the specified language. | String | No |
-
-## Headers
-
-The following are the headers that your request should specify. The `Content-Type` and `Ocp-Apim-Subscription-Key` headers are the only required headers, but you should also include `User-Agent`, `X-MSEdge-ClientID`, `X-MSEdge-ClientIP`, and `X-Search-Location`.
-
-| Header | Description |
-| | |
-| <a name="acceptlanguage"></a>Accept-Language | Optional request header.<br /><br /> A comma-delimited list of languages to use for user interface strings. The list is in decreasing order of preference. For more information, including expected format, see [RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).<br /><br /> This header and the [setLang](#setlang) query parameter are mutually exclusive&mdash;do not specify both.<br /><br /> If you set this header, you must also specify the [cc](#cc) query parameter. To determine the market to return results for, Bing uses the first supported language it finds from the list and combines it with the `cc` parameter value. If the list does not include a supported language, Bing finds the closest language and market that supports the request or it uses an aggregated or default market for the results. To determine the market that Bing used, see the `BingAPIs-Market` header.<br /><br /> Use this header and the `cc` query parameter only if you specify multiple languages. Otherwise, use the [mkt](#mkt) and [setLang](#setlang) query parameters.<br /><br /> A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Any links to Bing.com properties in the response objects apply the specified language. |
-| <a name="contenttype"></a>Content-Type | |
-| <a name="market"></a>BingAPIs-Market | Response header.<br /><br /> The market used by the request. The form is \<languageCode\>-\<countryCode\>. For example, en-US. |
-| <a name="traceid"></a>BingAPIs-TraceId | Response header.<br /><br /> The ID of the log entry that contains the details of the request. When an error occurs, capture this ID. If you are not able to determine and resolve the issue, include this ID along with the other information that you provide the Support team. |
-| <a name="subscriptionkey"></a>Ocp-Apim-Subscription-Key | Required request header.<br /><br /> The subscription key that you received when you signed up for this service in [Azure AI services](https://www.microsoft.com/cognitive-services/). |
-| <a name="pragma"></a>Pragma | |
-| <a name="useragent"></a>User-Agent | Optional request header.<br /><br /> The user agent originating the request. Bing uses the user agent to provide mobile users with an optimized experience. Although optional, you are encouraged to always specify this header.<br /><br /> The user-agent should be the same string that any commonly used browser sends. For information about user-agents, see [RFC 2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).<br /><br /> The following are examples of user-agent strings.<br /><ul><li>Windows Phone&mdash;Mozillash;Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53</li></ul> |
-| <a name="clientid"></a>X-MSEdge-ClientID | Optional request and response header.<br /><br /> Bing uses this header to provide users with consistent behavior across Bing API calls. Bing often flights new features and improvements, and it uses the client ID as a key for assigning traffic on different flights. If you do not use the same client ID for a user across multiple requests, then Bing may assign the user to multiple conflicting flights. Being assigned to multiple conflicting flights can lead to an inconsistent user experience. For example, if the second request has a different flight assignment than the first, the experience may be unexpected. Also, Bing can use the client ID to tailor web results to that client IDΓÇÖs search history, providing a richer experience for the user.<br /><br /> Bing also uses this header to help improve result rankings by analyzing the activity generated by a client ID. The relevance improvements help with better quality of results delivered by Bing APIs and in turn enables higher click-through rates for the API consumer.<br /><br /> **IMPORTANT:** Although optional, you should consider this header required. Persisting the client ID across multiple requests for the same end user and device combination enables 1) the API consumer to receive a consistent user experience, and 2) higher click-through rates via better quality of results from the Bing APIs.<br /><br /> The following are the basic usage rules that apply to this header.<br /><ul><li>Each user that uses your application on the device must have a unique, Bing generated client ID.<br /><br/>If you do not include this header in the request, Bing generates an ID and returns it in the X-MSEdge-ClientID response header. The only time that you should NOT include this header in a request is the first time the user uses your app on that device.<br /><br/></li><li>**ATTENTION:** You must ensure that this Client ID is not linkable to any authenticated user account information.</li><li>Use the client ID for each Bing API request that your app makes for this user on the device.<br /><br/></li><li>Persist the client ID. To persist the ID in a browser app, use a persistent HTTP cookie to ensure the ID is used across all sessions. Do not use a session cookie. For other apps such as mobile apps, use the device's persistent storage to persist the ID.<br /><br/>The next time the user uses your app on that device, get the client ID that you persisted.</li></ul><br /> **NOTE:** Bing responses may or may not include this header. If the response includes this header, capture the client ID and use it for all subsequent Bing requests for the user on that device.<br /><br /> **NOTE:** If you include the X-MSEdge-ClientID, you must not include cookies in the request. |
-| <a name="clientip"></a>X-MSEdge-ClientIP | Optional request header.<br /><br /> The IPv4 or IPv6 address of the client device. The IP address is used to discover the user's location. Bing uses the location information to determine safe search behavior.<br /><br /> **NOTE:** Although optional, you are encouraged to always specify this header and the X-Search-Location header.<br /><br /> Do not obfuscate the address (for example, by changing the last octet to 0). Obfuscating the address results in the location not being anywhere near the device's actual location, which may result in Bing serving erroneous results. |
-| <a name="location"></a>X-Search-Location | Optional request header.<br /><br /> A semicolon-delimited list of key/value pairs that describe the client's geographical location. Bing uses the location information to determine safe search behavior and to return relevant local content. Specify the key/value pair as \<key\>:\<value\>. The following are the keys that you use to specify the user's location.<br /><br /><ul><li>lat&mdash;Required. The latitude of the client's location, in degrees. The latitude must be greater than or equal to -90.0 and less than or equal to +90.0. Negative values indicate southern latitudes and positive values indicate northern latitudes.<br /><br /></li><li>long&mdash;Required. The longitude of the client's location, in degrees. The longitude must be greater than or equal to -180.0 and less than or equal to +180.0. Negative values indicate western longitudes and positive values indicate eastern longitudes.<br /><br /></li><li>re&mdash;Required. The radius, in meters, which specifies the horizontal accuracy of the coordinates. Pass the value returned by the device's location service. Typical values might be 22 m for GPS/Wi-Fi, 380 m for cell tower triangulation, and 18,000 m for reverse IP lookup.<br /><br /></li><li>ts&mdash;Optional. The UTC UNIX timestamp of when the client was at the location. (The UNIX timestamp is the number of seconds since January 1, 1970.)<br /><br /></li><li>head&mdash;Optional. The client's relative heading or direction of travel. Specify the direction of travel as degrees from 0 through 360, counting clockwise relative to true north. Specify this key only if the `sp` key is nonzero.<br /><br /></li><li>sp&mdash;Optional. The horizontal velocity (speed), in meters per second, that the client device is traveling.<br /><br /></li><li>alt&mdash;Optional. The altitude of the client device, in meters.<br /><br /></li><li>are&mdash;Optional. The radius, in meters, that specifies the vertical accuracy of the coordinates. Specify this key only if you specify the `alt` key.<br /><br /></li></ul> **NOTE:** Although many of the keys are optional, the more information that you provide, the more accurate the location results are.<br /><br /> **NOTE:** Although optional, you are encouraged to always specify the user's geographical location. Providing the location is especially important if the client's IP address does not accurately reflect the user's physical location (for example, if the client uses VPN). For optimal results, you should include this header and the `X-MSEdge-ClientIP` header, but at a minimum, you should include this header. |
-
-> [!NOTE]
-> Remember that the [Bing Search API use and display requirements](../../bing-web-search/use-display-requirements.md) require compliance with all applicable laws, including regarding use of these headers. For example, in certain jurisdictions, such as Europe, there are requirements to obtain user consent before placing certain tracking devices on user devices.
-
-<a name="content-form-types"></a>
-
-### Content form types
-
-Each request must include the `Content-Type` header. The header must be set to: `multipart/form-data; boundary=\<boundary string\>`, where \<boundary string\> is a unique, opaque string that identifies the boundary of the form data. For example, `boundary=boundary_1234-abcd`.
-
-If you send Visual Search an image token or URL, the following snippet shows the form data you must include in the body of the POST. The form data must include the `Content-Disposition` header and you must set its `name` parameter to "knowledgeRequest". For details about the `imageInfo` object, see the request.
-
-```
boundary_1234-abcd
-Content-Disposition: form-data; name="knowledgeRequest"
-
-{
- "imageInfo" : {
- "url" : "https://contoso.com/2018/05/fashion/red.jpg"
- }
-}
-boundary_1234-abcd--
-```
-
-You can optionally set the `enableEntityData` attribute in the header to `true` for detailed information on the main entity in the image you upload, including links to the web and attribution information. This field is `false` by default.
-
-```
boundary_1234-abcd
-Content-Disposition: form-data; name="knowledgeRequest"
-
-{
- "imageInfo" : {
- "url" : "https://contoso.com/2018/05/fashion/red.jpg"
- },
- "knowledgeRequest" : {
- "invokedSkillsRequestData" : {
- "enableEntityData" : "true"
- }
- }
-}
-boundary_1234-abcd--
-```
-
-If you upload a local image, the following snippet shows the form data you must include in the body of the POST. The form data must include the `Content-Disposition` header. Its `name` parameter must be set to "image" and the `filename` parameter may be set to any string. The `Content-Type` header may be set to any commonly used image mime type. The contents of the form is the binary data of the image. The maximum image size you may upload is 1 MB. The largest of the width or height should be 1,500 pixels or less.
-
-```
boundary_1234-abcd
-Content-Disposition: form-data; name="image"; filename="myimagefile.jpg"
-Content-Type: image/jpeg
-
-ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-boundary_1234-abcd--
-```
-
-The following snippet shows how to specify the region of interest of an uploaded image:
-
-```
boundary_1234-abcd
-Content-Disposition: form-data; name="knowledgeRequest"
-
-{
- "imageInfo" : {
- "cropArea" : {
- "top" : 0.2,
- "left" : 0.3,
- "bottom" : 0.7,
- "right" : 0.6
- }
- }
-}
-boundary_1234-abcd
-Content-Disposition: form-data; name="image"; filename="image"
-Content-Type: image/jpeg
--
-ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-boundary_1234-abcd--
-```
-
-### Example request
-
-The following snippet shows a complete image insights request that passes an image token and region of interest. You get the insights token from a previous call to /images/search:
-
-```
-POST https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch?mkt=en-us HTTP/1.1
-Content-Type: multipart/form-data; boundary=boundary_1234-abcd
-Ocp-Apim-Subscription-Key: 123456789ABCDE
-X-MSEdge-ClientIP: 999.999.999.999
-X-Search-Location: lat:47.60357;long:-122.3295;re:100
-X-MSEdge-ClientID: <blobFromPriorResponseGoesHere>
-Host: api.cognitive.microsoft.com
-boundary_1234-abcd
-Content-Disposition: form-data; name="knowledgeRequest"
-
-{
- "imageInfo" : {
- "imageInsightsToken" : "mid_D6426898706EC7..."
- "cropArea" : {
- "top" : 0.1,
- "left" : 0.2,
- "bottom" : 0.7,
- "right" : 0.5
- }
- }
-}
-boundary_1234-abcd--
-```
-
-## Bing Visual Search responses
---
-If there are insights available for the image, the response contains one or more `tags` that contain the insights. The `image` field contains the insights token for the input image:
-
-```json
-{
- "_type" : "ImageKnowledge",
- "tags" : [
- {...},
- {...},
- {...},
- {...},
- {...}
- ],
- "image" : {
- "imageInsightsToken" : "bcid_AF8C9CA409421B..."
- }
-}
-```
-
-The `tags` field contains a display name and list of actions (insights). One of the tags contains a `displayName` field that is set to an empty string. This tag contains the default insights such as webpages that include the image, visually similar images, and shopping sources for items found in the image. Because the entire image is of interest, the default insights tag doesn't include bounding boxes for the regions of interest:
-
-```json
-{
- "_type" : "ImageKnowledge",
- "tags" : [
- {
- "displayName" : "",
- "actions" : [
- {...},
- {...},
- {...},
- {...}
- ]
- },
- {...},
- {...},
- {...},
- {...}
- ],
- "image" : {
- "imageInsightsToken" : "bcid_AF8C9CA409421B..."
- }
-}
-```
-
-For a list of the default insights, see [Default insights tag](../default-insights-tag.md).
-
-The remaining tags contain other insights that may be of interest to the user. For example, if the image contains text, one of the tags may include a TextResults insight, which contains the recognized text. Or, if Bing recognizes an entity (that is, a culturally well-known/popular person, place, or thing) in the image, one of the tags may identify the entity. Visual Search also returns a diverse set of terms (tags) derived from the input image. These tags enable users to explore concepts found in the image. For example, if the input image is of a famous athlete, one of the tags might be Sports, which contains links to images of sports.
-
-Each tag includes a display name that you can use to categorize the insight, bounding box that identifies the region of interest that the insight applies to, the insights themselves, and a thumbnail of the image. For example, if the image is of a person wearing a sports jersey, one of the tags might include a bounding box that bounds the jersey and includes VisualSearch and ProductVisualSearch insights. And another tag might include an ImageResults insight that contains a URL for an /images/search API request to get images that are topically related or a Bing.com search URL that takes the user to the Bing.com image search results.
-
-All tags other than the default insights tag include bounding boxes that identify regions of interest in the image. For example, if the image includes multiple recognized people, tags could include bounding boxes for each of the people, or if the image contains recognized clothing items, tags could include bounding boxes for each recognized clothing item. You can use the bounding boxes to create hot spots over the image that when clicked, provide details about the contents in that region of the image. You should not include hot spots in an image for bounding boxes that identify the entire image.
-
-### Text recognition
-
-If the image contains text that the service recognizes, one of the tags will contain a TextResults insight (action). The insight's `displayName` contains the recognized text:
-
-```json
- {
- "image" : {
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?q=%23%23Text..."
- },
- "displayName" : "##TextRecognition",
- "boundingBox" : {
- "queryRectangle" : {
- "topLeft" : {"x" : 0, "y" : 0},
- "topRight" : {"x" : 1, "y" : 0},
- "bottomRight" : {"x" : 1, "y" : 1},
- "bottomLeft" : {"x" : 0, "y" : 1}
- },
- "displayRectangle" : {
- "topLeft" : {"x" : 0, "y" : 0},
- "topRight" : {"x" : 1, "y" : 0},
- "bottomRight" : {"x" : 1, "y" : 1},
- "bottomLeft" : {"x" : 0, "y" : 1}
- }
- },
- "actions" : [{
- "displayName" : "WALK BIKE ACROSS BRIDGE",
- "actionType" : "TextResults"
- }],
- "sources" : ["OCR"]
- }
-```
-
-Because the tag's `displayName` field contains ##TextRecognition, do not use it as a category title in the UX. That goes for any display name that starts with ##. Instead, use the action's display name.
-
-Text recognition can also recognize the contact information on business cards, such as phone numbers and email addresses. The bounding box identifies the location of the contact information on the card.
-
-```json
- {
- "image" : {
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?q=%23%23TextRecognition..."
- },
- "displayName" : "##TextRecognition",
- "boundingBox" : {
- "queryRectangle" : {
- "topLeft" : {"x" : 0.635, "y" : 0},
- "topRight" : {"x" : 0.77, "y" : 0},
- "bottomRight" : {"x" : 0.77, "y" : 0.4873333},
- "bottomLeft" : {"x" : 0.635, "y" : 0.4873333}
- },
- "displayRectangle" : {
- "topLeft" : {"x" : 0.635, "y" : 0},
- "topRight" : {"x" : 0.77, "y" : 0},
- "bottomRight" : {"x" : 0.77, "y" : 0.4873333},
- "bottomLeft" : {"x" : 0.635, "y" : 0.4873333}
- }
- },
- "actions" : [
- {
- "url" : "tel:888%20555%201212",
- "actionType" : "Uri"
- }
- ],
- "sources" : ["OCR"]
- },
- {
- "image" : {
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?q=%23%23TextRecognition..."
- },
- "displayName" : "##TextRecognition",
- "boundingBox" : {
- "queryRectangle" : {
- "topLeft" : {"x" : 0.63, "y" : 0},
- "topRight" : {"x" : 0.866, "y" : 0},
- "bottomRight" : {"x" : 0.866, "y" : 0.5553334},
- "bottomLeft" : {"x" : 0.63, "y" : 0.5553334}
- },
- "displayRectangle" : {
- "topLeft" : {"x" : 0.63, "y" : 0},
- "topRight" : {"x" : 0.866, "y" : 0},
- "bottomRight" : {"x" : 0.866, "y" : 0.5553334},
- "bottomLeft" : {"x" : 0.63, "y" : 0.5553334}
- }
- },
- "actions" : [
- {
- "url" : "mailto:someone@outlook.com",
- "actionType" : "Uri"
- }
- ],
- "sources" : ["OCR"]
- },
- {
- "image" : {
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?q=%23%23TextRecognition..."
- },
- "displayName" : "##TextRecognition",
- "boundingBox" : {
- "queryRectangle" : {
- "topLeft" : {"x" : 0, "y" : 0},
- "topRight" : {"x" : 1, "y" : 0},
- "bottomRight" : {"x" : 1, "y" : 1},
- "bottomLeft" : {"x" : 0, "y" : 1}
- },
- "displayRectangle" : {
- "topLeft" : {"x" : 0, "y" : 0},
- "topRight" : {"x" : 1, "y" : 0},
- "bottomRight" : {"x" : 1, "y" : 1},
- "bottomLeft" : {"x" : 0, "y" : 1}
- }
- },
- "actions" : [
- {
- "displayName" : "CHARLENE WHITNEY Graphic Designer 888 555 1212 someone@outlook.com www.contoso.com",
- "actionType" : "TextResults"
- }
- ],
- "sources" : ["OCR"]
- }
-```
-
-If the image contains a recognized entity such as a culturally well-known/popular person, place, or thing, one of the tags may include an Entity insight. The `mainEntity` and `data` fields are only available if the `enableEntityData` attribute in the `Content-Type` header is set to `true`.
-
-```json
-{
- "image" : {
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?q=Statue+of+Liberty..."
- },
- "displayName" : "Statue of Liberty",
- "boundingBox" : {
- "queryRectangle" : {
- "topLeft" : {"x" : 0.40625, "y" : 0.1757813},
- "topRight" : {"x" : 0.6171875, "y" : 0.1757813},
- "bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
- "bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
- },
- "displayRectangle" : {
- "topLeft" : {"x" : 0.40625, "y" : 0.1757813},
- "topRight" : {"x" : 0.6171875, "y" : 0.1757813},
- "bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
- "bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
- }
- },
- "actions" : [
- {
- "_type" : "ImageEntityAction",
- "webSearchUrl" : "https:\/\/www.bing.com\/search?q=Statue+of+Liberty",
- "displayName" : "Statue of Liberty",
- "actionType" : "Entity",
- "mainEntity" : {
- "name" = "Statue of liberty",
- "bingId" : "..."
- },
- "data" : {
- "id" : "https://api.cognitive.microsoft.com/api/v7/entities/...",
- "readLink": "https://www.bingapis.com/api/v7/search?q=...",
- "readLinkPingSuffix": "...",
- "contractualRules": [
- {
- "_type": "ContractualRules/LicenseAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "license": {
- "name": "CC-BY-SA",
- "url": "http://creativecommons.org/licenses/by-sa/3.0/",
- "urlPingSuffix": "..."
- },
- "licenseNotice": "Text under CC-BY-SA license"
- },
- {
- "_type": "ContractualRules/LinkAttribution",
- "targetPropertyName": "description",
- "mustBeCloseToContent": true,
- "text": "Wikipedia",
- "url": "http://en.wikipedia.org/wiki/...",
- "urlPingSuffix": "..."
- }
- ],
- "webSearchUrl": "https://www.bing.com/entityexplore?q=...",
- "webSearchUrlPingSuffix": "...",
- "name": "Statue of Liberty",
- "image": {
- "thumbnailUrl": "https://tse1.mm.bing.net/th?id=...",
- "hostPageUrl": "http://upload.wikimedia.org/wikipedia/...",
- "hostPageUrlPingSuffix": "...",
- "width": 50,
- "height": 50,
- "sourceWidth": 474,
- "sourceHeight": 598
- },
- "description" : "...",
- "bingId": "..."
- }
- }
- ]
-}
-```
-
-## See also
--- [What is the Bing Visual Search API?](../overview.md)-- [Tutorial: Create a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Default Insights Tag https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/default-insights-tag.md
- Title: Default insights tag - Bing Visual Search-
-description: Provides details about the default insights that Bing Visual Search returns about an image.
------- Previously updated : 04/04/2019---
-# Default insights tag
--
-The default insights tag is the one with the `displayName` field set to an empty string. The following example shows the possible list of default insights (actions). The list of actions the response includes depends on the image. And for each action, the list of properties may vary by image, so check if the property exists before trying to use it.
-
-```json
-{
- "_type" : "ImageKnowledge",
- "tags" : [
- {
- "displayName" : "",
- "actions" : [
- {
- "_type" : "ImageModuleAction",
- "actionType" : "PagesIncluding",
- "data" : {
- "value" : [...]
- }
- },
- {
- "_type" : "ImageShoppingSourcesAction",
- "actionType" : "ShoppingSources",
- "data" : {
- "offers" : [...]
- }
- },
- {
- "image" : {...},
- "actionType" : "MoreSizes"
- },
- {
- "_type" : "ImageModuleAction",
- "actionType" : "VisualSearch",
- "data" : {
- "value" : [...]
- }
- },
- {
- "_type" : "ImageRecipesAction",
- "actionType" : "Recipes",
- "data" : {
- "value" : [...]
- }
- },
- {
- "image" : {...},
- "actionType" : "ImageById"
- },
- {
- "_type" : "ImageModuleAction",
- "actionType" : "ProductVisualSearch",
- "data" : {
- "value" : [...]
- }
- },
- {
- "_type" : "ImageRelatedSearchesAction",
- "actionType" : "RelatedSearches",
- "data" : {
- "value" : [...]
- }
- },
- {
- "_type" : "ImageRelatedSearchesAction",
- "actionType" : "DocumentLevelSuggestions",
- "data" : {
- "value" : [...]
- }
- }
- ]
- },
- {...},
- {...},
- {...},
- {...}
- ],
- "image" : {
- "imageInsightsToken" : "bcid_AF8C9CA409421B..."
- }
-}
-```
-
-## PagesIncluding insight
-
-The PagesIncluding insight provides a list of webpages that include this image. It's actually a list of `Image` objects, and the `hostPageUrl` field contains the URL to the webpage that includes the image. For example usage, see [PagesIncluding insight example](./bing-insights-usage.md#pagesincluding-insight-example).
-
-```json
-{
- "_type" : "ImageModuleAction",
- "actionType" : "PagesIncluding",
- "data" : {
- "value" : [
- {
- "webSearchUrl" : "https://www.bing.com\/images\/search?",
- "name" : "Today's smoking hot country",
- "thumbnailUrl" : "https:\/\/tse2.mm.bing.net\/th?id=OIP...",
- "datePublished" : "2017-09-20T12:00:00.0000000Z",
- "contentUrl" : "http:\/\/contoso.com\/wordstuff",
- "hostPageUrl" : "http:\/\/contoso.com\/2017\/09\/20\/car",
- "contentSize" : "122540 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "contoso.com\/2017\/09\/20\/car",
- "width" : 894,
- "height" : 1200,
- "thumbnail" : {
- "width" : 474,
- "height" : 636
- },
- "imageInsightsToken" : "ccid_CO5GEthj*mid_5323B1",
- "insightsMetadata" : {
- "pagesIncludingCount" : 12,
- "availableSizesCount" : 7
- },
- "imageId" : "5323B1900FB9087B6B45D176D234E1F2F23CD3A5",
- "accentColor" : "55585B"
- }
- ]
- }
-}
-```
-
-## ShoppingSources insight
-
-The ShoppingSources insight provides a list of websites where the user can buy the item shown in the image. The list of offers includes the URL of the webpage where the user can buy the item, the price of the item, and rating or review details. For example usage, see [ShoppingSources example](./bing-insights-usage.md#shoppingsources-insight-example).
-
-```json
-{
- "_type" : "ImageShoppingSourcesAction",
- "actionType" : "ShoppingSources",
- "data" : {
- "offers" : [
- {
- "name" : "Apple Pie",
- "url" : "https:\/\/contoso.com\/product_p\/l10.htm",
- "description" : "A taste of the crust, apple, and pie filling...",
- "seller" : {
- "name" : "Contoso"
- },
- "price" : 3.99,
- "priceCurrency" : "USD",
- "aggregateRating" : {
- "ratingValue" : 5
- },
- "lastUpdated" : "2018-04-16T00:00:00.0000000"
- }
- ]
- }
-}
-```
-
-## MoreSizes insight
-
-The MoreSizes insight identifies the number of sizes (larger or smaller) of the image that Bing found on the Internet (see the `availableSizesCount` field):
-
-```json
-{
- "image" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=detai...",
- "name" : "Making Apple Pie",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OIP....",
- "datePublished" : "2013-06-21T12:00:00.0000000Z",
- "contentUrl" : "http:\/\/contoso.com\/content\/uploads\/2013\/06\/apple-pie.jpg",
- "hostPageUrl" : "http:\/\/contoso.com\/2013\/06\/21\/making-apple-pie\/",
- "contentSize" : "134847 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "contoso.com\/2013\/06\/21\/making-apple-pie",
- "width" : 1050,
- "height" : 765,
- "thumbnail" : {
- "width" : 474,
- "height" : 345
- },
- "imageInsightsToken" : "ccid_tmaGQ2eU*mid_D12339146CF...",
- "insightsMetadata" : {
- "recipeSourcesCount" : 6,
- "pagesIncludingCount" : 103,
- "availableSizesCount" : 28
- },
- "imageId" : "D12339146CFEDF3D409CC7A66D2C98D0D71904D4",
- "accentColor" : "3A0B01"
- },
- "actionType" : "MoreSizes"
-},
-```
-
-## VisualSearch insight
-
-The VisualSearch insight provides a list of images that are visually similar to the original image (contains content that's similar to the content shown in the original image). For example usage, see [VisualSearch insight example](./bing-insights-usage.md#visualsearch-insight-example).
-
-```json
-{
- "_type" : "ImageModuleAction",
- "actionType" : "VisualSearch",
- "data" : {
- "value" : [
- {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=...",
- "name" : "An apple pie...",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OIP.z...",
- "datePublished" : "2017-03-18T00:17:00.0000000Z",
- "contentUrl" : "http:\/\/contoso.net\/images\/8\/8a\/an_apple_pie.png",
- "hostPageUrl" : "http:\/\/contoso.com\/wiki\/an_apple_pie.png",
- "contentSize" : "87930 B",
- "encodingFormat" : "png",
- "hostPageDisplayUrl" : "contoso.com\/wiki\/an_apple_pie.png",
- "width" : 263,
- "height" : 192,
- "thumbnail" : {
- "width" : 474,
- "height" : 346
- },
- "imageInsightsToken" : "ccid_zhRxfGkI*mid_1DCBA7AA6D231...",
- "insightsMetadata" : {
- "recipeSourcesCount" : 6,
- "pagesIncludingCount" : 103,
- "availableSizesCount" : 28
- },
- "imageId" : "1DCBA7AA6D23147F9DD06D47DB3A38EB25389",
- "accentColor" : "3E0D01"
- }
- ]
- }
-}
-```
-
-## Recipes insight
-
-The Recipes insight provides a list of webpages that include a recipe for making the food shown in the image. For example usage, see [Recipes insight example](./bing-insights-usage.md#recipes-insight-example).
-
-```json
-{
- "_type" : "ImageRecipesAction",
- "actionType" : "Recipes",
- "data" : {
- "value" : [
- {
- "name" : "Granny's Apple Pie",
- "url" : "http:\/\/contoso.com\/recipes\/appetizer\/apple-pie.html",
- "description" : "I love Granny's apple pie. Sooooo delicious...",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=A63002cd9",
- "creator" : {
- "_type" : "Person",
- "name" : "Charlene Whitney"
- },
- "aggregateRating" : {
- "text" : "5",
- "ratingValue" : 5,
- "bestRating" : 5,
- "reviewCount" : 1
- },
- "cookTime" : "PT45M",
- "prepTime" : "PT1H",
- "totalTime" : "PT1H45M"
- }
- ]
- }
-}
-```
--
-## ImageById insight
-
-The ImageById insight provides an `Image` object of the image that you requested insights for:
-
-```json
-{
- "image" : {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=deta...",
- "name" : "Making Apple Pie",
- "thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?id=OIP...",
- "datePublished" : "2013-06-21T12:00:00.0000000Z",
- "contentUrl" : "http:\/\/contoso.com\/content\/uploads\/2013\/06\/apple-pie.jpg",
- "hostPageUrl" : "http:\/\/contoso.com\/2013\/06\/21\/making-apple-pie\/",
- "contentSize" : "134847 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "contoso.com\/2013\/06\/21\/making-apple-pie",
- "width" : 1050,
- "height" : 765,
- "thumbnail" : {
- "width" : 474,
- "height" : 345
- },
- "imageInsightsToken" : "ccid_tmaGQ2eU*mid_D12339146CFE...",
- "insightsMetadata" : {
- "recipeSourcesCount" : 6,
- "pagesIncludingCount" : 103,
- "availableSizesCount" : 28
- },
- "imageId" : "D12339146CFEDF3D409A66D2C98D0D71904D4",
- "accentColor" : "3A0B01"
- },
- "actionType" : "ImageById"
-},
-```
-
-## ProductVisualSearch insight
-
-The ProductVisualSearch insight provides a list of images of products that are visually similar to products shown in the original image. The `insightsMetadata` field may contain information about offers where you can buy the product and the price of the product.
-
-```json
-{
- "_type" : "ImageModuleAction",
- "actionType" : "ProductVisualSearch",
- "data" : {
- "value" : [
- {
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?view=detail...",
- "name" : "Contoso 4-Piece Kitchen Package...",
- "thumbnailUrl" : "https:\/\/tse3.mm.bing.net\/th?id=OIP.l9hzaabu-RJd...",
- "datePublished" : "2017-07-16T04:28:00.0000000Z",
- "contentUrl" : "https:\/\/www.contoso.com\/assets\/media\/images\/prod...",
- "hostPageUrl" : "https:\/\/www.contoso.com\/4-piece-kitchen-package...",
- "contentSize" : "13594 B",
- "encodingFormat" : "jpeg",
- "hostPageDisplayUrl" : "https:\/\/www.contoso.com\/4-piece-kitchen-package...",
- "width" : 450,
- "height" : 332,
- "thumbnail" : {
- "width" : 474,
- "height" : 349
- },
- "imageInsightsToken" : "ccid_l9hzaabu*mid_70A8B616355D681DB9A5A...",
- "insightsMetadata" : {
- "shoppingSourcesCount" : 1,
- "recipeSourcesCount" : 0,
- "aggregateOffer" : {
- "name":"4-Piece Kitchen Package with...",
- "priceCurrency":"USD",
- "lowPrice":2756,
- "offers" : [
- {
- "name" : "4-Piece Kitchen Package with...",
- "url" : "https:\/\/www.fabrikam.com\/1234.html?ref=bing",
- "description" : "This 36 Frenchdoor refrigerator by...",
- "seller" : {
- "name" : "Fabrikam",
- "image" : {
- "url" : "https:\/\/tse1.mm.bing.net\/th?id=A818f811..."
- }
- },
- "price" : 2756,
- "priceCurrency" : "USD",
- "availability" : "InStock",
- "lastUpdated" : "2018-02-20T00:00:00.0000000"
- }
- ],
- "offerCount":1
- },
- "pagesIncludingCount" : 4,
- "availableSizesCount" : 2
- },
- "imageId" : "70A8B616355D681DA5980A8D0514BCC995A3",
- "accentColor" : "60646B"
- }
- ]
- }
-}
-```
-
-## RelatedSearches insight
-
-The RelatedSearches insight provides a list of related searches made by others (based on other users' search terms). For example usage, see [RelatedSearches insight example](./bing-insights-usage.md#relatedsearches-insight-example).
-
-```json
-{
- "_type" : "ImageRelatedSearchesAction",
- "actionType" : "RelatedSearches",
- "data" : {
- "value" : [
- {
- "text" : "Homemade Apple Pies Recipes",
- "displayText" : "Homemade Apple Pies Recipes",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=Homemade...",
- "thumbnail" : {
- "url" : "https:\/\/tse1.mm.bing.net\/th?q=Homemade+Apple+Pies"
- }
- }
- ]
- }
-}
-```
-
-## DocumentLevelSuggestions insight
-
-The DocumentLevelSuggestions insight provides a list of suggested search terms based on the contents of the image:
-
-```json
-{
- "_type" : "ImageRelatedSearchesAction",
- "actionType" : "DocumentLevelSuggestions",
- "data" : {
- "value" : [
- {
- "text" : "American Apple Pie",
- "displayText" : "American Apple Pie",
- "webSearchUrl" : "https:\/\/www.bing.com\/images\/search?q=American",
- "thumbnail" : {
- "url" : "https:\/\/tse3.mm.bing.net\/th?q=American+Apple+Pie."
- }
- }
- ]
- }
-}
-```
-
-## Next steps
-
-Check out [Examples of Bing insights usage](bing-insights-usage.md) to see how Bing might display the visual insights.
-
-To get started quickly with your first request, see the quickstarts:
-
-* [C#](quickstarts/csharp.md)
-
-* [Java](quickstarts/java.md)
-
-* [Node.js](quickstarts/nodejs.md)
-
-* [Python](quickstarts/python.md).
cognitive-services Language Support https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/language-support.md
- Title: Language support - Bing Visual Search API-
-description: A list of natural languages, countries and regions that are supported by the Bing Visual Search API. The Bing Visual Search API supports more than three dozen countries/regions, many with more than one language.
------- Previously updated : 09/25/2018--
-# Language and region support for the Bing Visual Search API
--
-Bing Visual Search API supports more than three dozen countries/regions, many with more than one language. Each request should include the user's country/region and language of choice. Knowing the user's market helps Bing return appropriate results. If you don't specify a country/region and language, Bing makes a best effort to determine the user's country/region and language. Because the results may contain links to Bing, knowing the country/region and language may provide a preferred localized Bing user experience if the user clicks the Bing links.
-
-To specify the country/region and language, set the `mkt` (market) query parameter to a code from the **Markets** table below. The market specifies both a country/region and language. If the user prefers to see display text in a different language, set `setLang` query parameter to the appropriate language code.
-
-Alternatively, you can specify the country/region using the `cc` query parameter. If you specify a country/region, you must also specify one or more language codes using the `Accept-Language` HTTP header. The supported languages vary by country/region; they are given for each country/region in the Markets table.
---
-> [!NOTE]
-> The following market restrictions apply:
->
-> - Image recognition annotations are available in English only.
-> - Recipe, shopping, and pages-including insights are available in the en-US market only.
--
-## Countries/Regions
-
-|Country/region|Code|
-|-|-|
-|Argentina|AR|
-|Australia|AU|
-|Austria|AT|
-|Belgium|BE|
-|Brazil|BR|
-|Canada|CA|
-|Chile|CL|
-|Denmark|DK|
-|Finland|FI|
-|France|FR|
-|Germany|DE|
-|Hong Kong SAR|HK|
-|India|IN|
-|Indonesia|ID|
-|Italy|IT|
-|Japan|JP|
-|Korea|KR|
-|Malaysia|MY|
-|Mexico|MX|
-|Netherlands|NL|
-|New Zealand|NZ|
-|Norway|NO|
-|China|CN|
-|Poland|PL|
-|Portugal|PT|
-|Philippines|PH|
-|Russia|RU|
-|Saudi Arabia|SA|
-|South Africa|ZA|
-|Spain|ES|
-|Sweden|SE|
-|Switzerland|CH|
-|Taiwan|TW|
-|T├╝rkiye|TR|
-|United Kingdom|GB|
-|United States|US|
--
-## Markets
-
-|Country/region|Language|Market Code|
-|-|--|--|
-|Argentina|Spanish|es-AR|
-|Australia|English|en-AU|
-|Austria|German|de-AT|
-|Belgium|Dutch|nl-BE|
-|Belgium|French|fr-BE|
-|Brazil|Portuguese|pt-BR|
-|Canada|English|en-CA|
-|Canada|French|fr-CA|
-|Chile|Spanish|es-CL|
-|Denmark|Danish|da-DK|
-|Finland|Finnish|fi-FI|
-|France|French|fr-FR|
-|Germany|German|de-DE|
-|Hong Kong SAR|Traditional Chinese|zh-HK|
-|India|English|en-IN|
-|Indonesia|English|en-ID|
-|Italy|Italian|it-IT|
-|Japan|Japanese|ja-JP|
-|Korea|Korean|ko-KR|
-|Malaysia|English|en-MY|
-|Mexico|Spanish|es-MX|
-|Netherlands|Dutch|nl-NL|
-|New Zealand|English|en-NZ|
-|China|Chinese|zh-CN|
-|Poland|Polish|pl-PL|
-|Portugal|Portuguese|pt-PT|
-|Philippines|English|en-PH|
-|Russia|Russian|ru-RU|
-|Saudi Arabia|Arabic|ar-SA|
-|South Africa|English|en-ZA|
-|Spain|Spanish|es-ES|
-|Sweden|Swedish|sv-SE|
-|Switzerland|French|fr-CH|
-|Switzerland|German|de-CH|
-|Taiwan|Traditional Chinese|zh-TW|
-|T├╝rkiye|Turkish|tr-TR|
-|United Kingdom|English|en-GB|
-|United States|English|en-US|
-|United States|Spanish|es-US|
cognitive-services Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/overview.md
- Title: What is the Bing Visual Search API?-
-description: Bing Visual Search provides details or insights about an image such as similar images or shopping sources.
------- Previously updated : 01/24/2023---
-# What is the Bing Visual Search API?
--
-The Bing Visual Search API returns insights for an image. You can either upload an image or provide a URL to one. Insights are visually similar images, shopping sources, webpages that include the image, and more. Insights returned by the Bing Visual Search API are similar to ones shown on Bing.com/images.
-
-If you use the [Bing Image Search API](../bing-image-search/overview.md), you can use insight tokens from that API's search results for your Bing Visual Search instead of uploading an image.
-
-> [!IMPORTANT]
-> If you get image insights using the Bing Image Search API, consider switching to the Bing Visual Search API, which provides more comprehensive insights.
-
-## Insights
-
-You can discover the following insights by using Bing Visual Search:
-
-| Insight | Description |
-|--|-|
-| Visually similar images | A list of images that are visually similar to the input image. |
-| Shopping sources | Places where you can buy the item shown in the input image. |
-| Related searches | Related searches made by others or that are based on the contents of the image. |
-| Webpages that include the image | Webpages that include the input image. |
-| Recipes | Webpages that include recipes for making the dish shown in the input image. |
-| Entities | Well-known people, places, and things. |
-
-In addition to insights, Bing Visual Search returns a variety of terms (that is, tags) derived from the input image. The tags enable users to explore concepts found in the image. For example, if the input image is of a famous athlete, one of the tags may be the name of the athlete, another tag could be Sports. Or, if the input image is of an apple pie, the tags could be Apple Pie, Pies, and Desserts.
-
-Bing Visual Search results also include bounding boxes for regions of interest in the image. For example, if the image contains several celebrities, the results may include bounding boxes for each of the recognized celebrities. Or, if Bing recognizes a product or clothing in the image, the result may include a bounding box for the recognized item.
-
-## Workflow
-
-The Bing Visual Search API is a RESTful web service, making it easy to call from any programming language that can make HTTP requests and parse JSON. You can use either the REST API or the SDK for the service.
-
-1. Create an [Azure AI services account](../cognitive-services-apis-create-account.md) to access the Bing Search APIs. If you don't have an Azure subscription, you can [create an account for free](https://azure.microsoft.com/free/cognitive-services/).
-2. Send a request to the API with a valid search query.
-3. Process the API response by parsing the returned JSON message.
-
-## Next steps
-
-First, try the Bing Visual Search API [interactive demo](https://azure.microsoft.com/services/cognitive-services/Bing-visual-search/).
-The demo shows how you can quickly customize a search query and scour the web for images.
-
-To get started quickly with your first request, see the quickstarts:
-
-* [C#](quickstarts/csharp.md)
-
-* [Java](quickstarts/java.md)
-
-* [Node.js](quickstarts/nodejs.md)
-
-* [Python](quickstarts/python.md)
-
-## See also
-
-* The [Images - Visual Search](/rest/api/cognitiveservices/bingvisualsearch/images/visualsearch) reference describes definitions and information on the endpoints, request headers, responses, and query parameters that you can use to request image-based search results.
-
-* The [Bing Search API use and display requirements](../bing-web-search/use-display-requirements.md) specify acceptable uses of the content and information gained through the Bing search APIs.
-
-* Visit the [Bing Search API hub page](../bing-web-search/overview.md) to explore the other available APIs.
cognitive-services Client Libraries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/client-libraries.md
- Title: 'Quickstart: Use the Bing Visual Search client library'-
-description: The Visual Search API offers client libraries that makes it easy to integrate search capabilities into your applications. Use this quickstart to start sending search requests, and get back results.
---
-zone_pivot_groups: programming-languages-set-ten
--- Previously updated : 03/26/2020---
-# Quickstart: Use the Bing Visual Search client library
-------------
cognitive-services Csharp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/csharp.md
- Title: "Quickstart: Get image insights using the REST API and C# - Bing Visual Search"-
-description: "Learn how to upload an image using the Bing Visual Search API and C#, and then get insights about the image."
----- Previously updated : 05/22/2020---
-# Quickstart: Get image insights using the Bing Visual Search REST API and C#
--
-This quickstart demonstrates how to upload an image to the Bing Visual Search API and view the insights that it returns.
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2019](https://www.visualstudio.com/downloads/).
-* The [Json.NET framework](https://www.newtonsoft.com/json), available as a NuGet package.
-* If you're using Linux/MacOS, you can run this application using [Mono](https://www.mono-project.com/).
--
-## Create and initialize a project
-
-1. In Visual Studio, create a new console solution named BingSearchApisQuickStart. Add the following namespaces to the main code file:
-
- ```csharp
- using System;
- using System.Text;
- using System.Net;
- using System.IO;
- using System.Collections.Generic;
- ```
-
-2. Add variables for your subscription key, endpoint, and path to the image you want to upload. For the `uriBase` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```csharp
- const string accessKey = "<my_subscription_key>";
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch";
- static string imagePath = @"<path_to_image>";
- ```
-
-3. Create a method named `GetImageFileName()` to get the path for your image.
-
- ```csharp
- static string GetImageFileName(string path)
- {
- return new FileInfo(path).Name;
- }
- ```
-
-4. Create a method to get the binary data of the image.
-
- ```csharp
- static byte[] GetImageBinary(string path)
- {
- return File.ReadAllBytes(path);
- }
- ```
-
-## Build the form data
-
-1. To upload a local image, first build the form data to send to the API. The form data includes the `Content-Disposition` header, the `name` parameter set to "image", and the `filename` parameter set to the file name of the image. The contents of the form contain the binary data of the image. The maximum image size you can upload is 1 MB.
-
- ```
- --boundary_1234-abcd
- Content-Disposition: form-data; name="image"; filename="myimagefile.jpg"
-
- ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-
- --boundary_1234-abcd--
- ```
-
-2. Add boundary strings to format the POST form data. Boundary strings determine the start, end, and newline characters for the data.
-
- ```csharp
- // Boundary strings for form data in body of POST.
- const string CRLF = "\r\n";
- static string BoundaryTemplate = "batch_{0}";
- static string StartBoundaryTemplate = "--{0}";
- static string EndBoundaryTemplate = "--{0}--";
- ```
-
-3. Use the following variables to add parameters to the form data:
-
- ```csharp
- const string CONTENT_TYPE_HEADER_PARAMS = "multipart/form-data; boundary={0}";
- const string POST_BODY_DISPOSITION_HEADER = "Content-Disposition: form-data; name=\"image\"; filename=\"{0}\"" + CRLF +CRLF;
- ```
-
-4. Create a function named `BuildFormDataStart()` to create the start of the form data by using the boundary strings and image path.
-
- ```csharp
- static string BuildFormDataStart(string boundary, string filename)
- {
- var startBoundary = string.Format(StartBoundaryTemplate, boundary);
-
- var requestBody = startBoundary + CRLF;
- requestBody += string.Format(POST_BODY_DISPOSITION_HEADER, filename);
-
- return requestBody;
- }
- ```
-
-5. Create a function named `BuildFormDataEnd()` to create the end of the form data by using the boundary strings.
-
- ```csharp
- static string BuildFormDataEnd(string boundary)
- {
- return CRLF + CRLF + string.Format(EndBoundaryTemplate, boundary) + CRLF;
- }
- ```
-
-## Call the Bing Visual Search API
-
-1. Create a function to call the Bing Visual Search endpoint and return the JSON response. The function takes the start and end of the form data, a byte array containing the image data, and a `contentType` value.
-
-2. Use a `WebRequest` to store your URI, contentType value, and headers.
-
-3. Use `request.GetRequestStream()` to write your form and image data, and then get the response. Your function should be similar to the following code:
-
- ```csharp
- static string BingImageSearch(string startFormData, string endFormData, byte[] image, string contentTypeValue)
- {
- WebRequest request = HttpWebRequest.Create(uriBase);
- request.ContentType = contentTypeValue;
- request.Headers["Ocp-Apim-Subscription-Key"] = accessKey;
- request.Method = "POST";
-
- // Writes the boundary and Content-Disposition header, then writes
- // the image binary, and finishes by writing the closing boundary.
- using (Stream requestStream = request.GetRequestStream())
- {
- StreamWriter writer = new StreamWriter(requestStream);
- writer.Write(startFormData);
- writer.Flush();
- requestStream.Write(image, 0, image.Length);
- writer.Write(endFormData);
- writer.Flush();
- writer.Close();
- }
-
- HttpWebResponse response = (HttpWebResponse)request.GetResponseAsync().Result;
- string json = new StreamReader(response.GetResponseStream()).ReadToEnd();
-
- return json;
- }
- ```
-
-## Create the Main method
-
-1. In the `Main()` method of your application, get the filename and binary data of your image.
-
- ```csharp
- var filename = GetImageFileName(imagePath);
- var imageBinary = GetImageBinary(imagePath);
- ```
-
-2. Set up the POST body by formatting its boundary. Then, call `BuildFormDataStart()` and `BuildFormDataEnd()` to create the form data.
-
- ```csharp
- // Set up POST body.
- var boundary = string.Format(BoundaryTemplate, Guid.NewGuid());
- var startFormData = BuildFormDataStart(boundary, filename);
- var endFormData = BuildFormDataEnd(boundary);
- ```
-
-3. Create the `ContentType` value by formatting `CONTENT_TYPE_HEADER_PARAMS` and the form data boundary.
-
- ```csharp
- var contentTypeHdrValue = string.Format(CONTENT_TYPE_HEADER_PARAMS, boundary);
- ```
-
-4. Get the API response by calling `BingImageSearch()`, and then print the response.
-
- ```csharp
- var json = BingImageSearch(startFormData, endFormData, imageBinary, contentTypeHdrValue);
- Console.WriteLine(json);
- Console.WriteLine("enter any key to continue");
- Console.readKey();
- ```
-
-## Using HttpClient
-
-If you use `HttpClient`, you can use the `MultipartFormDataContent` class to build the form data. Use the following sections of code to replace the corresponding methods in the previous example:
-
-1. Replace the `Main()` method with the following code:
-
- ```csharp
- static void Main()
- {
- try
- {
- Console.OutputEncoding = System.Text.Encoding.UTF8;
-
- if (accessKey.Length == 32)
- {
- if (IsImagePathSet(imagePath))
- {
- var filename = GetImageFileName(imagePath);
- Console.WriteLine("Getting image insights for image: " + filename);
- var imageBinary = GetImageBinary(imagePath);
-
- var boundary = string.Format(BoundaryTemplate, Guid.NewGuid());
- var json = BingImageSearch(imageBinary, boundary, uriBase, accessKey);
-
- Console.WriteLine("\nJSON Response:\n");
- Console.WriteLine(JsonPrettyPrint(json));
- }
- }
- else
- {
- Console.WriteLine("Invalid Bing Visual Search API subscription key!");
- Console.WriteLine("Please paste yours into the source code.");
- }
-
- Console.Write("\nPress Enter to exit ");
- Console.ReadLine();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- }
- ```
-
-2. Replace the `BingImageSearch()` method with the following code:
-
- ```csharp
- /// <summary>
- /// Calls the Bing visual search endpoint and returns the JSON response.
- /// </summary>
- static string BingImageSearch(byte[] image, string boundary, string uri, string subscriptionKey)
- {
- var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
- requestMessage.Headers.Add("Ocp-Apim-Subscription-Key", accessKey);
-
- var content = new MultipartFormDataContent(boundary);
- content.Add(new ByteArrayContent(image), "image", "myimage");
- requestMessage.Content = content;
-
- var httpClient = new HttpClient();
-
- Task<HttpResponseMessage> httpRequest = httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseContentRead, CancellationToken.None);
- HttpResponseMessage httpResponse = httpRequest.Result;
- HttpStatusCode statusCode = httpResponse.StatusCode;
- HttpContent responseContent = httpResponse.Content;
-
- string json = null;
-
- if (responseContent != null)
- {
- Task<String> stringContentsTask = responseContent.ReadAsStringAsync();
- json = stringContentsTask.Result;
- }
-
- return json;
- }
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Go https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/go.md
- Title: "Quickstart: Get image insights using the REST API and Go - Bing Visual Search"-
-description: Learn how to upload an image using the Bing Visual Search API and Go, and then get insights about the image.
------ Previously updated : 05/22/2020----
-# Quickstart: Get image insights using the Bing Visual Search REST API and Go
--
-Use this quickstart to make your first call to the Bing Visual Search API using the Go programming language. A POST request uploads an image to the API endpoint. The results include URLs and descriptive information about images similar to the uploaded image.
-
-## Prerequisites
-
-* Install the [Go binaries](https://go.dev/dl/).
-* Install the go-spew deep pretty printer, which is used to display results. To install go-spew, use the `$ go get -u https://github.com/davecgh/go-spew` command.
--
-## Project and libraries
-
-Create a Go project in your IDE or editor. Then, import `net/http` for requests, `ioutil` to read the response, and `encoding/json` to handle the JSON text of results. Use the `go-spew` library to parse JSON results.
-
-```go
-package main
-
-import (
- "bytes"
- "io"
- "fmt"
- "io/ioutil"
- "mime/multipart"
- "net/http"
- "os"
- "path/filepath"
- "encoding/json"
- "github.com/davecgh/go-spew/spew"
-)
-
-```
-
-## Struct to format results
-
-The `BingAnswer` structure formats data returned in the JSON response, which is multilevel and complex. The following implementation covers some of the essentials:
-
-```go
-type BingAnswer struct {
- Type string `json:"_type"`
- Instrumentation struct {
- Type string `json:"_type"`
- PingUrlBase string `json:"_pingUrlBase"`
- PageLoadPingUrl string `json:"_pageLoadPingUrl"`
- } `json:"instrumentation"`
- Tags []struct {
- DisplayName string `json:"displayName"`
- Actions []struct {
- Type string `json:"_type"`
- ActionType string `json:"actionType"`
- Data struct {
- Value []struct {
- WebSearchUrl string `json:"webSearchUrl"`
- Name string `json:"name"`
- }`json:"value"`
- ImageInsightsToken string `json:"imageInsightsToken"`
- InsightsMetadata struct {
- PagesIncludingCount int `json:"pagesIncludingCount"`
- AvailableSizesCount int `json:"availableSizesCount"`
- }
- ImageId string `json:"imageId"`
- AccentColor string `json:"accentColor"`
- } `json:"data"`
- } `json:"actions"`
- } `json:"tags"`
- Image struct {
- WebSearchUrl string `json:"webSearchUrl"`
- WebSearchUrlPingSuffix string `json:"webSearchUrlPingSuffix"`
- Name string `json:"name"`
- IsFamilyFriendly bool `json:"isFamilyFriendly"`
- ContentSize string `json:"contentSize"`
- EncodingFormat string `json:"encodingFormat"`
- HostPageDisplayUrl string `json:"hostPageDisplayUrl"`
- Width int `json:"width"`
- Height int `json:"height"`
- Thumbnail struct {
- Width int `json:"width"`
- Height int `json:"height"`
- }
- InsightsMetadata struct {
- PagesIncludingCount int `json:"pagesIncludingCount"`
- AvailableSizesCount int `json:"availableSizesCount"`
- }
- AccentColor string `json:"accentColor"`
- VisualWords string `json:"visualWords"`
- } `json:"image"`
-}
-
-```
-
-## Main function and variables
-
-The following code declares the main function and assigns the required variables:
-
-1. Confirm that the endpoint is correct and replace the `token` value with a valid subscription key from your Azure account.
-2. For `batchNumber`, assign a GUID, which is required for the leading and trailing boundaries of the POST data.
-3. For `fileName`, assign the image file to use for the POST.
-4. For `endpoint`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
-```go
-func main() {
- // Verify the endpoint URI and replace the token string with a valid subscription key.se
- endpoint := "https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch"
- token := "YOUR-ACCESS-KEY"
- client := &http.Client{}
- batchNumber := "d7ecc447-912f-413e-961d-a83021f1775f"
- fileName := "ElectricBike.JPG"
-
- body, contentType := createRequestBody(fileName, batchNumber)
-
- req, err := http.NewRequest("POST", endpoint, body)
- req.Header.Add("Content-Type", contentType)
- req.Header.Set("Ocp-Apim-Subscription-Key", token)
-
- resp, err := client.Do(req)
- if err != nil {
- panic(err)
- }
-
- defer resp.Body.Close()
-
- resbody, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- panic(err)
- }
-
- //fmt.Print(string(resbody))
-
- // Create a new answer.
- ans := new(BingAnswer)
- err = json.Unmarshal(resbody, &ans)
- if err != nil {
- fmt.Println(err)
- }
-
- fmt.Print("Output of BingAnswer: \r\n\r\n")
-
- // Iterate over search results and print the result name and URL.
- for _, result := range ans.Tags {
- spew.Dump(result)
- }
-}
-
-```
-
-## Boundaries of POST body
-
-A POST request to the Visual Search endpoint requires leading and trailing boundaries to enclose the POST data. These functions aren't included in the `main()` block.
-
-The leading boundary includes a batch number, the content type identifier `Content-Disposition: form-data; name="image"; filename=`, and the filename of the image to POST.
-
-The trailing boundary includes the batch number only.
--
-```go
-func BuildFormDataStart(batNum string, fileName string) string{
-
- startBoundary := "--batch_" + batNum + "\r\n"
- requestBoundary := startBoundary + "\r\n" + "Content-Disposition: form-data; name=\"image\"; filename=" + fileName + "\r\n\r\n"
- return requestBoundary
-}
-
-func BuildFormDataEnd(batNum string) string{
-
- return "\r\n" + "\r\n" + "--batch_" + batNum + "\r\n"
-
-}
-
-```
-## Add image bytes to POST body
-
-The following code creates the POST request that contains image data:
-
-```go
-func createRequestBody(fileName string, batchNumber string) (*bytes.Buffer, string) {
- file, err := os.Open(fileName)
- if err != nil {
- panic(err)
- }
- defer file.Close()
-
- body := &bytes.Buffer{}
- writer := multipart.NewWriter(body)
-
- writer.SetBoundary(BuildFormDataStart(batchNumber, fileName))
-
- part, err := writer.CreateFormFile("image", filepath.Base(file.Name()))
- if err != nil {
- panic(err)
- }
- io.Copy(part, file)
- writer.WriteField("lastpart", BuildFormDataEnd(batchNumber))
- writer.Close()
- return body, writer.FormDataContentType()
-}
-
-```
-
-## Send the request
-
-The following code sends the request and reads the results:
-
-```go
-resp, err := client.Do(req)
- if err != nil {
- panic(err)
- }
-
- defer resp.Body.Close()
-
- resbody, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- panic(err)
- }
-
-```
-
-## Handle the response
-
-The `Unmarshall` function extracts information from the JSON text returned by the Visual Search API. The `go-spew` pretty printer displays the results.
-
-```go
- // Create a new answer.
- ans := new(BingAnswer)
- err = json.Unmarshal(resbody, &ans)
- if err != nil {
- fmt.Println(err)
- }
-
- fmt.Print("Output of BingAnswer: \r\n\r\n")
-
- // Iterate over search results and print the result name and URL.
- for _, result := range ans.Tags {
- spew.Dump(result)
- }
-
-```
-> [!NOTE]
-> Francesco Giordano contributed code to this example.
-
-## Results
-
-The results identify images similar to the image contained in the POST body. The useful fields are `WebSearchUrl` and `Name`.
-
-```go
- Value: ([]struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) (len=66 cap=94) {
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=B9E6621161769D578A9E4DD9FD742128DE65225A&simid=608046863828453626",
- Name: (string) (len=87) "26\"Foldable Electric Mountain Bike Bicycle Ebike W/Lithium Battery 250W 36V MY8L | eBay"
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=5554757348A9E88E9EEAB74217E228689E716B61&simid=607988237543409883",
- Name: (string) (len=96) "Best 25+ Electric mountain bike ideas on Pinterest | Mountain bicycle, Mtb mountain bike and ..."
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=B56F626A4803D829FE326842E2B97CE5B87F17F2&simid=607991699288949513",
- Name: (string) (len=100) "Electric Fat Bike Mountain Bicycle Snow Bike Cruiser Ebike Motor Lithium Battery Dual Oil Brakes ..."
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=CCAE400EE510DCA6F5740ABAF08A5310B4EF0698&simid=608003854048890458",
- Name: (string) (len=81) "Best Mountain Bikes Under 1500 (Outstanding Performance) | Mountain Bicycle World"
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=1244730E2E3F2D5DFBED9A9CFE1DBE27B09F08BC&simid=608005181199745622",
- Name: (string) (len=98) "ANCHEER Folding Electric Mountain Bike with 26\" Super Lightweight Magnesium (36V 250W) - GearScoot"
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=38AAD876E57BB0D502FBDD5B1CB29EB7EB8DD9E2&simid=608041654062220328",
- Name: (string) (len=97) "29 best CB Bikes Gadgets & Accessories images on Pinterest | Bicycles, Bicycling and Bike gadgets"
- },
- (struct { WebSearchUrl string "json:\"webSearchUrl\""; Name string "json:\"name\"" }) {
- WebSearchUrl: (string) (len=129) "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=6892C8FD22D0E42911C99AFD8FE1FD37BD82E02C&simid=608052803759703185",
- Name: (string) (len=98) "ANCHEER Folding Electric Mountain Bike with 26\" Super Lightweight Magnesium (36V 250W) - GearScoot"
- },
-
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [What is the Bing Visual Search API?](../overview.md)
-> [Bing Web Search quickstart in Go](../../bing-web-search/quickstarts/go.md)
cognitive-services Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/java.md
- Title: "Quickstart: Get image insights using the REST API and Java - Bing Visual Search"-
-description: Learn how to upload an image to the Bing Visual Search API and get insights about it.
----- Previously updated : 05/22/2020---
-# Quickstart: Get image insights using the Bing Visual Search REST API and Java
--
-Use this quickstart to make your first call to the Bing Visual Search API. This Java application uploads an image to the API and displays the information it returns. Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* The [Java Development Kit (JDK) 7 or 8](/azure/developer/java/fundamentals/java-support-on-azure)
-* The [Gson Java library](https://github.com/google/gson)
-* [Apache HttpComponents](https://hc.apache.org/downloads.cgi)
--
-## Create and initialize a project
-
-1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
-
- ```java
- import java.util.*;
- import java.io.*;
- import com.google.gson.Gson;
- import com.google.gson.GsonBuilder;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
-
- // HttpClient libraries
-
- import org.apache.http.HttpEntity;
- import org.apache.http.HttpResponse;
- import org.apache.http.client.methods.HttpPost;
- import org.apache.http.entity.ContentType;
- import org.apache.http.entity.mime.MultipartEntityBuilder;
- import org.apache.http.impl.client.CloseableHttpClient;
- import org.apache.http.impl.client.HttpClientBuilder;
- ```
-
-2. Create variables for your API endpoint, subscription key, and the path to your image. For the `endpoint` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```java
- static String endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch";
- static String subscriptionKey = "your-key-here";
- static String imagePath = "path-to-your-image";
- ```
-
-
-3. When you upload a local image, the form data must include the `Content-Disposition` header. Set its `name` parameter to "image", and set the `filename` parameter to the file name of the image. The contents of the form include the binary data of the image. The maximum image size you can upload is 1 MB.
-
- ```
- --boundary_1234-abcd
- Content-Disposition: form-data; name="image"; filename="myimagefile.jpg"
-
- ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-
- --boundary_1234-abcd--
- ```
-
-## Create the JSON parser
-
-Create a method to make the JSON response from the API more readable by using `JsonParser`.
-
-```java
-public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
-```
-
-## Construct the search request and query
-
-1. In the main method of your application, create an HTTP client using `HttpClientBuilder.create().build();`.
-
- ```java
- CloseableHttpClient httpClient = HttpClientBuilder.create().build();
- ```
-
-2. Create an `HttpEntity` object to upload your image to the API.
-
- ```java
- HttpEntity entity = MultipartEntityBuilder
- .create()
- .addBinaryBody("image", new File(imagePath))
- .build();
- ```
-
-3. Create an `httpPost` object with your endpoint, and set the header to use your subscription key.
-
- ```java
- HttpPost httpPost = new HttpPost(endpoint);
- httpPost.setHeader("Ocp-Apim-Subscription-Key", subscriptionKey);
- httpPost.setEntity(entity);
- ```
-
-## Receive and process the JSON response
-
-1. Use the `HttpClient.execute()` method to send a request to the API, and store the response in an `InputStream` object.
-
- ```java
- HttpResponse response = httpClient.execute(httpPost);
- InputStream stream = response.getEntity().getContent();
- ```
-
-2. Store the JSON string, and print the response.
-
- ```java
- String json = new Scanner(stream).useDelimiter("\\A").next();
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(json));
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Nodejs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/nodejs.md
- Title: "Quickstart: Get image insights using the REST API and Node.js - Bing Visual Search"-
-description: Learn how to upload an image using the Bing Visual Search API and Node.js, and then get insights about the image.
----- Previously updated : 05/22/2020---
-# Quickstart: Get image insights using the Bing Visual Search REST API and Node.js
--
-Use this quickstart to make your first call to the Bing Visual Search API. This simple JavaScript application uploads an image to the API, and displays the information returned about it. Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [Node.js](https://nodejs.org/en/download/)
-* The Request module for JavaScript. You can use `npm install request` command to install the module.
-* The form-data module. You can use the `npm install form-data` command to install the module.
--
-## Initialize the application
-
-1. Create a JavaScript file in your favorite IDE or editor, and set the following requirements:
-
- ```javascript
- var request = require('request');
- var FormData = require('form-data');
- var fs = require('fs');
- ```
-
-2. Create variables for your API endpoint, subscription key, and the path to your image. For the `baseUri` value, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```javascript
- var baseUri = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch';
- var subscriptionKey = 'your-api-key';
- var imagePath = "path-to-your-image";
- ```
-
-3. Create a function named `requestCallback()` to print the response from the API.
-
- ```javascript
- function requestCallback(err, res, body) {
- console.log(JSON.stringify(JSON.parse(body), null, ' '))
- }
- ```
-
-## Construct and send the search request
-
-1. When you upload a local image, the form data must include the `Content-Disposition` header. Set its `name` parameter to "image", and set the `filename` parameter to the file name of your image. The contents of the form include the binary data of the image. The maximum image size you can upload is 1 MB.
-
- ```
- --boundary_1234-abcd
- Content-Disposition: form-data; name="image"; filename="myimagefile.jpg"
-
- ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-
- --boundary_1234-abcd--
- ```
-
-2. Create a new `FormData` object with `FormData()`, and append your image path to it by using `fs.createReadStream()`.
-
- ```javascript
- var form = new FormData();
- form.append("image", fs.createReadStream(imagePath));
- ```
-
-3. Use the request library to upload the image, and call `requestCallback()` to print the response. Add your subscription key to the request header.
-
- ```javascript
- form.getLength(function(err, length){
- if (err) {
- return requestCallback(err);
- }
- var r = request.post(baseUri, requestCallback);
- r._form = form;
- r.setHeader('Ocp-Apim-Subscription-Key', subscriptionKey);
- });
- ```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Build a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Python https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/python.md
- Title: "Quickstart: Get image insights using the REST API and Python - Bing Visual Search"-
-description: Learn how to upload an image using the Bing Visual Search API and Python, and then get insights about the image.
----- Previously updated : 05/22/2020---
-# Quickstart: Get image insights using the Bing Visual Search REST API and Python
--
-Use this quickstart to make your first call to the Bing Visual Search API. This Python application uploads an image to the API and displays the information it returns. Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
-
-## Prerequisites
-
-* [Python 3.x](https://www.python.org/)
--
-## Initialize the application
-
-1. Create a new Python file in your favorite IDE or editor, and add the following `import` statement:
-
- ```python
- import requests, json
- ```
-
-2. Create variables for your subscription key, endpoint, and the path to the image you're uploading. For the value of `BASE_URI`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../ai-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
-
- ```python
-
- BASE_URI = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch'
- SUBSCRIPTION_KEY = 'your-subscription-key'
- imagePath = 'your-image-path'
- ```
-
-3. When you upload a local image, the form data must include the `Content-Disposition` header. Set its `name` parameter to "image", and set the `filename` parameter to the file name of your image. The contents of the form include the binary data of the image. The maximum image size you can upload is 1 MB.
-
- ```
- --boundary_1234-abcd
- Content-Disposition: form-data; name="image"; filename="myimagefile.jpg"
-
- ÿØÿà JFIF ÖÆ68g-¤CWŸþ29ÌÄøÖ‘º«™æ±èuZiÀ)"óÓß°Î= ØJ9á+*G¦...
-
- --boundary_1234-abcd--
- ```
-
-4. Create a dictionary object to hold your request's header information. Bind your subscription key to the string `Ocp-Apim-Subscription-Key`.
-
- ```python
- HEADERS = {'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY}
- ```
-
-5. Create another dictionary to contain your image, which is opened and uploaded when you send the request.
-
- ```python
- file = {'image' : ('myfile', open(imagePath, 'rb'))}
- ```
-
-## Parse the JSON response
-
-Create a method called `print_json()` to accept the API response, and print the JSON.
-
-```python
-def print_json(obj):
- """Print the object as json"""
- print(json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': ')))
-```
-
-## Send the request
-
-Use `requests.post()` to send a request to the Bing Visual Search API. Include the string for your endpoint, header, and file information. Print `response.json()` with `print_json()`.
-
-```python
-try:
- response = requests.post(BASE_URI, headers=HEADERS, files=file)
- response.raise_for_status()
- print_json(response.json())
-
-except Exception as ex:
- raise ex
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Ruby https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/quickstarts/ruby.md
- Title: "Quickstart: Get image insights using the REST API and Ruby - Bing Visual Search"-
-description: Learn how to upload an image using the Bing Visual Search API and Ruby, and then get insights about the image.
------ Previously updated : 05/22/2020----
-# Quickstart: Get image insights using the Bing Visual Search REST API and Ruby
--
-Use this quickstart to make your first call to the Bing Visual Search API using the Ruby programming language. A POST request uploads an image to the API endpoint. The results include URLs and descriptive information about images similar to the uploaded image.
-
-## Prerequisites
-
-* Install [Ruby 2.4 or later](https://www.ruby-lang.org/en/downloads/).
-* Get a subscription key.
--
-## Project and required modules
-
-Create a new Ruby project in your IDE or editor. Import `net/http`, `uri` , and `json` to handle the JSON text of results. Import the `base64` library, which encodes the file name string.
-
-```ruby
-require 'net/https'
-require 'uri'
-require 'json'
-require 'base64'
-```
-
-## Define variables
-
-The following code declares the main function and assigns the required variables:
-
-1. Confirm that the endpoint is correct and replace the `accessKey` value with a valid subscription key from your Azure account.
-2. For `batchNumber`, assign a GUID, which is required for the leading and trailing boundaries of the POST data.
-3. For `fileName`, assign the image file to use for the POST.
-4. Use an `if` block to test for a valid subscription key.
-
-```ruby
-accessKey = "ACCESS-KEY"
-uri = "https://api.cognitive.microsoft.com"
-path = "/bing/v7.0/images/visualsearch"
-batchNumber = "dc05c75a-6b5e-4059-b556-0b7c079819a5"
-fileName = "red-dress.jpg"
-
-if accessKey.length != 32 then
- puts "Invalid Bing Search API subscription key!"
- puts "Please paste yours into the source code."
- abort
-end
-
-```
-
-## Form data for POST request
-
-1. Enclose the image data to POST by leading and trailing boundaries. The following functions set the boundaries:
-
- ```ruby
- def BuildFormDataStart(batNum, fileName)
- startBoundary = "--batch_" + batNum
- return startBoundary + "\r\n" + "Content-Disposition: form-data; name=\"image\"; filename=" + "\"" + fileName + "\"" + "\r\n\r\n"
- end
-
- def BuildFormDataEnd(batNum)
- return "\r\n\r\n" + "--batch_" + batNum + "--" + "\r\n"
- end
- ```
-
-2. Construct the endpoint URI and an array to contain the POST body. Use the previous function to load the start boundary into the array. Read the image file into the array, and then read the end boundary into the array.
-
- ```ruby
- uri = URI(uri + path)
- print uri
- print "\r\n\r\n"
-
- post_body = []
-
- post_body << BuildFormDataStart(batchNumber, fileName)
-
- post_body << File.read(fileName) #Base64.encode64(File.read(fileName))
-
- post_body << BuildFormDataEnd(batchNumber)
- ```
-
-## Create the HTTP request
-
-Set the `Ocp-Apim-Subscription-Key` header. Create the request, and then assign the header and content type. Join the POST body you created previously to the request.
-
-```ruby
-header = {'Ocp-Apim-Subscription-Key': accessKey}
-request = Net::HTTP::Post.new(uri) # , 'ImageKnowledge' => 'ImageKnowledge'
-
-request['Ocp-Apim-Subscription-Key'] = accessKey
-request.content_type = "multipart/form-data; boundary=batch_" + batchNumber
-request.body = post_body.join
-
-```
-
-## Request and response
-
-Ruby sends the request and gets the response with the following code:
-
-```ruby
-response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
- http.request(request)
-end
-
-```
-
-## Print the results
-
-Print the headers of the response, and use the JSON library to format the output:
-
-```ruby
-puts "\nRelevant Headers:\n\n"
-response.each_header do |key, value|
- if key.start_with?("bingapis-") or key.start_with?("x-msedge-") then
- puts key + ": " + value
- end
-end
-
-puts "\nJSON Response:\n\n"
-puts JSON::pretty_generate(JSON(response.body))
-
-```
-
-## JSON response
-
-The following JSON is a segment of the output:
-
-```JSON
-Relevant Headers:
-
-bingapis-traceid: 6E19E78D4FEC4A61AB4F85977EEDB8E6
-x-msedge-clientid: 3928F9869390668A304CF49792DC6746
-x-msedge-ref: Ref A: 6E19E78D4FEC4A61AB4F85977EEDB8E6 Ref B: BY3EDGE0310 Ref C: 2019-02-28T19:25:12Z
-
-JSON Response:
-
-{
- "_type": "ImageKnowledge",
- "instrumentation": {
- "_type": "ResponseInstrumentation",
- "pingUrlBase": "https://www.bingapis.com/api/ping?IG=3F6A656574B24F81A553485B4B3244EF&CID=3928F9869390668A304CF49792DC6746&ID=",
- "pageLoadPingUrl": "https://www.bingapis.com/api/ping/pageload?IG=3F6A656574B24F81A553485B4B3244EF&CID=3928F9869390668A304CF49792DC6746&Type=Event.CPT&DATA=0"
- },
- "tags": [
- {
- "displayName": "",
- "actions": [
- {
- "_type": "ImageModuleAction",
- "actionType": "PagesIncluding",
- "data": {
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=6988549F8C0C0688972CCC9F6A5E5F70F17D6F1E&simid=608025573664556965",
- "webSearchUrlPingSuffix": "DevEx,5044.1",
- "name": "Peanut Butter & Banana Training Treats. | Loved By A Collie",
- "thumbnailUrl": "https://tse2.mm.bing.net/th?id=OIP.FyoKOORtLFGzzanAVfPt4QAAAA&pid=Api",
- "datePublished": "2014-02-04T12:00:00.0000000Z",
- "isFamilyFriendly": true,
- "contentUrl": "https://lovedbyacollie.lifeseven.com/wp-content/uploads/2014/02/PBBcookies.png",
- "contentUrlPingSuffix": "DevEx,5046.1",
- "hostPageUrl": "https://lovedbyacollie.lifeseven.com/2014/02/04/peanut-butter-banana-training-treats/",
- "hostPageUrlPingSuffix": "DevEx,5045.1",
- "contentSize": "197552 B",
- "encodingFormat": "png",
- "hostPageDisplayUrl": "lovedbyacollie.lifeseven.com/2014/02/04/peanut-butter-banana...",
- "width": 300,
- "height": 409,
- "hostPageFavIconUrl": "https://www.bing.com/th?id=AR_2ceefde49d9f981b6cab9e9bd0e6693b&pid=Api",
- "thumbnail": {
- "width": 300,
- "height": 409
- },
- "imageInsightsToken": "ccid_FyoKOORt*mid_6988549F8C0C0688972CCC9F6A5E5F70F17D6F1E*simid_608025573664556965*thid_OIP.FyoKOORtLFGzzanAVfPt4QAAAA",
- "insightsMetadata": {
- "pagesIncludingCount": 2,
- "availableSizesCount": 2
- },
- "imageId": "6988549F8C0C0688972CCC9F6A5E5F70F17D6F1E",
- "accentColor": "8A6E41"
- },
- {
- "webSearchUrl": "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=B5B5C37666FB3DB326209F358A1AC9E7B0F484EB&simid=607993125239130030",
- "webSearchUrlPingSuffix": "DevEx,5050.1",
- "name": "RPG Maker Icons favourites by Leon-Murayami on DeviantArt",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OIP.vzeNdrscXihmLeTdDe6G6AHaKL&pid=Api",
- "datePublished": "2019-01-22T06:59:00.0000000Z",
- "isFamilyFriendly": true,
- "contentUrl": "https://orig00.deviantart.net/753e/f/2018/147/5/0/signs_metal_rusted_by_sarahyt-dccnku0.png",
- "contentUrlPingSuffix": "DevEx,5052.1",
- "hostPageUrl": "https://www.deviantart.com/leon-murayami/favourites/71077691/RPG-Maker-Icons",
- "hostPageUrlPingSuffix": "DevEx,5051.1",
- "contentSize": "569772 B",
- "encodingFormat": "png",
- "hostPageDisplayUrl": "https://www.deviantart.com/leon-murayami/favourites/71077691/RPG...",
- "width": 768,
- "height": 1056,
- "hostPageFavIconUrl": "https://www.bing.com/th?id=AR_b246060a4abab0d7111f5aa733205f06&pid=Api",
- "thumbnail": {
- "width": 474,
- "height": 651
- },
- "imageInsightsToken": "ccid_vzeNdrsc*mid_B5B5C37666FB3DB326209F358A1AC9E7B0F484EB*simid_607993125239130030*thid_OIP.vzeNdrscXihmLeTdDe6G6AHaKL",
- "insightsMetadata": {
- "pagesIncludingCount": 3,
- "availableSizesCount": 3
- },
- "imageId": "B5B5C37666FB3DB326209F358A1AC9E7B0F484EB",
- "accentColor": "936C38"
- }
- ]
- }
- },
- {
- "image": {
- "webSearchUrl": "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO",
- "webSearchUrlPingSuffix": "DevEx,5057.1",
- "name": "",
- "isFamilyFriendly": true,
- "contentSize": "572 B",
- "encodingFormat": "jpeg",
- "hostPageDisplayUrl": "",
- "width": 583,
- "height": 583,
- "thumbnail": {
- "width": 0,
- "height": 0
- },
- "visualWords": "0bfcc afa3e ac572 0aa3e b5daf 12d1a aabab 620ad 0c081 0a5a6 0c1d6 5ebfe ac579 ab7a3 0bff6 ab1eb b1fa0 61970 ac57d 0bfcf 5a8f00bf60e71d1c15a4c1586622845a8f22db5d2db98f058c6d7a112f5c17363ab964ac3f4f058b622795a8335a8f30bfcb"
- },
- "actionType": "MoreSizes"
- },
- {
- "_type": "ImageModuleAction",
- "actionType": "VisualSearch",
- "data": {
- "value": [
- {
- "webSearchUrl": "https://www.bing.com/images/search?view=detailv2&FORM=OIIRPO&id=21423B0D286BB2FCFB3B7090D59EA6F8A54AB7CB&simid=608005928522679185",
- "webSearchUrlPingSuffix": "DevEx,5064.1",
- "name": "Bemz review of IKEA S├╢derhamn sofa - Bemz",
- "thumbnailUrl": "https://tse4.mm.bing.net/th?id=OIP.v0zvOeP8dnNFPWQNSu80hwAAAA&pid=Api",
- "datePublished": "2017-09-08T02:27:00.0000000Z",
- "isFamilyFriendly": true,
- "contentUrl": "https://bemz.scene7.com/is/image/Bemz?obj=masks&src=ir%7bBemzRender%2fsq50v2%3f%26src%3dDG2130%26rs%3dQ5%26sharpen%3d1%26res%3d20%26wid%3d2400%26hei%3d2400%7d&resmode=sharp2&op_usm=1,1,8&wid=280&hei=280&scl=5",
- "contentUrlPingSuffix": "DevEx,5066.1",
- "hostPageUrl": "https://bemz.com/inspiration/popular-products/i-love-my-soderhamn/",
- "hostPageUrlPingSuffix": "DevEx,5065.1",
- "contentSize": "3000 B",
- "encodingFormat": "jpeg",
- "hostPageDisplayUrl": "bemz.com/inspiration/popular-products/i-love-my-soderhamn",
- "width": 280,
- "height": 280,
- "thumbnail": {
- "width": 280,
- "height": 280
- },
- "imageInsightsToken": "ccid_v0zvOeP8*mid_21423B0D286BB2FCFB3B7090D59EA6F8A54AB7CB*simid_608005928522679185*thid_OIP.v0zvOeP8dnNFPWQNSu80hwAAAA",
- "insightsMetadata": {
- "pagesIncludingCount": 1,
- "availableSizesCount": 1
- },
- "imageId": "21423B0D286BB2FCFB3B7090D59EA6F8A54AB7CB",
- "accentColor": "963555"
- },
-
- . . .
-
-```
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [What is the Bing Visual Search API?](../overview.md)
-> [Build a Visual Search single-page web app](../tutorial-bing-visual-search-single-page-app.md)
cognitive-services Tutorial Bing Visual Search Single Page App https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/tutorial-bing-visual-search-single-page-app.md
- Title: " Build a single-page Web app - Bing Visual Search"-
-description: Learn how to integrate the Bing Visual Search API into a single-page Web application.
------- Previously updated : 03/27/2020---
-# Tutorial: Create a Visual Search single-page web app
--
-The Bing Visual Search API returns insights for an image. You can either upload an image or provide a URL to one. Insights are visually similar images, shopping sources, webpages that include the image, and more. Insights returned by the Bing Visual Search API are similar to ones shown on Bing.com/images.
-
-This tutorial explains how to extend a single-page web app for the Bing Image Search API. To view that tutorial or get the source code used here, see [Tutorial: Create a single-page app for the Bing Image Search API](../bing-image-search/tutorial-bing-image-search-single-page-app.md).
-
-The full source code for this application (after extending it to use the Bing Visual Search API), is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/Bing-Visual-Search/BingVisualSearchApp.html).
-
-## Prerequisites
--
-## Call the Bing Visual Search API and handle the response
-
-Edit the Bing Image Search tutorial and add the following code to the end of the `<script>` element (and before the closing `</script>` tag). The following code handles a visual search response from the API, iterates through the results, and displays them:
-
-``` javascript
-function handleVisualSearchResponse(){
- if(this.status !== 200){
- console.log(this.responseText);
- return;
- }
- let json = this.responseText;
- let response = JSON.parse(json);
- for (let i =0; i < response.tags.length; i++) {
- let tag = response.tags[i];
- if (tag.displayName === '') {
- for (let j = 0; j < tag.actions.length; j++) {
- let action = tag.actions[j];
- if (action.actionType === 'VisualSearch') {
- let html = '';
- for (let k = 0; k < action.data.value.length; k++) {
- let item = action.data.value[k];
- let height = 120;
- let width = Math.max(Math.round(height * item.thumbnail.width / item.thumbnail.height), 120);
- html += "<img src='"+ item.thumbnailUrl + "&h=" + height + "&w=" + width + "' height=" + height + " width=" + width + "'>";
- }
- showDiv("insights", html);
- window.scrollTo({top: document.getElementById("insights").getBoundingClientRect().top, behavior: "smooth"});
- }
- }
- }
- }
-}
-```
-
-The following code sends a search request to the API, using an event listener to call `handleVisualSearchResponse()`:
-
-```javascript
-function bingVisualSearch(insightsToken){
- let visualSearchBaseURL = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch',
- boundary = 'boundary_ABC123DEF456',
- startBoundary = '--' + boundary,
- endBoundary = '--' + boundary + '--',
- newLine = "\r\n",
- bodyHeader = 'Content-Disposition: form-data; name="knowledgeRequest"' + newLine + newLine;
-
- let postBody = {
- imageInfo: {
- imageInsightsToken: insightsToken
- }
- }
- let requestBody = startBoundary + newLine;
- requestBody += bodyHeader;
- requestBody += JSON.stringify(postBody) + newLine + newLine;
- requestBody += endBoundary + newLine;
-
- let request = new XMLHttpRequest();
-
- try {
- request.open("POST", visualSearchBaseURL);
- }
- catch (e) {
- renderErrorMessage("Error performing visual search: " + e.message);
- }
- request.setRequestHeader("Ocp-Apim-Subscription-Key", getSubscriptionKey());
- request.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
- request.addEventListener("load", handleVisualSearchResponse);
- request.send(requestBody);
-}
-```
-
-## Capture insights token
-
-Add the following code to the `searchItemsRenderer` object. This code adds a **find similar** link that calls the `bingVisualSearch` function when clicked. The function receives the `imageInsightsToken` as an argument.
-
-``` javascript
-html.push("<a href='javascript:bingVisualSearch(\"" + item.imageInsightsToken + "\");'>find similar</a><br>");
-```
-
-## Display similar images
-
-Add the following HTML code at line 601. This markup code adds an element to display the results of the Bing Visual Search API call:
-
-``` html
-<div id="insights">
- <h3><a href="#" onclick="return toggleDisplay('_insights')">Similar</a></h3>
- <div id="_insights" style="display: none"></div>
-</div>
-```
-
-With all the new JavaScript code and HTML elements in place, search results are displayed with a **find similar** link. Click the link to populate the **Similar** section with images similar to the one you picked. You may have to expand the **Similar** section to show the images.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Tutorial: Crop an image with the Bing Visual Search SDK for C#](tutorial-visual-search-crop-area-results.md)
cognitive-services Tutorial Visual Search Crop Area Results https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/tutorial-visual-search-crop-area-results.md
- Title: "Tutorial: Crop an image with the Bing Visual Search SDK"
-description: Use the Bing Visual Search SDK to get insights from specific ares on an image.
------- Previously updated : 03/31/2019----
-# Tutorial: Crop an image with the Bing Visual Search SDK for C#
--
-The Bing Visual Search SDK enables you to crop an image before finding similar online images. This application crops a single person from an image containing several people, and then returns search results containing similar images found online.
-
-The full source code for this application is available with additional error handling and annotations on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/Bing-Visual-Search/BingVisualSearchCropImage.cs).
-
-This tutorial illustrates how to:
-
-> [!div class="checklist"]
-> * Send a request using the Bing Visual Search SDK
-> * Crop an area of image to search with Bing Visual Search
-> * Receive and handle the response
-> * Find the URLs of action items in the response
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2019](https://www.visualstudio.com/downloads/).
-* If you are using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
-* The [NuGet Custom Search](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomSearch/1.2.0) package installed.
- - From the Solution Explorer in Visual Studio, right-click on your project and select **Manage NuGet Packages** from the menu. Install the `Microsoft.Azure.CognitiveServices.Search.CustomSearch` package. Installing the NuGet Custom Search package also installs the following assemblies:
- - Microsoft.Rest.ClientRuntime
- - Microsoft.Rest.ClientRuntime.Azure
- - Newtonsoft.Json
--
-## Specify the image crop area
-
-This application crops an area of this image of the Microsoft senior leadership team. This crop area is defined using upper-left and lower-right coordinates, represented as a percentage of the whole image:
-
-![Microsoft Senior Leadership Team](./media/MS_SrLeaders.jpg)
-
-This image is cropped by creating an `ImageInfo` object from the crop area, and loading the `ImageInfo` object into a `VisualSearchRequest`. The `ImageInfo` object also includes the URL of the image:
-
-```csharp
-CropArea CropArea = new CropArea(top: (float)0.01, bottom: (float)0.30, left: (float)0.01, right: (float)0.20);
-string imageURL = "https://learn.microsoft.com/azure/cognitive-services/Bing-visual-search/media/ms_srleaders.jpg";
-ImageInfo imageInfo = new ImageInfo(cropArea: CropArea, url: imageURL);
-
-VisualSearchRequest visualSearchRequest = new VisualSearchRequest(imageInfo: imageInfo);
-```
-
-## Search for images similar to the crop area
-
-The variable `VisualSearchRequest` contains information about the image's crop area and its URL. The `VisualSearchMethodAsync()` method gets the results:
-
-```csharp
-Console.WriteLine("\r\nSending visual search request with knowledgeRequest that contains URL and crop area");
-var visualSearchResults = client.Images.VisualSearchMethodAsync(knowledgeRequest: visualSearchRequest).Result;
-
-```
-
-## Get the URL data from `ImageModuleAction`
-
-Bing Visual Search results are `ImageTag` objects. Each tag contains a list of `ImageAction` objects. Each `ImageAction` contains a `Data` field, which is a list of values that depend on the type of action.
-
-You can print the various types with the following code:
-
-```csharp
-Console.WriteLine("\r\n" + "ActionType: " + i.ActionType + " -> WebSearchUrl: " + i.WebSearchUrl);
-```
-
-The complete application returns:
-
-|ActionType |URL |
-|||
-|PagesIncluding WebSearchURL | |
-|MoreSizes WebSearchURL | |
-|VisualSearch WebSearchURL | |
-|ImageById WebSearchURL | |
-|RelatedSearches WebSearchURL | |
-|Entity -> WebSearchUrl | https\://www.bing.com/cr?IG=E40D0E1A13404994ACB073504BC937A4&CID=03DCF882D7386A442137F49BD6596BEF&rd=1&h=BvvDoRtmZ35Xc_UZE4lZx6_eg7FHgcCkigU1D98NHQo&v=1&r=https%3a%2f%2fwww.bing.com%2fsearch%3fq%3dSatya%2bNadella&p=DevEx,5380.1 |
-|TopicResults -> WebSearchUrl | https\://www.bing.com/cr?IG=E40D0E1A13404994ACB073504BC937A4&CID=03DCF882D7386A442137F49BD6596BEF&rd=1&h=3QGtxPb3W9LemuHRxAlW4CW7XN4sPkUYCUynxAqI9zQ&v=1&r=https%3a%2f%2fwww.bing.com%2fdiscover%2fnadella%2bsatya&p=DevEx,5382.1 |
-|ImageResults -> WebSearchUrl | https\://www.bing.com/cr?IG=E40D0E1A13404994ACB073504BC937A4&CID=03DCF882D7386A442137F49BD6596BEF&rd=1&h=l-WNHO89Kkw69AmIGe2MhlUp6MxR6YsJszgOuM5sVLs&v=1&r=https%3a%2f%2fwww.bing.com%2fimages%2fsearch%3fq%3dSatya%2bNadella&p=DevEx,5384.1 |
-
-As shown above, the `Entity` ActionType contains a Bing search query that returns information about a recognizable person, place, or thing. The `TopicResults` and `ImageResults` types contain queries for related images. The URLs in the list link to Bing search results.
-
-## Get URLs for `PagesIncluding` `ActionType` images
-
-Getting the actual image URLs requires a cast that reads an `ActionType` as `ImageModuleAction`, which contains a `Data` element with a list of values. Each value is the URL of an image. The following casts the `PagesIncluding` action type to `ImageModuleAction` and reads the values:
-
-```csharp
- if (i.ActionType == "PagesIncluding")
- {
- foreach(ImageObject o in (i as ImageModuleAction).Data.Value)
- {
- Console.WriteLine("ContentURL: " + o.ContentUrl);
- }
- }
-```
-
-## Next steps
-> [!div class="nextstepaction"]
-> [Create a Visual Search single-page web app](tutorial-bing-visual-search-single-page-app.md)
-
-## See also
-> [What is the Bing Visual Search API?](./overview.md)
cognitive-services Tutorial Visual Search Image Upload https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/tutorial-visual-search-image-upload.md
- Title: "Tutorial: How to upload image using the Bing Visual Search API"-
-description: Learn how to upload an image to Bing, get insights about it, display the response.
------- Previously updated : 03/31/2020---
-# Tutorial: Upload images to the Bing Visual Search API
--
-The Bing Visual Search API enables you to search the web for images similar to ones you upload. Use this tutorial to create a web application that can send an image to the API, and display the insights it returns within the webpage. Note that this application does not adhere to all [Bing Use and Display Requirements](../bing-web-search/use-display-requirements.md) for using the API.
-
-You can find the full source code for this sample with additional error handling and annotations on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/Bing-Visual-Search/BingVisualSearchUploadImage.html).
-
-The tutorial app illustrates how to:
-
-> [!div class="checklist"]
-> * Upload an image to the Bing Visual Search API
-> * Display image search results in a web application
-> * Explore the different insights provided by the API
-
-## Prerequisites
--
-## Create and structure the webpage
-
-Create an HTML page that sends an image to the Bing Visual Search API, receives insights, and displays them. In your favorite editor or IDE, create a file named "uploaddemo.html". Add the following basic HTML structure to the file:
-
-```html
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Visual Search Upload Demo</title>
- </head>
-
- <body>
- </body>
-</html>
-```
-
-Divide the page into a request section, where the user provides all the information required for the request, and a response section where the insights are displayed. Add the following `<div>` tags to the `<body>`. The `<hr>` tag visually separates the request section from the response section:
-
-```html
-<div id="requestSection"></div>
-<hr />
-<div id="responseSection"></div>
-```
-
-Add a `<script>` tag to the `<head>` tag to contain the JavaScript for the application:
-
-```html
-<script>
-<\script>
-```
-
-## Get the upload file
-
-To let the user select an image to upload, the application uses the `<input>` tag with the type attribute set to `file`. The UI needs to make it clear that the application uses Bing to get the search results.
-
-Add the following `<div>` to the `requestSection` `<div>`. The file input accepts a single file of any image type (for example, .jpg, .gif, .png). The `onchange` event specifies the handler that's called when a user selects a file.
-
-The `<output>` tag is used to display a thumbnail of the selected image:
-
-```html
-<div>
- <p>Select image to get insights from Bing:
- <input type="file" accept="image/*" id="uploadImage" name="files[]" size=40 onchange="handleFileSelect('uploadImage')" />
- </p>
-
- <output id="thumbnail"></output>
-</div>
-```
-
-## Create a file handler
-
-Create a handler function that can read in the image you want to upload. While iterating through the files in the `FileList` object, the handler should make sure the selected file is an image file, and that its size is 1 MB or less. If the image is larger, you must reduce its size before uploading it. Lastly, the handler displays a thumbnail of the image:
-
-```javascript
-function handleFileSelect(selector) {
-
- var files = document.getElementById(selector).files; // A FileList object
-
- for (var i = 0, f; f = files[i]; i++) {
-
- // Ensure the file is an image file.
- if (!f.type.match('image.*')) {
- alert("Selected file must be an image file.");
- document.getElementById("uploadImage").value = null;
- continue;
- }
-
- // Image must be <= 1 MB and should be about 1500px.
- if (f.size > 1000000) {
- alert("Image must be less than 1 MB.");
- document.getElementById("uploadImage").value = null;
- continue;
- }
-
- var reader = new FileReader();
-
- // Capture the file information.
- reader.onload = (function(theFile) {
- return function(e) {
- var fileOutput = document.getElementById('thumbnail');
-
- if (fileOutput.childElementCount > 0) {
- fileOutput.removeChild(fileOutput.lastChild); // Remove the current pic, if it exists
- }
-
- // Render thumbnail.
- var span = document.createElement('span');
- span.innerHTML = ['<img class="thumb" src="', e.target.result,
- '" title="', escape(theFile.name), '"/>'].join('');
- fileOutput.insertBefore(span, null);
- };
- })(f);
-
- // Read in the image file as a data URL.
- reader.readAsDataURL(f);
- }
-}
-```
-
-## Add and store a subscription key
-
-The application requires a subscription key to make calls to the Bing Visual Search API. For this tutorial, you'll provide it in the UI. Add the following `<input>` tag (with the type attribute set to text) to the `<body>` just below the file's `<output>` tag:
-
-```html
- <div>
- <p>Subscription key:
- <input type="text" id="key" name="subscription" size=40 maxlength="32" />
- </p>
- </div>
-```
-
-With the image and the subscription key, you can make the call to Bing Visual Search to get insights about the image. In this tutorial, the call uses the default market (`en-us`) and safe search value (`moderate`).
-
-This application has an option to change these values. Add the following `<div>` below the subscription key `<div>`. The application uses a `<select>` tag to provide a drop-down list for market and safe search values. Both lists display the default value.
-
-```html
-<div>
- <p><a href="#" onclick="expandCollapse(options.id)">Query options</a></p>
-
- <div id="options" style="display:none">
- <p style="margin-left: 20px">Market:
- <select id="mkt">
- <option value="es-AR">Argentina (Spanish)</option>
- <option value="en-AU">Australia (English)</option>
- <option value="de-AT">Austria (German)</option>
- <option value="nl-BE">Belgium (Dutch)</option>
- <option value="fr-BE">Belgium (French)</option>
- <option value="pt-BR">Brazil (Portuguese)</option>
- <option value="en-CA">Canada (English)</option>
- <option value="fr-CA">Canada (French)</option>
- <option value="es-CL">Chile (Spanish)</option>
- <option value="da-DK">Denmark (Danish)</option>
- <option value="fi-FI">Finland (Finnish)</option>
- <option value="fr-FR">France (French)</option>
- <option value="de-DE">Germany (German)</option>
- <option value="zh-HK">Hong Kong SAR(Traditional Chinese)</option>
- <option value="en-IN">India (English)</option>
- <option value="en-ID">Indonesia (English)</option>
- <option value="it-IT">Italy (Italian)</option>
- <option value="ja-JP">Japan (Japanese)</option>
- <option value="ko-KR">Korea (Korean)</option>
- <option value="en-MY">Malaysia (English)</option>
- <option value="es-MX">Mexico (Spanish)</option>
- <option value="nl-NL">Netherlands (Dutch)</option>
- <option value="en-NZ">New Zealand (English)</option>
- <option value="no-NO">Norway (Norwegian)</option>
- <option value="zh-CN">People's Republic of China (Chinese)</option>
- <option value="pl-PL">Poland (Polish)</option>
- <option value="pt-PT">Portugal (Portuguese)</option>
- <option value="en-PH">Philippines (English)</option>
- <option value="ru-RU">Russia (Russian)</option>
- <option value="ar-SA">Saudi Arabia (Arabic)</option>
- <option value="en-ZA">South Africa (English)</option>
- <option value="es-ES">Spain (Spanish)</option>
- <option value="sv-SE">Sweden (Swedish)</option>
- <option value="fr-CH">Switzerland (French)</option>
- <option value="de-CH">Switzerland (German)</option>
- <option value="zh-TW">Taiwan (Traditional Chinese)</option>
- <option value="tr-TR">T├╝rkiye (Turkish)</option>
- <option value="en-GB">United Kingdom (English)</option>
- <option value="en-US" selected>United States (English)</option>
- <option value="es-US">United States (Spanish)</option>
- </select>
- </p>
- <p style="margin-left: 20px">Safe search:
- <select id="safesearch">
- <option value="moderate" selected>Moderate</option>
- <option value="strict">Strict</option>
- <option value="off">off</option>
- </select>
- </p>
- </div>
-</div>
-```
-
-## Add search options to the webpage
-
-The application hides the lists in a collapsible `<div>` that's controlled by the Query options link. When you click the Query options link, the `<div>` expands so you can see and modify the query options. If you click the Query options link again, the `<div>` collapses and is hidden. The following snippet shows the Query options link's `onclick` handler. The handler controls whether the `<div>` is expanded or collapsed. Add this handler to the `<script>` section. The handler is used by all collapsible `<div>` sections in the demo.
-
-```javascript
-// Contains the toggle state of divs.
-var divToggleMap = {}; // divToggleMap['foo'] = 0; // 1 = show, 0 = hide
--
-// Toggles between showing and hiding the specified div.
-function expandCollapse(divToToggle) {
- var div = document.getElementById(divToToggle);
-
- if (divToggleMap[divToToggle] == 1) { // if div is expanded
- div.style.display = "none";
- divToggleMap[divToToggle] = 0;
- }
- else { // if div is collapsed
- div.style.display = "inline-block";
- divToggleMap[divToToggle] = 1;
- }
-}
-```
-
-## Call the `onclick` handler
-
-Add the following `"Get insights"` button below the options `<div>` in the body. The button enables you to initiate the call. When the button is clicked, the cursor is changed to the spinning wait cursor, and the `onclick` handler is called.
-
-```html
-<p><input type="button" id="query" value="Get insights" onclick="document.body.style.cursor='wait'; handleQuery()" /></p>
-```
-
-Add the button's `onclick` handler, `handleQuery()` to the `<script>` tag.
-
-## Handle the query
-
-The handler `handleQuery()` ensures the subscription key is present and is 32 characters long, and that an image is selected. It also clears any insights from a previous query. Afterwards, it calls the `sendRequest()` function to make the call.
-
-```javascript
-function handleQuery() {
- var subscriptionKey = document.getElementById('key').value;
-
- // Make sure user provided a subscription key and image.
- // For this demo, the user provides the key but typically you'd
- // get it from secured storage.
- if (subscriptionKey.length !== 32) {
- alert("Subscription key length is not valid. Enter a valid key.");
- document.getElementById('key').focus();
- return;
- }
-
- var imagePath = document.getElementById('uploadImage').value;
-
- if (imagePath.length === 0)
- {
- alert("Please select an image to upload.");
- document.getElementById('uploadImage').focus();
- return;
- }
-
- var responseDiv = document.getElementById('responseSection');
-
- // Clear out the response from the last query.
- while (responseDiv.childElementCount > 0) {
- responseDiv.removeChild(responseDiv.lastChild);
- }
-
- // Send the request to Bing to get insights about the image.
- var f = document.getElementById('uploadImage').files[0];
- sendRequest(f, subscriptionKey);
-}
-```
-
-## Send the search request
-
-The `sendRequest()` function formats the endpoint URL, sets the `Ocp-Apim-Subscription-Key` header to the subscription key, appends the binary of the image to upload, specifies the response handler, and makes the call:
-
-```javascript
-function sendRequest(file, key) {
- var market = document.getElementById('mkt').value;
- var safeSearch = document.getElementById('safesearch').value;
- var baseUri = `https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch?mkt=${market}&safesearch=${safeSearch}`;
-
- var form = new FormData();
- form.append("image", file);
-
- var request = new XMLHttpRequest();
-
- request.open("POST", baseUri);
- request.setRequestHeader('Ocp-Apim-Subscription-Key', key);
- request.addEventListener('load', handleResponse);
- request.send(form);
-}
-```
-
-## Get and handle the API response
-
-The `handleResponse()` function handles the response from the call to Bing Visual Search. If the call succeeds, it parses the JSON response into the individual tags, which contain the insights. Next, it adds the search results to the page. The application then creates a collapsible `<div>` for each tag to manage how much data is displayed. Add the handler to the `<script>` section.
-
-```javascript
-function handleResponse() {
- if(this.status !== 200){
- alert("Error calling Bing Visual Search. See console log for details.");
- console.log(this.responseText);
- return;
- }
-
- var tags = parseResponse(JSON.parse(this.responseText));
- var h4 = document.createElement('h4');
- h4.textContent = 'Bing internet search results';
- document.getElementById('responseSection').appendChild(h4);
- buildTagSections(tags);
-
- document.body.style.cursor = 'default'; // reset the wait cursor set by query insights button
-}
-```
-
-### Parse the response
-
-The `parseResponse` function converts the JSON response into a dictionary object by iterating through `json.tags`.
-
-```javascript
-function parseResponse(json) {
- var dict = {};
-
- for (var i =0; i < json.tags.length; i++) {
- var tag = json.tags[i];
-
- if (tag.displayName === '') {
- dict['Default'] = JSON.stringify(tag);
- }
- else {
- dict[tag.displayName] = JSON.stringify(tag);
- }
- }
-
- return(dict);
-}
-```
-
-### Build a tag section
-
-The `buildTagSections()` function iterates through the parsed JSON tags and calls the `buildDiv()` function to build a `<div>` for each tag. Each tag is displayed as a link. When the link is clicked, the tag expands, showing the insights associated with the tag. Clicking the link again causes the section to collapse.
-
-```javascript
-function buildTagSections(tags) {
- for (var tag in tags) {
- if (tags.hasOwnProperty(tag)) {
- var tagSection = buildDiv(tags, tag);
- document.getElementById('responseSection').appendChild(tagSection);
- }
- }
-}
-
-function buildDiv(tags, tag) {
- var tagSection = document.createElement('div');
- tagSection.setAttribute('class', 'subSection');
-
- var link = document.createElement('a');
- link.setAttribute('href', '#');
- link.setAttribute('style', 'float: left;')
- link.text = tag;
- tagSection.appendChild(link);
-
- var contentDiv = document.createElement('div');
- contentDiv.setAttribute('id', tag);
- contentDiv.setAttribute('style', 'clear: left;')
- contentDiv.setAttribute('class', 'section');
- tagSection.appendChild(contentDiv);
-
- link.setAttribute('onclick', `expandCollapse("${tag}")`);
- divToggleMap[tag] = 0; // 1 = show, 0 = hide
-
- addDivContent(contentDiv, tag, tags[tag]);
-
- return tagSection;
-}
-```
-
-## Display the search results in the webpage
-
-The `buildDiv()` function calls the `addDivContent` function to build the contents of each tag's collapsible `<div>`.
-
-A tag's content includes the JSON from the response for the tag. Initially, only the first 100 characters of the JSON are shown, but you can click the JSON string to show all the JSON. If you click it again, the JSON string collapses back to 100 characters.
-
-Next, add the action types found in the tag. For each action type, call the appropriate functions to add its insights:
-
-```javascript
-function addDivContent(div, tag, json) {
-
- // Adds the first 100 characters of the json that contains
- // the tag's data. The user can click the text to show the
- // full json. They can click it again to collapse the json.
- var para = document.createElement('p');
- para.textContent = String(json).substr(0, 100) + '...';
- para.setAttribute('title', 'click to expand');
- para.setAttribute('style', 'cursor: pointer;')
- para.setAttribute('data-json', json);
- para.addEventListener('click', function(e) {
- var json = e.target.getAttribute('data-json');
-
- if (e.target.textContent.length <= 103) { // 100 + '...'
- e.target.textContent = json;
- para.setAttribute('title', 'click to collapse');
- }
- else {
- para.textContent = String(json).substr(0, 100) + '...';
- para.setAttribute('title', 'click to expand');
- }
- });
- div.appendChild(para);
-
- var parsedJson = JSON.parse(json);
-
- // Loop through all the actions in the tag and display them.
- for (var j = 0; j < parsedJson.actions.length; j++) {
- var action = parsedJson.actions[j];
-
- var subSectionDiv = document.createElement('div');
- subSectionDiv.setAttribute('class', 'subSection');
- div.appendChild(subSectionDiv);
-
- var h4 = document.createElement('h4');
- h4.innerHTML = action.actionType;
- subSectionDiv.appendChild(h4);
-
- if (action.actionType === 'ImageResults') {
- addImageWithWebSearchUrl(subSectionDiv, parsedJson.image, action);
- }
- else if (action.actionType === 'DocumentLevelSuggestions') {
- addRelatedSearches(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'RelatedSearches') {
- addRelatedSearches(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'PagesIncluding') {
- addPagesIncluding(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'VisualSearch') {
- addRelatedImages(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'Recipes') {
- addRecipes(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'ShoppingSources') {
- addShopping(subSectionDiv, action.data.offers);
- }
- else if (action.actionType === 'ProductVisualSearch') {
- addProducts(subSectionDiv, action.data.value);
- }
- else if (action.actionType === 'TextResults') {
- addTextResult(subSectionDiv, action);
- }
- else if (action.actionType === 'Entity') {
- addEntity(subSectionDiv, action);
- }
- }
-}
-```
-
-## Display insights for different actions
-
-The following functions display insights for different actions. The functions either provide a clickable image or clickable link that sends you to a webpage with more information about the image. This page is either hosted by Bing.com or the image's original website. Not all of the insights' data is displayed in this application. To see all the fields available for an insight, see the [Images - Visual Search](/rest/api/cognitiveservices/bingvisualsearch/images/visualsearch) reference.
-
-> [!NOTE]
-> There's a minimum amount of insight information you must display in the page. See the [Bing Search API use and display requirements](../bing-web-search/use-display-requirements.md) for more.
-
-### RelatedImages insights
-
-The `addRelatedImages()` function creates a title for each of the websites hosting the related image by iterating through the list of `RelatedImages` actions, and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
- function addRelatedImages(div, images) {
- var length = (images.length > 10) ? 10 : images.length;
-
- // Set the title to the website that hosts the image. The title displays
- // when the user hovers over the image.
-
- // Make the image clickable. If the user clicks the image, they're taken
- // to the image in Bing.com.
-
- for (var j = 0; j < length; j++) {
- var img = document.createElement('img');
- img.setAttribute('src', images[j].thumbnailUrl + '&w=120&h=120');
- img.setAttribute('style', 'margin: 20px 20px 0 0; cursor: pointer;');
- img.setAttribute('title', images[j].hostPageDisplayUrl);
- img.setAttribute('data-webSearchUrl', images[j].webSearchUrl)
-
- img.addEventListener('click', function(e) {
- var url = e.target.getAttribute('data-webSearchUrl');
- window.open(url, 'foo');
- })
-
- div.appendChild(img);
- }
- }
-```
-
-### PagesIncluding insights
-
-The `addPagesIncluding()` function creates a link for each of the websites hosting the uploaded image by iterating through the list of `PagesIncluding` actions, and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
-
- // Display links to the first 5 webpages that include the image.
- // TODO: Add 'more' link in case the user wants to see all of them.
- function addPagesIncluding(div, pages) {
- var length = (pages.length > 5) ? 5 : pages.length;
-
- for (var j = 0; j < length; j++) {
- var page = document.createElement('a');
- page.text = pages[j].name;
- page.setAttribute('href', pages[j].hostPageUrl);
- page.setAttribute('style', 'margin: 20px 20px 0 0');
- page.setAttribute('target', '_blank')
- div.appendChild(page);
-
- div.appendChild(document.createElement('br'));
- }
- }
-```
-
-### RelatedSearches insights
-
-The `addRelatedSearches()` function creates a link for the website hosting the image, by iterating through the list of `RelatedSearches` actions and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
-
- // Display the first 10 related searches. Include a link with the image
- // that when clicked, takes the user to Bing.com and displays the
- // related search results.
- // TODO: Add 'more' link in case the user wants to see all of them.
- function addRelatedSearches(div, relatedSearches) {
- var length = (relatedSearches.length > 10) ? 10 : relatedSearches.length;
-
- for (var j = 0; j < length; j++) {
- var childDiv = document.createElement('div');
- childDiv.setAttribute('class', 'stackLink');
- div.appendChild(childDiv);
-
- var img = document.createElement('img');
- img.setAttribute('src', relatedSearches[j].thumbnail.url + '&w=120&h=120');
- img.setAttribute('style', 'margin: 20px 20px 0 0;');
- childDiv.appendChild(img);
-
- var relatedSearch = document.createElement('a');
- relatedSearch.text = relatedSearches[j].displayText;
- relatedSearch.setAttribute('href', relatedSearches[j].webSearchUrl);
- relatedSearch.setAttribute('target', '_blank');
- childDiv.appendChild(relatedSearch);
-
- }
- }
-```
-
-### Recipes insights
-
-The `addRecipes()` function creates a link for each of recipes returned by iterating through the list of `Recipes` actions, and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
- // Display links to the first 10 recipes. Include the recipe's rating,
- // if available.
- // TODO: Add 'more' link in case the user wants to see all of them.
- function addRecipes(div, recipes) {
- var length = (recipes.length > 10) ? 10 : recipes.length;
-
- for (var j = 0; j < length; j++) {
- var para = document.createElement('p');
-
- var recipe = document.createElement('a');
- recipe.text = recipes[j].name;
- recipe.setAttribute('href', recipes[j].url);
- recipe.setAttribute('style', 'margin: 20px 20px 0 0');
- recipe.setAttribute('target', '_blank')
- para.appendChild(recipe);
-
- if (recipes[j].hasOwnProperty('aggregateRating')) {
- var span = document.createElement('span');
- span.textContent = 'rating: ' + recipes[j].aggregateRating.text;
- para.appendChild(span);
- }
-
- div.appendChild(para);
- }
- }
-```
-
-### Shopping insights
-
-The `addShopping()` function creates a link for any returned shopping results by iterating through the list of `RelatedImages` actions, and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
- // Display links for the first 10 shopping offers.
- // TODO: Add 'more' link in case the user wants to see all of them.
- function addShopping(div, offers) {
- var length = (offers.length > 10) ? 10 : offers.length;
-
- for (var j = 0; j < length; j++) {
- var para = document.createElement('p');
-
- var offer = document.createElement('a');
- offer.text = offers[j].name;
- offer.setAttribute('href', offers[j].url);
- offer.setAttribute('style', 'margin: 20px 20px 0 0');
- offer.setAttribute('target', '_blank')
- para.appendChild(offer);
-
- var span = document.createElement('span');
- span.textContent = 'by ' + offers[j].seller.name + ' | ' + offers[j].price + ' ' + offers[j].priceCurrency;
- para.appendChild(span);
-
- div.appendChild(para);
- }
- }
-```
-
-### Products insights
-
-The `addProducts()` function creates a link for any returned products results by iterating through the list of `Products` actions, and appending an `<img>` tag to the outside `<div>` for each:
-
-```javascript
-
- // Display the first 10 related products. Display a clickable image of the
- // product that takes the user to Bing.com search results for the product.
- // If there are any offers associated with the product, provide links to the offers.
- // TODO: Add 'more' link in case the user wants to see all of them.
- function addProducts(div, products) {
- var length = (products.length > 10) ? 10 : products.length;
-
- for (var j = 0; j < length; j++) {
- var childDiv = document.createElement('div');
- childDiv.setAttribute('class', 'stackLink');
- div.appendChild(childDiv);
-
- var img = document.createElement('img');
- img.setAttribute('src', products[j].thumbnailUrl + '&w=120&h=120');
- img.setAttribute('title', products[j].name);
- img.setAttribute('style', 'margin: 20px 20px 0 0; cursor: pointer;');
- img.setAttribute('data-webSearchUrl', products[j].webSearchUrl)
- img.addEventListener('click', function(e) {
- var url = e.target.getAttribute('data-webSearchUrl');
- window.open(url, 'foo');
- })
- childDiv.appendChild(img);
-
- if (products[j].insightsMetadata.hasOwnProperty('aggregateOffer')) {
- if (products[j].insightsMetadata.aggregateOffer.offerCount > 0) {
- var offers = products[j].insightsMetadata.aggregateOffer.offers;
-
- // Show all the offers. Not all markets provide links to offers.
- for (var i = 0; i < offers.length; i++) {
- var para = document.createElement('p');
-
- var offer = document.createElement('a');
- offer.text = offers[i].name;
- offer.setAttribute('href', offers[i].url);
- offer.setAttribute('style', 'margin: 20px 20px 0 0');
- offer.setAttribute('target', '_blank')
- para.appendChild(offer);
-
- var span = document.createElement('span');
- span.textContent = 'by ' + offers[i].seller.name + ' | ' + offers[i].price + ' ' + offers[i].priceCurrency;
- para.appendChild(span);
-
- childDiv.appendChild(para);
- }
- }
- else { // Otherwise, just show the lowest price that Bing found.
- var offer = products[j].insightsMetadata.aggregateOffer;
-
- var para = document.createElement('p');
- para.textContent = `${offer.name} | ${offer.lowPrice} ${offer.priceCurrency}`;
-
- childDiv.appendChild(para);
- }
- }
- }
- }
-```
-
-### TextResult insights
-
-The `addTextResult()` function displays any text that was recognized in the image:
-
-```javascript
-
- function addTextResult(div, action) {
- var text = document.createElement('p');
- text.textContent = action.displayName;
- div.appendChild(text);
- }
-```
-
-The `addEntity()` function displays a link that takes the user to Bing.com where they can get details about the entity type in the image, if any was detected:
-
-```javascript
- // If the image is of a person, the tag might include an entity
- // action type. Display a link that takes the user to Bing.com
- // where they can get details about the entity.
- function addEntity(div, action) {
- var entity = document.createElement('a');
- entity.text = action.displayName;
- entity.setAttribute('href', action.webSearchUrl);
- entity.setAttribute('style', 'margin: 20px 20px 0 0');
- entity.setAttribute('target', '_blank');
- div.appendChild(entity);
- }
-```
-
-The `addImageWithWebSearchUrl()` function displays a clickable image to the `<div>` that takes the user to search results on Bing.com:
-
-```javascript
- function addImageWithWebSearchUrl(div, image, action) {
- var img = document.createElement('img');
- img.setAttribute('src', image.thumbnailUrl + '&w=120&h=120');
- img.setAttribute('style', 'margin: 20px 20px 0 0; cursor: pointer;');
- img.setAttribute('data-webSearchUrl', action.webSearchUrl);
- img.addEventListener('click', function(e) {
- var url = e.target.getAttribute('data-webSearchUrl');
- window.open(url, 'foo');
- })
- div.appendChild(img);
- }
-
-```
-
-## Add a CSS style
-
-Add the following `<style>` section to the `<head>` tag to organize the layout of the webpage:
-
-```html
- <style>
-
- .thumb {
- height: 75px;
- border: 1px solid #000;
- }
-
- .stackLink {
- width:180px;
- min-height:210px;
- display:inline-block;
- }
- .stackLink a {
- float:left;
- clear:left;
- }
-
- .section {
- float:left;
- display:none;
- }
-
- .subSection {
- clear:left;
- float:left;
- }
-
- </style>
-```
-
-## Next steps
-
->[!div class="nextstepaction"]
-> [Tutorial: Find similar images from previous searches using ImageInsightsToken](./tutorial-visual-search-insights-token.md)
cognitive-services Tutorial Visual Search Insights Token https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/tutorial-visual-search-insights-token.md
- Title: "Find similar images from previous searches using image insights tokens and the Bing Visual Search API"-
-description: Use the Bing Visual Search client library to get URLs of images from previous searches.
------- Previously updated : 03/31/2020---
-# Tutorial: Find similar images from previous searches using an image insights token
--
-The Visual Search client library enables you to find images online from previous searches that return an `ImageInsightsToken`. This application gets an `ImageInsightsToken` and uses the token in a subsequent search. It then sends the `ImageInsightsToken` to Bing and returns results that include Bing Search URLs and URLs of similar images found online.
-
-The full source code for this tutorial can be found with additional error handling and annotations on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/Tutorials/Bing-Visual-Search/BingVisualSearchInsightsTokens.cs).
-
-## Prerequisites
-
-* Any edition of [Visual Studio 2019](https://www.visualstudio.com/downloads/).
-* If you are using Linux/MacOS, you can run this application using [Mono](https://www.mono-project.com/).
-* The NuGet Visual Search and Image Search packages.
- - From the Solution Explorer in Visual Studio, right-click on your project and select **Manage NuGet Packages** from the menu. Install the `Microsoft.Azure.CognitiveServices.Search.CustomSearch` package, and the `Microsoft.Azure.CognitiveServices.Search.ImageSearch` package. Installing the NuGet packages also installs the following:
- - Microsoft.Rest.ClientRuntime
- - Microsoft.Rest.ClientRuntime.Azure
- - Newtonsoft.Json
---
-## Get the ImageInsightsToken from the Bing Image Search client library
-
-This application uses an `ImageInsightsToken` obtained through the [Bing Image Search client library](../bing-image-search/quickstarts/client-libraries.md?pivots=programming-language-csharp%253fpivots%253dprogramming-language-csharp). In a new C# console application, create a client to call the API using `ImageSearchClient()`. Then use `SearchAsync()` with your query:
-
-```csharp
-var client = new ImageSearchClient(new Microsoft.Azure.CognitiveServices.Search.ImageSearch.ApiKeyServiceClientCredentials(subKey));
-var imageResults = client.Images.SearchAsync(query: "canadian rockies").Result;
-Console.WriteLine("Search images for query \"canadian rockies\"");
-```
-
-Store the first search result using `imageResults.Value.First()`, and then store the image insight's `ImageInsightsToken`.
-
-```csharp
-String insightTok = "None";
-if (imageResults.Value.Count > 0)
-{
- var firstImageResult = imageResults.Value.First();
- insightTok = firstImageResult.ImageInsightsToken;
-}
-else
-{
- insightTok = "None found";
- Console.WriteLine("Couldn't find image results!");
-}
-```
-
-This `ImageInsightsToken` is sent to Bing Visual Search in a request.
-
-## Add the ImageInsightsToken to a Visual Search request
-
-Specify the `ImageInsightsToken` for a Visual Search request by creating an `ImageInfo` object from the `ImageInsightsToken` contained in responses from Bing Visual Search.
-
-```csharp
-ImageInfo ImageInfo = new ImageInfo(imageInsightsToken: insightsTok);
-```
-
-## Use Bing Visual Search to find images from an ImageInsightsToken
-
-The `VisualSearchRequest` object contains information about the image in `ImageInfo` to be searched. The `VisualSearchMethodAsync()` method gets the results. You don't have to provide an image binary, as the image is represented by the token.
-
-```csharp
-VisualSearchRequest VisualSearchRequest = new VisualSearchRequest(ImageInfo);
-
-var visualSearchResults = client.Images.VisualSearchMethodAsync(knowledgeRequest: VisualSearchRequest).Result;
-
-```
-
-## Iterate through the Visual Search results
-
-Visual Search results are `ImageTag` objects. Each tag contains a list of `ImageAction` objects. Each `ImageAction` contains a `Data` field, which is a list of values that depend on the type of action. You can iterate through the `ImageTag` objects in `visualSearchResults.Tags`, for instance, and get the `ImageAction` tag within it. The sample below prints the details of `PagesIncluding` actions:
-
-```csharp
-if (visualSearchResults.Tags.Count > 0)
-{
- // List of tags
- foreach (ImageTag t in visualSearchResults.Tags)
- {
- foreach (ImageAction i in t.Actions)
- {
- Console.WriteLine("\r\n" + "ActionType: " + i.ActionType + " WebSearchURL: " + i.WebSearchUrl);
-
- if (i.ActionType == "PagesIncluding")
- {
- foreach (ImageObject o in (i as ImageModuleAction).Data.Value)
- {
- Console.WriteLine("ContentURL: " + o.ContentUrl);
- }
- }
- }
- }
-}
-```
-
-### PagesIncluding ActionTypes
-
-Getting the actual image URLs from action types requires a cast that reads an `ActionType` as `ImageModuleAction`, which contains a `Data` element with a list of values. Each value is the URL of an image. The following casts the `PagesIncluding` action type to `ImageModuleAction` and reads the values:
-
-```csharp
- if (i.ActionType == "PagesIncluding")
- {
- foreach(ImageObject o in (i as ImageModuleAction).Data.Value)
- {
- Console.WriteLine("ContentURL: " + o.ContentUrl);
- }
- }
-```
-
-For more information about these data types, see [Images - Visual Search](/rest/api/cognitiveservices/bingvisualsearch/images/visualsearch).
-
-## Returned URLs
-
-The complete application returns the following URLs:
-
-|ActionType |URL |
-|||
-|MoreSizes -> WebSearchUrl | |
-|VisualSearch -> WebSearchUrl | |
-|ImageById -> WebSearchUrl | |
-|RelatedSearches -> WebSearchUrl: | |
-|DocumentLevelSuggestions -> WebSearchUrl: | |
-|TopicResults -> WebSearchUrl | https:\//www.bing.com/cr?IG=3E32CC6CA5934FBBA14ABC3B2E4651F9&CID=1BA795A21EAF6A63175699B71FC36B7C&rd=1&h=BcQifmzdKFyyBusjLxxgO42kzq1Geh7RucVVqvH-900&v=1&r=https%3a%2f%2fwww.bing.com%2fdiscover%2fcanadian%2brocky&p=DevEx,5823.1 |
-|ImageResults -> WebSearchUrl | https:\//www.bing.com/cr?IG=3E32CC6CA5934FBBA14ABC3B2E4651F9&CID=1BA795A21EAF6A63175699B71FC36B7C&rd=1&h=PV9GzMFOI0AHZp2gKeWJ8DcveSDRE3fP2jHDKMpJSU8&v=1&r=https%3a%2f%2fwww.bing.com%2fimages%2fsearch%3fq%3doutdoor&p=DevEx,5831.1 |
-
-As shown above, the `TopicResults` and `ImageResults` types contain queries for related images. The URLs link to Bing search results.
-
-## Next steps
-
-> [!div class="nextstepaction"]
-> [Create a Visual Search single-page web app](tutorial-bing-visual-search-single-page-app.md)
cognitive-services Use Insights Token https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cognitive-services/bing-visual-search/use-insights-token.md
- Title: Using insights token - Bing Visual Search-
-description: Shows how to use an image's insight token with Bing Visual Search API to get insights about an image.
------- Previously updated : 4/26/2019---
-# Use an insights token to get insights for an image
--
-Bing Visual Search API returns information about an image that you provide. You can provide the image by using the URL of the image, an insights token, or by uploading an image. For information about these options, see [What is Bing Visual Search API?](overview.md). This article demonstrates using an insights token. For examples that demonstrate how to upload an image to get insights, see the quickstarts:
-
-* ([C#](quickstarts/csharp.md)
-
-* [Java](quickstarts/java.md)
-
-* [Node.js](quickstarts/nodejs.md)
-
-* [Python](quickstarts/python.md)).
-
-If you send Bing Visual Search an image token or URL, the following shows the form data you must include in the body of the POST. The form data must include the `Content-Disposition` header, and you must set its `name` parameter to "knowledgeRequest". For details about the `imageInfo` object, see the request:
-
-```json
-{
- "imageInfo" : {
- "url" : "",
- "imageInsightsToken" : "",
- "cropArea" : {
- "top" : 0.1,
- "left" : 0.5,
- "right" : 0.9,
- "bottom" : 0.9
- }
- },
- "knowledgeRequest" : {
- "filters" : {
- "site" : ""
- }
- }
-}
-```
-
-The examples in this article show how to use the insights token. You get the insights token from an `Image` object in an /images/search API response. For information about getting the insights token, see [What is the Bing Image Search API?](../bing-image-search/overview.md).
-
-```
boundary_1234-abcd
-Content-Disposition: form-data; name="knowledgeRequest"
-
-{
- "imageInfo" : {
- "imageInsightsToken" : "ccid_tmaGQ2eU*mid_D12339146CFEDF3D40...",
- }
-}
-boundary_1234-abcd--
-```
-
-For examples that use the insights token, see:
-
-* [C#](#use-with-c)
-
-* [Java](#use-with-java)
-
-* [Node.js](#use-with-nodejs)
-
-* [Python](#use-with-python)
-
-## Use with C#
-
-### C# prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-* Any version of [Visual Studio 2019](https://www.visualstudio.com/downloads/) to get this code running on Windows.
-
-## Run the application
-
-To run this application, follow these steps:
-
-1. Create a console solution in Visual Studio.
-2. Replace the contents of Program.cs with the code shown in this quickstart.
-3. Replace the `accessKey` value with your subscription key.
-4. Replace the `insightsToken` value with an insights token from an /images/search response.
-5. Run the program.
-
-```csharp
-using System;
-using System.Text;
-using System.Net;
-using System.IO;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading.Tasks;
-using System.Threading;
-
-namespace VisualSearchInsightsToken
-{
-
- class Program
- {
- // Replace the accessKey string value with your valid subscription key.
- const string accessKey = "<yoursubscriptionkeygoeshere>";
-
- const string uriBase = "https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch";
-
- // Update with an insights token from an image object that the /images/search API endpoint returns.
- static string insightsToken = @"ccid_tmaGQ2eU*mid_D12339146CFEDF3D409CC7A66D2C98D0D71904D4*simid_608022145667564759*thid_OIP.tmaGQ2eUI1yq3yll!_jn9kwHaFZ";
-
- static string BoundaryTemplate = "batch_{0}";
-
- static void Main(string[] args)
- {
- try {
- Console.WriteLine("Getting image insights using insights token: " + insightsToken);
-
- var knowledgeRequest = "{\"imageInfo\" : {\"imageInsightsToken\" : \"" + insightsToken + "\"}}";
- var boundary = string.Format(BoundaryTemplate, Guid.NewGuid());
-
- var json = BingVisualSearch(knowledgeRequest, boundary, uriBase, accessKey);
-
- Console.WriteLine("\nJSON Response:\n");
- Console.WriteLine(JsonPrettyPrint(json));
-
- Console.Write("\nPress Enter to exit ");
- Console.ReadLine();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
-
- }
--
- /// <summary>
- /// Calls the Bing visual search endpoint and returns the JSON response with insights.
- /// </summary>
- static string BingVisualSearch(string knowledgeRequest, string boundary, string uri, string subscriptionKey)
- {
- var requestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
- requestMessage.Headers.Add("Ocp-Apim-Subscription-Key", accessKey);
-
- var content = new MultipartFormDataContent(boundary);
- content.Add(new StringContent(knowledgeRequest, Encoding.UTF8, "application/json"), "knowledgeRequest");
- requestMessage.Content = content;
-
- var httpClient = new HttpClient();
-
- Task<HttpResponseMessage> httpRequest = httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseContentRead, CancellationToken.None);
- HttpResponseMessage httpResponse = httpRequest.Result;
- HttpStatusCode statusCode = httpResponse.StatusCode;
- HttpContent responseContent = httpResponse.Content;
-
- string json = null;
-
- if (responseContent != null)
- {
- Task<String> stringContentsTask = responseContent.ReadAsStringAsync();
- json = stringContentsTask.Result;
- }
--
- return json;
- }
--
- /// <summary>
- /// Formats the given JSON string by adding line breaks and indents.
- /// </summary>
- /// <param name="json">The raw JSON string to format.</param>
- /// <returns>The formatted JSON string.</returns>
- static string JsonPrettyPrint(string json)
- {
- if (string.IsNullOrEmpty(json))
- return string.Empty;
-
- json = json.Replace(Environment.NewLine, "").Replace("\t", "");
-
- StringBuilder sb = new StringBuilder();
- bool quote = false;
- bool ignore = false;
- char last = ' ';
- int offset = 0;
- int indentLength = 2;
-
- foreach (char ch in json)
- {
- switch (ch)
- {
- case '"':
- if (!ignore) quote = !quote;
- break;
- case '\\':
- if (quote && last != '\\') ignore = true;
- break;
- }
-
- if (quote)
- {
- sb.Append(ch);
- if (last == '\\' && ignore) ignore = false;
- }
- else
- {
- switch (ch)
- {
- case '{':
- case '[':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', ++offset * indentLength));
- break;
- case '}':
- case ']':
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', --offset * indentLength));
- sb.Append(ch);
- break;
- case ',':
- sb.Append(ch);
- sb.Append(Environment.NewLine);
- sb.Append(new string(' ', offset * indentLength));
- break;
- case ':':
- sb.Append(ch);
- sb.Append(' ');
- break;
- default:
- if (quote || ch != ' ') sb.Append(ch);
- break;
- }
- }
- last = ch;
- }
-
- return sb.ToString().Trim();
- }
- }
-}
-```
-
-## Use with Java
-
-### Java prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-* [JDK 7 or 8](/azure/developer/java/fundamentals/java-support-on-azure) to compile and run this code. You can use a Java IDE if you have a favorite, but a text editor will suffice.
--
-## Run the Java application
-
-To run this application, follow these steps:
-
-1. Download or install the [Gson Java library](https://github.com/google/gson). You can also obtain Gson via Maven.
-2. Create a new Java project in your favorite IDE or editor.
-3. Add the provided code in a file named `VisualSearch.java`.
-4. Replace the `subscriptionKey` value with your subscription key.
-5. Run the program.
-
-```java
-package insightstoken;
-
-import java.util.*;
-import java.io.*;
---
-/*
- * Gson: https://github.com/google/gson
- * Maven info:
- * groupId: com.google.code.gson
- * artifactId: gson
- * version: 2.8.2
- *
- * Once you have compiled or downloaded gson-2.8.2.jar, assuming you have placed it in the
- * same folder as this file (BingImageSearch.java), you can compile and run this program at
- * the command line as follows.
- *
- * javac BingImageSearch.java -classpath .;gson-2.8.2.jar -encoding UTF-8
- * java -cp .;gson-2.8.2.jar BingImageSearch
- */
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-// https://hc.apache.org/downloads.cgi (HttpComponents Downloads) HttpClient 4.5.5
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
--
-public class InsightsToken {
-
-
- static String endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch";
- static String subscriptionKey = "<yoursubscriptionkeygoeshere>";
-
- // To get an insights, call the /images/search endpoint. Get the token from
- // the imageInsightsToken field in the Image object.
- static String insightsToken = "ccid_tmaGQ2eU*mid_D12339146CFEDF3D409CC7A66D2C98D0D71904D4*simid_608022145667564759*thid_OIP.tmaGQ2eUI1yq3yll!_jn9kwHaFZ";
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- CloseableHttpClient httpClient = HttpClientBuilder.create().build();
-
- String knowledgeRequest = "{\"imageInfo\" : {\"imageInsightsToken\" : \"" + insightsToken + "\"}}";
-
- try {
- HttpEntity entity = MultipartEntityBuilder
- .create()
- .addTextBody("knowledgeRequest", knowledgeRequest, ContentType.create("application/json"))
- .build();
-
- HttpPost httpPost = new HttpPost(endpoint);
- httpPost.setHeader("Ocp-Apim-Subscription-Key", subscriptionKey);
- httpPost.setEntity(entity);
- HttpResponse response = httpClient.execute(httpPost);
-
- InputStream stream = response.getEntity().getContent();
- String json = new Scanner(stream).useDelimiter("\\A").next();
-
- System.out.println("\nJSON Response:\n");
- System.out.println(prettify(json));
- }
- catch (IOException e)
- {
- e.printStackTrace(System.out);
- System.exit(1);
- }
- catch (Exception e) {
- e.printStackTrace(System.out);
- System.exit(1);
- }
- }
-
- // pretty-printer for JSON; uses GSON parser to parse and re-serialize
- public static String prettify(String json_text) {
- JsonParser parser = new JsonParser();
- JsonObject json = parser.parse(json_text).getAsJsonObject();
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- return gson.toJson(json);
- }
--
-}
-```
-
-## Use with Node.js
-
-### Node.js prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-* You must have [Node.js 6](https://nodejs.org/en/download/) to run this code.
-
-## Run the JavaScript application
-
-To run this application, follow these steps:
-
-1. Create a folder for your project (or use your favorite IDE or editor).
-2. From a command prompt or terminal, navigate to the folder you just created.
-3. Install the request modules:
-
- ```
- npm install request
- ```
-1. Install the form-data modules:
- ```
- npm install form-data
- ```
-1. Create a file named GetVisualInsights.js and add the following code to it.
-1. Replace the `subscriptionKey` value with your subscription key.
-1. Run the program.
- ```
- node GetVisualInsights.js
- ```
-
-```javascript
-var request = require('request');
-var FormData = require('form-data');
-
-var baseUri = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch';
-var subscriptionKey = '<yoursubscriptionkeygoeshere>';
-
-// To get an insights, call the /images/search endpoint. Get the token from
-// the imageInsightsToken field in the Image object.
-var insightsToken = "ccid_tmaGQ2eU*mid_D12339146CFEDF3D409CC7A66D2C98D0D71904D4*simid_608022145667564759*thid_OIP.tmaGQ2eUI1yq3yll!_jn9kwHaFZ";
-
-var knowledgeRequest = {
- "imageInfo" : {
- "imageInsightsToken" : insightsToken
- }
-};
-
-var form = new FormData();
-form.append('knowledgeRequest', JSON.stringify(knowledgeRequest));
-
-form.getLength(function(err, length){
- if (err) {
- return requestCallback(err);
- }
-
- var r = request.post(baseUri, requestCallback);
- r._form = form;
- r.setHeader('Ocp-Apim-Subscription-Key', subscriptionKey);
-});
-
-function requestCallback(err, res, body) {
- console.log(JSON.stringify(JSON.parse(body), null, ' '))
-}
-```
-
-## Use with Python
-
-### Python prerequisites
-
-* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
-* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7" title="Create a Bing Search resource" target="_blank">create a Bing Search resource </a> in the Azure portal to get your key and endpoint. After it deploys, click **Go to resource**.
-* You must have [Python 3](https://www.python.org/) to run this code.
-
-## Run the Python application
-
-To run this application, follow these steps:
-
-1. Create a new Python project in your favorite IDE or editor.
-2. Create a file named visualsearch.py and add the code shown in this quickstart.
-3. Replace the `SUBSCRIPTION_KEY` value with your subscription key.
-4. Run the program.
-
-```python
-"""Bing Visual Search example"""
-
-# Download and install Python at https://www.python.org/
-
-# Run the following in a command console window
-
-# pip3 install requests
-
-import requests
-import json
-
-BASE_URI = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch'
-
-SUBSCRIPTION_KEY = '<yoursubscriptionkeygoeshere>'
-
-HEADERS = {'Ocp-Apim-Subscription-Key': SUBSCRIPTION_KEY}
-
-# To get an insights, call the /images/search endpoint. Get the token from
-
-# the imageInsightsToken field in the Image object.
-
-insightsToken = 'ccid_tmaGQ2eU*mid_D12339146CFEDF3D409CC7A66D2C98D0D71904D4*simid_608022145667564759*thid_OIP.tmaGQ2eUI1yq3yll!_jn9kwHaFZ'
-
-formData = '{"imageInfo":{"imageInsightsToken":"' + insightsToken + '"}}'
--
-file = {'knowledgeRequest': (None, formData)}
--
-def main():
-
- try:
- response = requests.post(BASE_URI, headers=HEADERS, files=file)
- response.raise_for_status()
- print_json(response.json())
-
- except Exception as ex:
- raise ex
--
-def print_json(obj):
- """Print the object as json"""
- print(json.dumps(obj, sort_keys=True, indent=2, separators=(',', ': ')))
--
-# Main execution
-
-if __name__ == '__main__':
- main()
-```
-
-## Next steps
-
-[Create a Visual Search single-page web app](tutorial-bing-visual-search-single-page-app.md)
-[What is the Bing Visual Search API?](overview.md)
-[Try Azure AI services](https://aka.ms/bingvisualsearchtryforfree)
-[Images - Visual Search](/rest/api/cognitiveservices/bingvisualsearch/images/visualsearch)
communication-services Email Logs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/communication-services/concepts/analytics/logs/email-logs.md
Azure Communications Services provides monitoring and analytics features via [Az
The following are instructions for configuring your Azure Monitor resource to start creating logs and metrics for your Communications Services. For detailed documentation about using Diagnostic Settings across all Azure resources, see: [Enable logging in Diagnostic Settings](../enable-logging.md) > [!NOTE]
-> Under diagnostic setting name please select select ΓÇ£Email Service Delivery Status Update LogsΓÇ¥, "Email Service Send Mail logs", "Email Service User Engagement Logs" to enable the logs for emails
+> Under diagnostic setting name please select ΓÇ£Email Service Delivery Status Update LogsΓÇ¥, "Email Service Send Mail logs", "Email Service User Engagement Logs" to enable the logs for emails
> > :::image type="content" source="..\logs\email-diagnostic-log.png" alt-text="Screenshot of diagnostic settings for Email.":::
communication-services Bring Your Own Storage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/communication-services/quickstarts/call-automation/call-recording/bring-your-own-storage.md
Refer to this example of the event schema.
"recordingStorageInfo": { "recordingChunks": [ {
- "documentId": "string", // Document id for for the recording chunk
+ "documentId": "string", // Document id for the recording chunk
"contentLocation": "string", //Azure Communication Services URL where the content is located "metadataLocation": "string", // Azure Communication Services URL where the metadata for this chunk is located "deleteLocation": "string", // Azure Communication Services URL to use to delete all content, including recording and metadata.
communication-services Web Calling Sample https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/communication-services/samples/web-calling-sample.md
You're now ready to begin placing calls using your Communication Services resour
The Communication Services web Calling SDK allows for **1:1**, **1:N**, and **group** calling.
-For 1:1 or 1:N outgoing calls, you can specify multiple Communication Services User Identities to call using comma-separated values. You can can also specify traditional (PSTN) phone numbers to call using comma-separated values.
+For 1:1 or 1:N outgoing calls, you can specify multiple Communication Services User Identities to call using comma-separated values. You can also specify traditional (PSTN) phone numbers to call using comma-separated values.
When calling PSTN phone numbers, specify your alternate caller ID. Click on the "Place call" button to place an outgoing call:
communication-services File Sharing Tutorial Acs Chat https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/communication-services/tutorials/file-sharing-tutorial-acs-chat.md
The UI Library Chat Composite supports file sharing by enabling developers to pa
The diagram shows a typical flow of a file sharing scenario for both upload and download. The section marked as `Client Managed` shows the building blocks where developers need to have them implemented.
-![Filesharing typical flow](./media/filesharing-typical-flow.png "Diagram that shows the the file sharing typical flow.")
+![Filesharing typical flow](./media/filesharing-typical-flow.png "Diagram that shows the file sharing typical flow.")
## Set up file storage using Azure Blob
connectors Connectors Azure Monitor Logs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/connectors/connectors-azure-monitor-logs.md
For technical information about this connector's operations, see the [connector'
> > | Action | Description | > |--|-|
-> | [Run query and and list results](/connectors/azuremonitorlogs/#run-query-and-list-results) | Returns each row as its own object. Use this action when you want to work with each row separately in the rest of the workflow. The action is typically followed by a [For each action](../logic-apps/logic-apps-control-flow-loops.md). |
-> | [Run query and and visualize results](/connectors/azuremonitorlogs/#run-query-and-visualize-results) | Returns a JPG file that depicts the query result set. This action lets you use the result set in the rest of the workflow by sending the results in an email, for example. The action only returns a JPG file if the query returns results. |
+> | [Run query and list results](/connectors/azuremonitorlogs/#run-query-and-list-results) | Returns each row as its own object. Use this action when you want to work with each row separately in the rest of the workflow. The action is typically followed by a [For each action](../logic-apps/logic-apps-control-flow-loops.md). |
+> | [Run query and visualize results](/connectors/azuremonitorlogs/#run-query-and-visualize-results) | Returns a JPG file that depicts the query result set. This action lets you use the result set in the rest of the workflow by sending the results in an email, for example. The action only returns a JPG file if the query returns results. |
## Limitations
container-apps Containers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/container-apps/containers.md
The following code is an example of the `containers` array in the [`properties.t
| `args` | Start up command arguments. | Entries in the array are joined together to create a parameter list to pass to the startup command. | | `env` | An array of key/value pairs that define environment variables. | Use `secretRef` instead of the `value` field to refer to a secret. | | `resources.cpu` | The number of CPUs allocated to the container. | With the [Consumption plan](plans.md), values must adhere to the following rules:<br><br>ΓÇó greater than zero<br>ΓÇó less than or equal to 2<br>ΓÇó can be any decimal number (with a max of two decimal places)<br><br> For example, `1.25` is valid, but `1.555` is invalid.<br> The default is 0.25 CPUs per container.<br><br>When you use the Consumption workload profile on the Dedicated plan, the same rules apply, except CPUs must be less than or equal to 4.<br><br>When you use the [Dedicated plan](plans.md), the maximum CPUs must be less than or equal to the number of cores available in the profile where the container app is running. |
-| `resources.memory` | The amount of RAM allocated to the container. | With the [Consumption plan](plans.md), values must adhere to the following rules:<br><br>ΓÇó greater than zero<br>ΓÇó less than or equal to `4Gi`<br>ΓÇó can be any decimal number (with a max of two decimal places)<br><br>For example, `1.25Gi` is valid, but `1.555Gi` is invalid.<br>The default is `0.5Gi` per container.<br><br>When you use the the Consumption workload on the [Dedicated plan](plans.md), the same rules apply except memory must be less than or equal to `8Gi`.<br><br>When you use the Dedicated plan, the maximum memory must be less than or equal to the amount of memory available in the profile where the container app is running. |
+| `resources.memory` | The amount of RAM allocated to the container. | With the [Consumption plan](plans.md), values must adhere to the following rules:<br><br>ΓÇó greater than zero<br>ΓÇó less than or equal to `4Gi`<br>ΓÇó can be any decimal number (with a max of two decimal places)<br><br>For example, `1.25Gi` is valid, but `1.555Gi` is invalid.<br>The default is `0.5Gi` per container.<br><br>When you use the Consumption workload on the [Dedicated plan](plans.md), the same rules apply except memory must be less than or equal to `8Gi`.<br><br>When you use the Dedicated plan, the maximum memory must be less than or equal to the amount of memory available in the profile where the container app is running. |
| `volumeMounts` | An array of volume mount definitions. | You can define a temporary volume or multiple permanent storage volumes for your container. For more information about storage volumes, see [Use storage mounts in Azure Container Apps](storage-mounts.md).| | `probes`| An array of health probes enabled in the container. | This feature is based on Kubernetes health probes. For more information about probes settings, see [Health probes in Azure Container Apps](health-probes.md).|
container-apps Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/container-apps/policy-reference.md
Title: Built-in policy definitions for Azure Container Apps
description: Lists Azure Policy built-in policy definitions for Azure Container Apps. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
container-instances Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/container-instances/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Container Instances
container-registry Container Registry Transfer Cli https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/container-registry/container-registry-transfer-cli.md
az acr repository show-tags --name $MyRegistry --repository $MyRepository
> [!Note] > Source Trigger will only import blobs that have a Last Modified time within the last 60 days. If you intend to use Source Trigger to import blobs older than that, please refresh the Last Modified time of the blobs by add blob metadata to them or else import them with manually created pipeline runs.
-If you did use the the `--source-trigger-enabled False` parameter when creating your ImportPipeline, you will need to create a PipelineRun manually, as shown in the following section.
+If you did use the `--source-trigger-enabled False` parameter when creating your ImportPipeline, you will need to create a PipelineRun manually, as shown in the following section.
## Create PipelineRun for import with the acrtransfer Az CLI extension
container-registry Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/container-registry/policy-reference.md
Title: Built-in policy definitions for Azure Container Registry
description: Lists Azure Policy built-in policy definitions for Azure Container Registry. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
cosmos-db Introduction https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/introduction.md
Title: Introduction
+ Title: Azure Cosmos DB ΓÇô Unified AI Database
-description: Azure Cosmos DB is a global multi-model database built for speed, elasticity and availability with native support for NoSQL and relational data.
+description: Azure Cosmos DB is a global multi-model database and ideal database for AI applications requiring speed, elasticity and availability with native support for NoSQL and relational data.
Previously updated : 10/31/2023 Last updated : 11/02/2023 adobe-target: true
cosmos-db How To Configure Capabilities https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/mongodb/how-to-configure-capabilities.md
Capabilities are features that can be added or removed to your API for MongoDB a
| `EnableMongoRetryableWrites` | Enables support for retryable writes on the account. | Yes | | `EnableMongo16MBDocumentSupport` | Enables support for inserting documents up to 16 MB in size. | No | | `EnableUniqueCompoundNestedDocs` | Enables support for compound and unique indexes on nested fields if the nested field isn't an array. | No |
-| `EnableTtlOnCustomPath` | Provides the ability to set a custom Time to Live (TTL) on any one field in a collection. Setting TTL on partial unique index property is not supported.┬╣ | No |
+| `EnableTtlOnCustomPath` | Provides the ability to set a custom Time to Live (TTL) on any one field in a collection. Setting TTL on partial unique index property is not supported. ┬╣ | No |
| `EnablePartialUniqueIndex` | Enables support for a unique partial index, so you have more flexibility to specify exactly which fields in documents you'd like to index. | No | | `EnableUniqueIndexReIndex` | Enables support for unique index re-indexing for Cosmos DB for MongoDB RU. ┬╣ | No |
+> [!NOTE]
+>
+> ┬╣ This capability cannot be enabled on an Azure Cosmos DB for MongoDB accounts with continuous backup.
+>
+ ## Enable a capability 1. Retrieve your existing account capabilities by using [az cosmosdb show](/cli/azure/cosmosdb#az-cosmosdb-show):
cosmos-db Monitor Normalized Request Units https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/monitor-normalized-request-units.md
CDBPartitionKeyRUConsumption
In general, for a production workload using autoscale, if you see between 1-5% of requests with 429s, and your end to end latency is acceptable, this is a healthy sign that the RU/s are being fully utilized. Even if the normalized RU consumption occasionally reaches 100% and autoscale does not scale up to the max RU/s, this is ok because the overall rate of 429s is low. No action is required. > [!TIP]
-> If you are using autoscale and find that normalized RU consumption is consistently 100% and you are consistently scaled to the max RU/s, this is a sign that using manual throughput may be more cost-effective. To determine whether autoscale or manual throughput is best for your workload, see [how to choose between standard (manual) and autoscale provisioned throughput](how-to-choose-offer.md). Azure Cosmos DB also sends [Azure Advisor recommendations](../advisor/advisor-reference-cost-recommendations.md#configure-manual-throughput-instead-of-autoscale-on-your-azure-cosmos-db-database-or-container) based on your workload patterns to to recommend either manual or autoscale throughput.
+> If you are using autoscale and find that normalized RU consumption is consistently 100% and you are consistently scaled to the max RU/s, this is a sign that using manual throughput may be more cost-effective. To determine whether autoscale or manual throughput is best for your workload, see [how to choose between standard (manual) and autoscale provisioned throughput](how-to-choose-offer.md). Azure Cosmos DB also sends [Azure Advisor recommendations](../advisor/advisor-reference-cost-recommendations.md#configure-manual-throughput-instead-of-autoscale-on-your-azure-cosmos-db-database-or-container) based on your workload patterns to recommend either manual or autoscale throughput.
## View the normalized request unit consumption metric
cosmos-db Manage With Bicep https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/manage-with-bicep.md
Create an Azure Cosmos DB account in two regions with options for consistency an
## Azure Cosmos DB container with server-side functionality
-Create an Azure Cosmos DB account, database and container with with a stored procedure, trigger, and user-defined function.
+Create an Azure Cosmos DB account, database and container with a stored procedure, trigger, and user-defined function.
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql-container-sprocs/main.bicep":::
cosmos-db Manage With Powershell https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/manage-with-powershell.md
Title: Manage Azure Cosmos DB for NoSQL resources using using PowerShell
-description: Manage Azure Cosmos DB for NoSQL resources using using PowerShell.
+ Title: Manage Azure Cosmos DB for NoSQL resources using PowerShell
+description: Manage Azure Cosmos DB for NoSQL resources using PowerShell.
cosmos-db Manage With Templates https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/manage-with-templates.md
This template creates an Azure Cosmos DB account in two regions with options for
## Azure Cosmos DB container with server-side functionality
-This template creates an Azure Cosmos DB account, database and container with with a stored procedure, trigger, and user-defined function. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
+This template creates an Azure Cosmos DB account, database and container with a stored procedure, trigger, and user-defined function. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
[:::image type="content" source="../../media/template-deployments/deploy-to-azure.svg" alt-text="Deploy to Azure":::](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.documentdb%2Fcosmosdb-sql-container-sprocs%2Fazuredeploy.json)
cosmos-db Powerbi Visualize https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/powerbi-visualize.md
To build a Power BI report/dashboard:
9. Click and expand on the database where the data for the report comes from. Now, select a collection that contains the data to retrieve.
- The Preview pane shows a list of **Record** items. A Document is represented as a **Record** type in Power BI. Similarly, a nested JSON block inside a document is also a **Record**. To view the the properties documents as columns, click on the grey button with 2 arrows in opposite directions that symbolize the expansion of the record. It's located on the right of the container's name, in the same preview pane.
+ The Preview pane shows a list of **Record** items. A Document is represented as a **Record** type in Power BI. Similarly, a nested JSON block inside a document is also a **Record**. To view the properties documents as columns, click on the grey button with 2 arrows in opposite directions that symbolize the expansion of the record. It's located on the right of the container's name, in the same preview pane.
10. Power BI Desktop Report view is where you can start creating reports to visualize data. You can create reports by dragging and dropping fields into the **Report** canvas.
cosmos-db Sdk Dotnet V3 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/sdk-dotnet-v3.md
ms.devlang: csharp Previously updated : 03/20/2023 Last updated : 11/03/2023
Release history is maintained in the Azure Cosmos DB .NET SDK source repo. For a
## <a name="recommended-version"></a> Recommended version
-Different sub versions of .NET SDKs are available under the 3.x.x version. **The minimum recommended version is 3.33.0**.
+Different sub versions of .NET SDKs are available under the 3.x.x version. **The minimum recommended version is 3.35.4**.
## <a name="known-issues"></a> Known issues
cosmos-db Tutorial Springboot Azure Kubernetes Service https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/nosql/tutorial-springboot-azure-kubernetes-service.md
Creating a Service of type `LoadBalancer` in Azure Kubernetes Service will resul
``` > [!NOTE]
- > Replace `20.81.108.180` with the the public IP address for your environment
+ > Replace `20.81.108.180` with the public IP address for your environment
## Kubernetes resources for the application
cosmos-db Optimize Dev Test https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/optimize-dev-test.md
Azure Cosmos DB is included in the [Azure free account](https://azure.microsoft.
## Use shared throughput databases
-In a [shared throughput database](set-throughput.md#set-throughput-on-a-database), all containers inside the database share the provisioned throughput (RU/s) of the database. For example, if you provision a database with 400 RU/s and have four containers, all four containers will share the 400 RU/s. In a development or testing environment, where each container may be be accessed less frequently and thus require lower than the minimum of 400 RU/s, putting containers in a shared throughput database can help optimize cost.
+In a [shared throughput database](set-throughput.md#set-throughput-on-a-database), all containers inside the database share the provisioned throughput (RU/s) of the database. For example, if you provision a database with 400 RU/s and have four containers, all four containers will share the 400 RU/s. In a development or testing environment, where each container may be accessed less frequently and thus require lower than the minimum of 400 RU/s, putting containers in a shared throughput database can help optimize cost.
For example, suppose your development or test account has four containers. If you create four containers with dedicated throughput (minimum of 400 RU/s), your total RU/s will be 1600 RU/s. In contrast, if you create a shared throughput database (minimum 400 RU/s) and put your containers there, your total RU/s will be just 400 RU/s. In general, shared throughput databases are great for scenarios where you don't need guaranteed throughput on any individual container. Learn more about [shared throughput databases.](set-throughput.md#set-throughput-on-a-database)
cosmos-db Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/policy-reference.md
Title: Built-in policy definitions for Azure Cosmos DB description: Lists Azure Policy built-in policy definitions for Azure Cosmos DB. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
cosmos-db Concepts Backup https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/postgresql/concepts-backup.md
Previously updated : 09/17/2023 Last updated : 11/02/2023 # Backup and restore in Azure Cosmos DB for PostgreSQL
example, when a user accidentally deletes data, drops an important table or
database, or if an application accidentally overwrites good data with bad data. > [!NOTE]
-> While cluster backups are always stored for 35 days, you may need to
+> While cluster backups are always stored for 35 days, you might need to
> open a support request to restore the cluster to a point that is earlier
-> than the latest failover time.
+> than the latest failover time. Maintenance and compute / storage scaling operations use
+> failovers to minimize downtime during these operations.
-For same-region restore, when all nodes are up and running, you can restore cluster without any data loss. In an extremely rare case of a node experiencing a catastrophic event (and [high availability](./concepts-high-availability.md) isn't enabled on the cluster), you may lose up to 5 minutes of data.
+For same-region restore, when all nodes are up and running, you can restore cluster without any data loss. In an extremely rare case of a node experiencing a catastrophic event (and [high availability](./concepts-high-availability.md) isn't enabled on the cluster), you might lose up to 5 minutes of data.
On clusters with geo-backup enabled, restore can be performed in the remote region or in the same region where cluster is located.
cosmos-db How To Configure Authentication https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/postgresql/how-to-configure-authentication.md
set PGPASSWORD=<TOKEN value from the previous step>
``` ```powerShell
-$env:PGPASSWORD='<TOKEN value from from the previous step>'
+$env:PGPASSWORD='<TOKEN value from the previous step>'
``` Here's a Linux/macOS example:
cosmos-db Howto High Availability https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/postgresql/howto-high-availability.md
promoted to replace it.
> Because HA doubles the number of servers in the group, it will also double > the cost.
-Enabling HA is possible during cluster creation on **Scale** page. Once cluster is provisioned, set Set **Enable high availability (HA)** checkbox in the **High availability** tab for your cluster in the Azure portal.
+Enabling HA is possible during cluster creation on **Scale** page. Once cluster is provisioned, set **Enable high availability (HA)** checkbox in the **High availability** tab for your cluster in the Azure portal.
:::image type="content" source="media/howto-high-availability/01-ha-slider.png" alt-text="ha slider":::
cosmos-db Howto Restore Portal https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/postgresql/howto-restore-portal.md
Previously updated : 10/02/2023 Last updated : 11/02/2023 # Backup and point-in-time restore of a cluster in Azure Cosmos DB for PostgreSQL
cluster using backups. You can restore either to the earliest backup or to
a custom restore point within your retention period. > [!NOTE]
-> While cluster backups are always stored for 35 days, you may need to
+> While cluster backups are always stored for 35 days, you might need to
> open a support request to restore the cluster to a point that is earlier
-> than the latest failover time.
+> than the latest failover time. Maintenance and compute / storage scaling operations use
+> failovers to minimize downtime during these operations.
## Select type of cluster backup Enabling geo-redundant backup is possible during cluster creation on the **Scale** screen that can be accessed on the **Basics** tab. Click the **Save** button to apply your selection.
cosmos-db Throughput https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/scripts/powershell/table/throughput.md
Title: PowerShell scripts for throughput (RU/s) operations for for Azure Cosmos DB for Table
-description: PowerShell scripts for throughput (RU/s) operations for for Azure Cosmos DB for Table
+ Title: PowerShell scripts for throughput (RU/s) operations for Azure Cosmos DB for Table
+description: PowerShell scripts for throughput (RU/s) operations for Azure Cosmos DB for Table
cosmos-db Vector Database https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cosmos-db/vector-database.md
Title: Vector database
-description: Use Retrieval Augmented Generation (RAG) and vector search to ground your Azure OpenAI models with data stored in Azure Cosmos DB as a vector database.
+description: Vector database functionalities in Azure Cosmos DB for retrieval augmented generation (RAG) and vector search.
Previously updated : 10/31/2023 Last updated : 11/02/2023
-# Using Azure Cosmos DB as a vector database
+# Vector database functionality implementation using Azure Cosmos DB
[!INCLUDE[NoSQL, MongoDB vCore, PostgreSQL](includes/appliesto-nosql-mongodbvcore-postgresql.md)]
Here are some solutions:
| | Description | | | |
-| **[Azure Cosmos DB for NoSQL with Azure Cognitive Search](#azure-cosmos-db-for-nosql-and-azure-cognitive-search)**. | Augment your Azure Cosmos DB data with semantic and vector search capabilities of Azure Cognitive Search. |
-| **[Azure Cosmos DB for Mongo DB vCore](#azure-cosmos-db-for-mongodb-vcore)**. | Featuring native support for vector search, store your application data and vector embeddings together in a single MongoDB-compatible service. |
-| **[Azure Cosmos DB for PostgreSQL](#azure-cosmos-db-for-postgresql)**. | Offering native support vector search, you can store your data and vectors together in a scalable PostgreSQL offering. |
+| **[Azure Cosmos DB for NoSQL with Azure Cognitive Search](#implement-vector-database-functionalities-using-azure-cosmos-db-for-nosql-and-azure-cognitive-search)**. | Augment your Azure Cosmos DB data with semantic and vector search capabilities of Azure Cognitive Search. |
+| **[Azure Cosmos DB for Mongo DB vCore](#implement-vector-database-functionalities-using-azure-cosmos-db-for-mongodb-vcore)**. | Featuring native support for vector search, store your application data and vector embeddings together in a single MongoDB-compatible service. |
+| **[Azure Cosmos DB for PostgreSQL](#implement-vector-database-functionalities-using-azure-cosmos-db-for-postgresql)**. | Offering native support vector search, you can store your data and vectors together in a scalable PostgreSQL offering. |
-## Related concepts
+## Vector database related concepts
You might first want to ensure that you understand the following concepts:
Prior to sending a request to the LLM, the user input/query/request is also tran
Here are multiple ways to implement RAG on your data stored in Azure Cosmos DB, thus achieving the same outcome as using a vector database.
-## Azure Cosmos DB for NoSQL and Azure Cognitive Search
+## Implement vector database functionalities using Azure Cosmos DB for NoSQL and Azure Cognitive Search
Implement RAG patterns with Azure Cosmos DB for NoSQL and Azure Cognitive Search. This approach enables powerful integration of your data residing in Azure Cosmos DB for NoSQL into your AI-oriented applications. Azure Cognitive Search empowers you to efficiently index, and query high-dimensional vector data, allowing you to use Azure Cosmos DB for NoSQL for the same purpose as a vector database.
-### Code samples
+### Azure Cosmos DB-based vector database functionality code samples
- [.NET RAG Pattern retail reference solution for NoSQL](https://github.com/Azure/Vector-Search-AI-Assistant-MongoDBvCore) - [.NET tutorial - recipe chatbot](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/C%23/CosmosDB-NoSQL_CognitiveSearch) - [.NET tutorial - recipe chatbot w/ Semantic Kernel](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/C%23/CosmosDB-NoSQL_CognitiveSearch_SemanticKernel) - [Python notebook tutorial - Azure product chatbot](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/Python/CosmosDB-NoSQL_CognitiveSearch)
-## Azure Cosmos DB for MongoDB vCore
+## Implement vector database functionalities using Azure Cosmos DB for MongoDB vCore
Use the native vector search feature in Azure Cosmos DB for MongoDB vCore, which offers an efficient way to store, index, and search high-dimensional vector data directly alongside other application data. This approach removes the necessity of migrating your data to costlier alternative vector databases and provides a seamless integration of your AI-driven applications.
-### Code samples
+### Azure Cosmos DB-based vector database functionality code samples
- [.NET RAG Pattern retail reference solution](https://github.com/Azure/Vector-Search-AI-Assistant-MongoDBvCore) - [.NET tutorial - recipe chatbot](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/C%23/CosmosDB-MongoDBvCore) - [Python notebook tutorial - Azure product chatbot](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/Python/CosmosDB-MongoDB-vCore)
-## Azure Cosmos DB for PostgreSQL
+## Implement vector database functionalities using Azure Cosmos DB for PostgreSQL
Use the native vector search feature in Azure Cosmos DB for PostgreSQL, offers an efficient way to store, index, and search high-dimensional vector data directly alongside other application data. This approach removes the necessity of migrating your data to costlier alternative vector databases and provides a seamless integration of your AI-driven applications.
-### Code samples
+### Azure Cosmos DB-based vector database functionality code samples
- Python: [Python notebook tutorial - food review chatbot](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples/tree/main/Python/CosmosDB-PostgreSQL_CognitiveSearch)
cost-management-billing Tutorial Acm Create Budgets https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cost-management-billing/costs/tutorial-acm-create-budgets.md
The following example commands create a budget.
Connect-AzAccount
-#Select a subscription to to monitor with a budget
+#Select a subscription to monitor with a budget
select-AzSubscription -Subscription "Your Subscription"
cost-management-billing Capabilities Analysis Showback https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cost-management-billing/finops/capabilities-analysis-showback.md
At this point, you're likely productively utilizing the native reporting and ana
- Consider both bottom-up and top-down approaches to drive FinOps through data. - Use alerting systems and collaboration tools to raise awareness of costs on a recurring basis. - Regularly evaluate the quality of the data and reports.
- - Consider introducing a feedback mechanism to learn how stakeholders are using reports and when they can't or or aren't meeting their needs. Use it as a KPI for your reports.
+ - Consider introducing a feedback mechanism to learn how stakeholders are using reports and when they can't or aren't meeting their needs. Use it as a KPI for your reports.
- Focus heavily on data quality and consistency. Many issues surfaced within the reporting tools are result from the underlying data ingestion, normalization, and cost allocation processes. Channel the feedback to the right stakeholders and raise awareness of and resolve issues that are impacting end-to-end cost visibility, accountability, and optimization. ## Learn more at the FinOps Foundation
cost-management-billing Capabilities Efficiency https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cost-management-billing/finops/capabilities-efficiency.md
When you first start managing cost in the cloud, you use the native tools to dri
- Review and implement [Azure Well-Architected Framework cost optimization guidance](/azure/well-architected/cost/overview). - Familiarize yourself with the services you use, how you're charged, and what service-specific cost optimization options you have. - You can discover the services you use from the Azure portal All resources page or from the [Services view in Cost analysis](../costs/cost-analysis-built-in-views.md#break-down-product-and-service-costs).
- - Explore the [Azure pricing pages](https://azure.microsoft.com/pricing) and [Azure pricing calculator](https://azure.microsoft.com/pricing/calculator) to learn how each service charges you. Use them to identify options that may reduce costs. For example, shared infrastructure and commitment discounts.
+ - Explore the [Azure pricing pages](https://azure.microsoft.com/pricing) and [Azure pricing calculator](https://azure.microsoft.com/pricing/calculator) to learn how each service charges you. Use them to identify options that might reduce costs. For example, shared infrastructure and commitment discounts.
- Review service documentation to learn about any cost-related features that could help you optimize your environment or improve cost visibility. Some examples: - Choose [spot VMs](/azure/well-architected/cost/optimize-vm#spot-vms) for low priority, interruptible workloads. - Avoid [cross-region data transfer](/azure/well-architected/cost/design-regions#traffic-across-billing-zones-and-regions).
+- Use and customize the [Cost optimization workbook](cost-optimization-workbook.md). The Cost Optimization workbook is a central point for some of the most often used tools that can help achieve utilization and efficiency goals.
## Building on the basics
This capability is a part of the FinOps Framework by the FinOps Foundation, a no
- [Managing commitment-based discounts](capabilities-commitment-discounts.md) - [Workload management and automation](capabilities-workloads.md)-- [Measuring unit cost](capabilities-unit-costs.md)
+- [Measuring unit cost](capabilities-unit-costs.md)
cost-management-billing Cost Optimization Workbook https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cost-management-billing/finops/cost-optimization-workbook.md
+
+ Title: Use and customize the Cost optimization workbook
+description: This article explains how to install and edit the Cost Optimization workbook.
++ Last updated : 11/02/2023++++++
+# Use and customize the Cost optimization workbook
+
+This article explains how to install and edit the Cost Optimization workbook. The Cost Optimization workbook is a central point for some of the most often used tools that can help achieve utilization and efficiency goals. It offers a range of insights, including:
+
+- Advisor cost recommendations
+- Idle resource identification
+- Management of improperly deallocated virtual machines
+- Insights into using Azure Hybrid Benefit options for Windows, Linux, and SQL databases
+
+The workbook includes insights for compute, storage and networking. The workbook also has a quick fix option for some queries. The quick fix option allows you to apply the recommended optimization directly from the workbook page, streamlining the optimization process.
+
+The workbook has two main sections: Rate optimization and Usage optimization.
+
+## Rate optimization
+
+This section focuses on strategies to optimize your Azure costs by addressing rate-related factors. It includes insights from Advisor cost recommendations, guidance on the utilization of Azure Hybrid Benefit options for Windows, Linux, and SQL databases, and more. It also includes recommendations for commitment-based discounts, such as Reservations and Azure Savings Plans. Rate optimization is critical for reducing the hourly or monthly cost of your resources.
+
+Here's an example of the Rate optimization section for Windows virtual machines with Azure Hybrid Benefit.
++
+## Usage optimization
+
+The purpose of Usage optimization is to ensure that your Azure resources are used efficiently. This section provides guidance to identify idle resources, manage improperly deallocated virtual machines, and implement recommendations to enhance resource efficiency. Focus on usage optimization to maximize your resource utilization and minimize costs.
+
+Here's an example of the Usage optimization section for AKS.
++
+For more information about the Cost Optimization workbook, see [Understand and optimize your Azure costs using the Cost Optimization workbook](../../advisor/advisor-cost-optimization-workbook.md).
+
+## Use the workbook
+
+Azure Monitor workbooks provide a flexible canvas for data analysis and the creation of rich visual reports within the Azure portal. You can then customize them to display visual and interactive information about your Azure environment. It allows you to query various sources of data in Azure and modify or process the data if needed. Then you can choose to display it using any of the available visualizations and finally share the workbook with your team so everyone can use it.
+
+The Cost Optimization workbook is in the Azure Advisor's workbook gallery, and it doesn't require any setup. However, if you want to make changes to the workbook, like adding or customizing queries, you can copy the workbook to your environment.
+
+### View the workbook in Advisor
+
+1. Sign in to the [Azure portal](https://portal.azure.com/).
+2. Search for Azure Advisor.
+3. In the left navigation menu, select **Workbooks**.
+4. In the Workbooks Gallery, select the Cost Optimization (Preview) workbook template.
+5. Select an area to explore.
+
+### Deploy the workbook to Azure
+
+If you want to make modifications to the original workbook, its template is offered as part of the [FinOps toolkit](https://microsoft.github.io/finops-toolkit/optimization-workbook) and can be deployed in just a few steps.
+
+Confirm that you have the following least-privileged roles to deploy and use the workbook.
+
+- [Workbook Contributor](../../role-based-access-control/built-in-roles.md#workbook-contributor) - allows you to import, save, and deploy the workbook.
+- [Reader](../../role-based-access-control/built-in-roles.md#reader) allows you to view all the workbook tabs without saving.
+
+Deploy the Cost Optimization workbook template with one of the following options.
+
+**Deploy to Azure**
+
+[![Deploy to Azure](../../media/template-deployments/deploy-to-azure.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Foptimization-workbook%2Fazuredeploy.json/createUIDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Foptimization-workbook%2FcreateUiDefinition.json)
+
+**Deploy to Azure Government**
+
+[![Deploy to Azure Gov](../../media/template-deployments/deploy-to-azure.svg)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Foptimization-workbook%2Fazuredeploy.json/createUIDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Foptimization-workbook%2FcreateUiDefinition.json)
+
+Select a subscription, location, resource group and give the workbook a name. Then, select **Review + create** to deploy the workbook template.
++
+On the Review + create page, select **Create**.
+
+After the deployment completes, you can view and copy the workbook URL on the **Outputs** page. The URL takes you directly to the workbook that you created. Here's an example.
++
+## Edit and include new queries to the workbook
+
+If you want to edit or include more queries in the workbook, you can edit the template for your needs.
+
+The workbook is primarily based on Azure Resource Graph queries. However, workbooks support many different sources. They include KQL, Azure Resource Manager, Azure Monitor, Azure Data Explorer, Custom Endpoints, and others.
+
+You can also merge data from different sources to enhance your insights experience. Azure Monitor has several correlatable data sources that are often critical to your triage and diagnostic workflow. You can merge or join data to provide rich insights using the merge control.
+
+Here's how to create and add a query to the Azure Hybrid benefit tab in the workbook. For this example, you add code from the [Code example](#code-example) section to help you identify which Azure Stack HCI clusters aren't using Azure Hybrid Benefit.
+
+1. Open the Workbook and select **Edit**.
+2. Select the **Rate optimization tab** , which shows virtual machines using Azure Hybrid Benefit.
+3. At the bottom of the page on the right side, to the right of the last **Edit** option, select the ellipsis (**…**) symbol and then select **Add**. This action adds a new item after the last group.
+4. Select **Add query**.
+5. Change the **Data source** to **Azure Resource Graph**. Leave the Resource type as **Subscriptions**.
+6. Under Subscriptions, select the list option and then under Resource Parameters, select **Subscriptions**.
+7. Copy the example code from the [Code example](#code-example) section and paste it into the editor.
+8. Change the _ResourceGroup_ name in the code example to the one where your Azure Stack HCI clusters reside.
+9. At the bottom of the page, select **Done Editing**.
+10. Save your changes to the workbook and review the results.
+
+### Understand code sections
+
+Although the intent of this article isn't to focus on Azure Resource Graph queries, it's important to understand what the query example does. The code example has three sections.
+
+In the first section, the following code identifies and groups your own subscriptions.
+
+```kusto
+ResourceContainers | where type =~ 'Microsoft.Resources/subscriptions' | where tostring (properties.subscriptionPolicies.quotaId) !has "MSDNDevTest_2014-09-01" | extend SubscriptionName=name
+```
+
+It queries the `ResourceContainers` table and removes the ones that are Dev/Test because Azure Hybrid Benefit doesn't apply to Dev/Test resources.
+
+In the second section, the query finds and assesses your Stack HCI resources.
+
+```kusto
+resources
+| where resourceGroup in ({ResourceGroup})
+| where type == 'microsoft.azurestackhci/clusters'
+| extend AHBStatus = tostring(properties.softwareAssuranceProperties.softwareAssuranceIntent)
+| where AHBStatus == "Disable"
+```
+
+This section queries the `Resource` table. It filters by the resource type `microsoft.azurestackhci/clusters`. It creates a new column called `AHBStatus` with the property where we have the software assurance information. And, we want only resources where the `AHBStatus` is set to `Disable`.
+
+In the last section, the query joins the `ResourceContainerstable` with the `resources` table. The join helps to identify the subscription that the resources belong to.
+
+```kusto
+ResourceContainers | "Insert first code section go here"
+| join (
+resources "Insert second code section here"
+) on subscriptionId
+| order by type asc
+| project HCIClusterId,ClusterName,Status,AHBStatus
+```
+
+In the end, you view the most relevant columns. Because the workbook has a `ResourceGroup` parameter, the example code allows you to filter the results per resource group.
+
+### Code example
+
+Here's the full code example that you use to insert into the workbook.
+
+```kusto
+ResourceContainers | where type =~ 'Microsoft.Resources/subscriptions' | where tostring (properties.subscriptionPolicies.quotaId) !has "MSDNDevTest_2014-09-01" | extend SubscriptionName=name
+| join (
+resources
+| where resourceGroup in ({ResourceGroup})
+| where type == 'microsoft.azurestackhci/clusters'
+| extend AHBStatus = tostring(properties.softwareAssuranceProperties.softwareAssuranceIntent)
+| where AHBStatus == "Disable"
+| extend HCIClusterId=properties.clusterId, ClusterName=properties.clusterName, Status=properties.status, AHBStatus=tostring(properties.softwareAssuranceProperties.softwareAssuranceIntent)
+) on subscriptionId
+| order by type asc
+| project HCIClusterId,ClusterName,Status,AHBStatus
+```
+
+## Learn more about Workbooks
+
+To learn more about Azure Monitor workbooks, see the [Visualize data combined from multiple data sources by using Azure Monitor Workbooks](/training/modules/visualize-data-workbooks/) training module.
+
+## Learn more about the FinOps toolkit
+
+The Cost Optimization workbook is part of the FinOps toolkit, an open source collection of FinOps solutions that help you manage and optimize your cloud costs.
+
+For more information, see [FinOps toolkit documentation](https://aka.ms/finops/toolkit).
+
+## Next steps
+
+- To learn more about the Cost Optimization workbook, see [Visualize data combined from multiple data sources by using Azure Monitor Workbooks](../../advisor/advisor-cost-optimization-workbook.md).
cost-management-billing Charge Back Costs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/cost-management-billing/savings-plan/charge-back-costs.md
The *EffectivePrice* for the usage that gets savings plan discount is the prorat
You can get the data using the API or download it from Azure portal.
-You call the [Usage Details API](/rest/api/consumption/usagedetails/list) to get the new data. For for information about terminology, see [Usage terms](../understand/understand-usage.md).
+You call the [Usage Details API](/rest/api/consumption/usagedetails/list) to get the new data. For more information about terminology, see [Usage terms](../understand/understand-usage.md).
Here's an example call to the Usage Details API:
data-factory Connector Azure Table Storage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/connector-azure-table-storage.md
The following sections provide details about properties that are used to define
### Use an account key
-You can create an Azure Storage linked service by using the account key. It provides the the service with global access to Storage. The following properties are supported.
+You can create an Azure Storage linked service by using the account key. It provides the service with global access to Storage. The following properties are supported.
| Property | Description | Required | |: |: |: |
data-factory Format Json https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/format-json.md
File.json
] ``` > [!NOTE]
-> If data flows throw an error stating "corrupt_record" when previewing your JSON data, it is likely that your data contains contains a single document in your JSON file. Setting "single document" should clear that error.
+> If data flows throw an error stating "corrupt_record" when previewing your JSON data, it is likely that your data contains a single document in your JSON file. Setting "single document" should clear that error.
#### Unquoted column names
data-factory Monitor Shir In Azure https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/monitor-shir-in-azure.md
By default, the Self Hosted Integration RuntimeΓÇÖs diagnostic and performance t
## Event logs
-When logged on locally to the Self Hosted Integration Runtime, specific events can be viewed using the [event viewer](/windows/win32/eventlog/viewing-the-event-log). The relevant events are captured in two event viewer journals named: **Connectors - Integration Runtime** and **Integration Runtime** respectively. While itΓÇÖs possible to log on to to the Self Hosted Integration Runtime hosts individually to view these events, it's also possible to stream these events to a Log Analytics workspace in Azure monitor for ease of query and centralization purposes.
+When logged on locally to the Self Hosted Integration Runtime, specific events can be viewed using the [event viewer](/windows/win32/eventlog/viewing-the-event-log). The relevant events are captured in two event viewer journals named: **Connectors - Integration Runtime** and **Integration Runtime** respectively. While itΓÇÖs possible to log on to the Self Hosted Integration Runtime hosts individually to view these events, it's also possible to stream these events to a Log Analytics workspace in Azure monitor for ease of query and centralization purposes.
## Performance counters
data-factory Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Data Factory
data-factory Solution Template Copy New Files Last Modified Date https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/solution-template-copy-new-files-last-modified-date.md
The template defines six parameters:
## How to use this solution template
-1. Go to template **Copy new files only by LastModifiedDate**. Create a **New** connection to to your destination store. The destination store is where you want to copy files to.
+1. Go to template **Copy new files only by LastModifiedDate**. Create a **New** connection to your destination store. The destination store is where you want to copy files to.
:::image type="content" source="media/solution-template-copy-new-files-last-modified-date/copy-new-files-last-modified-date-1.png" alt-text="Create a new connection to the source":::
data-factory Tutorial Copy Data Tool https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-factory/tutorial-copy-data-tool.md
- Previously updated : 08/10/2023 Last updated : 11/02/2023 # Copy data from Azure Blob storage to a SQL Database by using the Copy Data tool - [!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)] In this tutorial, you use the Azure portal to create a data factory. Then you use the Copy Data tool to create a pipeline that copies data from Azure Blob storage to a SQL Database.
In this tutorial, you perform the following steps:
* **Azure Storage account**: Use Blob storage as the _source_ data store. If you don't have an Azure Storage account, see the instructions in [Create a storage account](../storage/common/storage-account-create.md). * **Azure SQL Database**: Use a SQL Database as the _sink_ data store. If you don't have a SQL Database, see the instructions in [Create a SQL Database](/azure/azure-sql/database/single-database-create-quickstart).
+### Prepare the SQL database
+
+Allow Azure services to access the logical SQL Server of your Azure SQL Database.
+
+1. Verify that the setting **Allow Azure services and resources to access this server** is enabled for your server that's running SQL Database. This setting lets Data Factory write data to your database instance. To verify and turn on this setting, go to logical SQL server > Security > Firewalls and virtual networks > set the **Allow Azure services and resources to access this server** option to **ON**.
+
+ > [!NOTE]
+ > The option to **Allow Azure services and resources to access this server** enables network access to your SQL Server from any Azure resource, not just those in your subscription. It may not be appropriate for all environments, but is appropriate for this limited tutorial. For more information, see [Azure SQL Server Firewall rules](/azure/azure-sql/database/firewall-configure). Instead, you can use [Private endpoints](../private-link/private-endpoint-overview.md) to connect to Azure PaaS services without using public IPs.
+ ### Create a blob and a SQL table Prepare your Blob storage and your SQL Database for the tutorial by performing these steps.
Prepare your Blob storage and your SQL Database for the tutorial by performing t
#### Create a sink SQL table
-1. Use the following SQL script to create a table named **dbo.emp** in your SQL Database:
+1. Use the following SQL script to create a table named `dbo.emp` in your SQL Database:
```sql CREATE TABLE dbo.emp
Prepare your Blob storage and your SQL Database for the tutorial by performing t
CREATE CLUSTERED INDEX IX_emp_ID ON dbo.emp (ID); ```
-2. Allow Azure services to access SQL Server. Verify that the setting **Allow Azure services and resources to access this server** is enabled for your server that's running SQL Database. This setting lets Data Factory write data to your database instance. To verify and turn on this setting, go to logical SQL server > Security > Firewalls and virtual networks > set the **Allow Azure services and resources to access this server** option to **ON**.
-
- > [!NOTE]
- > The option to **Allow Azure services and resources to access this server** enables network access to your SQL Server from any Azure resource, not just those in your subscription. For more information, see [Azure SQL Server Firewall rules](/azure/azure-sql/database/firewall-configure). Instead, you can use [Private endpoints](../private-link/private-endpoint-overview.md) to connect to Azure PaaS services without using public IPs.
## Create a data factory 1. On the left menu, select **Create a resource** > **Integration** > **Data Factory**:
- :::image type="content" source="./media/doc-common-process/new-azure-data-factory-menu.png" alt-text="New data factory creation":::
+ :::image type="content" source="./media/doc-common-process/new-azure-data-factory-menu.png" alt-text="Screenshot of the New data factory creation.":::
1. On the **New data factory** page, under **Name**, enter **ADFTutorialDataFactory**. The name for your data factory must be _globally unique_. You might receive the following error message:
- :::image type="content" source="./media/doc-common-process/name-not-available-error.png" alt-text="New data factory error message for duplicate name.":::
+ :::image type="content" source="./media/doc-common-process/name-not-available-error.png" alt-text="Screenshot of the New data factory error message for duplicate name.":::
If you receive an error message about the name value, enter a different name for the data factory. For example, use the name _**yourname**_**ADFTutorialDataFactory**. For the naming rules for Data Factory artifacts, see [Data Factory naming rules](naming-rules.md).
Prepare your Blob storage and your SQL Database for the tutorial by performing t
1. After creation is finished, the **Data Factory** home page is displayed.
- :::image type="content" source="./media/doc-common-process/data-factory-home-page.png" alt-text="Home page for the Azure Data Factory, with the Open Azure Data Factory Studio tile.":::
+ :::image type="content" source="./media/doc-common-process/data-factory-home-page.png" alt-text="Screenshot of the Home page for the Azure Data Factory, with the Open Azure Data Factory Studio tile.":::
1. To launch the Azure Data Factory user interface (UI) in a separate tab, select **Open** on the **Open Azure Data Factory Studio** tile.
Prepare your Blob storage and your SQL Database for the tutorial by performing t
1. On the **Properties** page of the Copy Data tool, choose **Built-in copy task** under **Task type**, then select **Next**.
- :::image type="content" source="./media/tutorial-copy-data-tool/copy-data-tool-properties-page.png" alt-text="Screenshot that shows the Properties page":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/copy-data-tool-properties-page.png" alt-text="Screenshot that shows the Properties page.":::
1. On the **Source data store** page, complete the following steps:
Prepare your Blob storage and your SQL Database for the tutorial by performing t
f. Select **Next** to move to next step.
- :::image type="content" source="./media/tutorial-copy-data-tool/source-data-store.png" alt-text="Configure the source.":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/source-data-store.png" alt-text="Screenshot of the page to Configure the source.":::
1. On the **File format settings** page, enable the checkbox for *First row as header*. Notice that the tool automatically detects the column and row delimiters, and you can preview data and view the schema of the input data by selecting **Preview data** button on this page. Then select **Next**.
- :::image type="content" source="./media/tutorial-copy-data-tool/file-format-settings-page.png" alt-text="File format settings":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/file-format-settings-page.png" alt-text="Screenshot of the File format settings.":::
1. On the **Destination data store** page, completes the following steps:
Prepare your Blob storage and your SQL Database for the tutorial by performing t
c. On the **New connection (Azure SQL Database)** page, select your Azure subscription, server name and database name from the dropdown list. Then select **SQL authentication** under **Authentication type**, specify the username and password. Test connection and select **Create**.
- :::image type="content" source="./media/tutorial-copy-data-tool/config-azure-sql-db.png" alt-text="Configure Azure SQL DB":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/config-azure-sql-db.png" alt-text="Screenshot of the Configure Azure SQL Database page.":::
d. Select the newly created linked service as sink, then select **Next**.
-1. On the **Destination data store** page, select **Use existing table** and select the **dbo.emp** table. Then select **Next**.
+1. On the **Destination data store** page, select **Use existing table** and select the `dbo.emp` table. Then select **Next**.
1. On the **Column mapping** page, notice that the second and the third columns in the input file are mapped to the **FirstName** and **LastName** columns of the **emp** table. Adjust the mapping to make sure that there is no error, and then select **Next**.
- :::image type="content" source="./media/tutorial-copy-data-tool/column-mapping.png" alt-text="Column mapping page":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/column-mapping.png" alt-text="Screenshot of the column mapping page.":::
1. On the **Settings** page, under **Task name**, enter **CopyFromBlobToSqlPipeline**, and then select **Next**.
- :::image type="content" source="./media/tutorial-copy-data-tool/settings.png" alt-text="Configure the settings.":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/settings.png" alt-text="Screenshot of the settings.":::
1. On the **Summary** page, review the settings, and then select **Next**. 1. On the **Deployment** page, select **Monitor** to monitor the pipeline (task).
- :::image type="content" source="./media/tutorial-copy-data-tool/monitor-pipeline.png" alt-text="Monitor pipeline":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/monitor-pipeline.png" alt-text="Screenshot of Monitoring the pipeline.":::
1. On the Pipeline runs page, select **Refresh** to refresh the list. Select the link under **Pipeline name** to view activity run details or rerun the pipeline.
- :::image type="content" source="./media/tutorial-copy-data-tool/pipeline-run.png" alt-text="Pipeline run":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/pipeline-run.png" alt-text="Screenshot of the Pipeline run.":::
1. On the "Activity runs" page, select the **Details** link (eyeglasses icon) under **Activity name** column for more details about copy operation. To go back to the "Pipeline runs" view, select the **All pipeline runs** link in the breadcrumb menu. To refresh the view, select **Refresh**.
- :::image type="content" source="./media/tutorial-copy-data-tool/activity-monitoring.png" alt-text="Monitor activity runs":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/activity-monitoring.png" alt-text="Screenshot of monitoring activity runs.":::
1. Verify that the data is inserted into the **dbo.emp** table in your SQL Database. 1. Select the **Author** tab on the left to switch to the editor mode. You can update the linked services, datasets, and pipelines that were created via the tool by using the editor. For details on editing these entities in the Data Factory UI, see [the Azure portal version of this tutorial](tutorial-copy-data-portal.md).
- :::image type="content" source="./media/tutorial-copy-data-tool/author-tab.png" alt-text="Select Author tab":::
+ :::image type="content" source="./media/tutorial-copy-data-tool/author-tab.png" alt-text="Screenshot of the Select Author tab.":::
+
+## Related content
-## Next steps
The pipeline in this sample copies data from Blob storage to a SQL Database. You learned how to: > [!div class="checklist"]
data-lake-analytics Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-lake-analytics/policy-reference.md
Title: Built-in policy definitions for Azure Data Lake Analytics description: Lists Azure Policy built-in policy definitions for Azure Data Lake Analytics. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
data-lake-store Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/data-lake-store/policy-reference.md
Title: Built-in policy definitions for Azure Data Lake Storage Gen1 description: Lists Azure Policy built-in policy definitions for Azure Data Lake Storage Gen1. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
databox-online Azure Stack Edge Alerts https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/databox-online/azure-stack-edge-alerts.md
The following alerts relate to your Azure Key Vault configuration.
|Key Vault is not configured<sup>*</sup> |Critical<br>Warning |<ol><li>Verify that the Key Vault is not deleted.</li><li>Assign the appropriate permissions for your device to get and set the secrets. For detailed steps, see [Prerequisites for an Azure Stack Edge resource](azure-stack-edge-gpu-deploy-prep.md#prerequisites).</li><li>If secrets are soft deleted, follow the steps [here](../key-vault/general/key-vault-recovery.md#list-recover-or-purge-soft-deleted-secrets-keys-and-certificates) to recover the secrets.</li><li>Refresh the Key Vault details to clear the alert.</li></ol> | |Key Vault is not configured<sup>*</sup> |Warning |Configure the Key Vault for your Azure Stack Edge resource. For detailed steps, see [Create a key vault](../key-vault/general/quick-create-portal.md). | |Key Vault is deleted |Critical |If the key vault is deleted and the purge protection duration of 90 days hasn't elapsed, follow the steps to [Recover your key vault](../key-vault/general/key-vault-recovery.md#list-recover-or-purge-a-soft-deleted-key-vault). |
-|CouldnΓÇÖt retrieve secret(s) from the Key Vault |Critical |<ol><li>Verify that the Key Vault is not deleted.</li><li>Assign the appropriate permissions for your device to get and set the secrets. The required permissions are are present [here](azure-stack-edge-gpu-deploy-prep.md#prerequisites).</li><li>Refresh the Key Vault details to clear the alert.</li></ol> |
+|CouldnΓÇÖt retrieve secret(s) from the Key Vault |Critical |<ol><li>Verify that the Key Vault is not deleted.</li><li>Assign the appropriate permissions for your device to get and set the secrets. The required permissions are present [here](azure-stack-edge-gpu-deploy-prep.md#prerequisites).</li><li>Refresh the Key Vault details to clear the alert.</li></ol> |
|CouldnΓÇÖt access the Key Vault |Critical |<ol><li>Verify that the Key Vault is not deleted.</li><li>Assign the appropriate permissions for your device to get and set the secrets. For more information, see the [detailed steps](azure-stack-edge-gpu-deploy-prep.md#prerequisites).</li><li>Refresh the Key Vault details to clear the alert.</li></ol> | <sup>*</sup> This alert is triggered by more than one event type, with different recommended actions.
databox-online Azure Stack Edge Gpu Connect Resource Manager https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/databox-online/azure-stack-edge-gpu-connect-resource-manager.md
To connect to Azure Resource Manager, you will need to create or get signing cha
For test and development use only, you can use Windows PowerShell to create certificates on your local system. While creating the certificates for the client, follow these guidelines:
-1. You first need to create a root certificate for the signing chain. For more information, see See steps to [Create signing chain certificates](azure-stack-edge-gpu-create-certificates-powershell.md#create-signing-chain-certificate).
+1. You first need to create a root certificate for the signing chain. For more information, see steps to [Create signing chain certificates](azure-stack-edge-gpu-create-certificates-powershell.md#create-signing-chain-certificate).
2. You can next create the endpoint certificates for Azure Resource Manager and blob (optional). You can get these endpoints from the **Device** page in the local web UI. See the steps to [Create endpoint certificates](azure-stack-edge-gpu-create-certificates-powershell.md#create-signed-endpoint-certificates).
You will install Azure PowerShell modules on your client that will work with you
PS C:\windows\system32> Get-Module -Name "Az*" -ListAvailable ```
- If you used PowerShell 5.1 and later, the example output below indicates that that the Az version 1.10.0 modules were installed successfully.
+ If you used PowerShell 5.1 and later, the example output below indicates that the Az version 1.10.0 modules were installed successfully.
```powershell PS C:\WINDOWS\system32> Get-InstalledModule -Name Az -AllVersions
You will now add the device IP address to:
- The DNS server configuration > [!IMPORTANT]
-> We recommend that you modify the the DNS server configuration for endpoint name resolution.
+> We recommend that you modify the DNS server configuration for endpoint name resolution.
On your Windows client that you are using to connect to the device, take the following steps:
databox-online Azure Stack Edge Gpu Deploy Kubernetes Gpu Sharing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/databox-online/azure-stack-edge-gpu-deploy-kubernetes-gpu-sharing.md
# Deploy a Kubernetes workload using GPU sharing on your Azure Stack Edge Pro
-This article describes how containerized workloads can share the GPUs on your Azure Stack Edge Pro GPU device. In this article, you will run two jobs, one without the GPU context-sharing and one with the context-sharing enabled via the the Multi-Process Service (MPS) on the device. For more information, see the [Multi-Process Service](https://docs.nvidia.com/deploy/pdf/CUDA_Multi_Process_Service_Overview.pdf).
+This article describes how containerized workloads can share the GPUs on your Azure Stack Edge Pro GPU device. In this article, you will run two jobs, one without the GPU context-sharing and one with the context-sharing enabled via the Multi-Process Service (MPS) on the device. For more information, see the [Multi-Process Service](https://docs.nvidia.com/deploy/pdf/CUDA_Multi_Process_Service_Overview.pdf).
## Prerequisites
databox-online Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/databox-online/policy-reference.md
Title: Built-in policy definitions for Azure Stack Edge description: Lists Azure Policy built-in policy definitions for Azure Stack Edge. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
databox Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/databox/policy-reference.md
Title: Built-in policy definitions for Azure Data Box description: Lists Azure Policy built-in policy definitions for Azure Data Box. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
ddos-protection Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/ddos-protection/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023
defender-for-cloud Alert Validation https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-cloud/alert-validation.md
You can simulate alerts for both of the control plane, and workload alerts with
- Ensure the Defender for Containers plan is enabled. - Ensure the [Defender agent](defender-for-cloud-glossary.md#defender-agent) is installed.
-**To simulate a a Kubernetes workload security alert**:
+**To simulate a Kubernetes workload security alert**:
1. Create a pod to run a test command on. This pod can be any of the existing pods in the cluster, or a new pod. You can create using this sample yaml configuration:
defender-for-cloud Custom Security Policies https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-cloud/custom-security-policies.md
If there isn't an initiative in the list that meets your needs, you can create o
1. Enter the definition's location and custom name. > [!NOTE]
- > Custom initiatives shouldn't have the same name as other initiatives (custom or built-in). If you create a custom initiative with the the same name, it will cause a conflict in the information displayed in the dashboard.
+ > Custom initiatives shouldn't have the same name as other initiatives (custom or built-in). If you create a custom initiative with the same name, it will cause a conflict in the information displayed in the dashboard.
1. Select the policies to include and select **Add**.
defender-for-cloud Overview Page https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-cloud/overview-page.md
The **Insights** pane offers customized items for your environment including:
- Actionable items to enhance your security. - Tips to handle alerts and recommendations.-- Recommendations on how to to upgrade your service to enhance your environments protections.
+- Recommendations on how to upgrade your service to enhance your environments protections.
- Recent blog posts by Microsoft Defender for Cloud experts. ## Next steps
defender-for-cloud Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-cloud/policy-reference.md
Title: Built-in policy definitions description: Lists Azure Policy built-in policy definitions for Microsoft Defender for Cloud. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
defender-for-cloud Windows Admin Center Integration https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-cloud/windows-admin-center-integration.md
Through the combination of these two tools, Defender for Cloud becomes your sing
- The Log Analytics agent is installed on the server and configured to report to the selected workspace. If the server already reports to another workspace, it's configured to report to the newly selected workspace as well. > [!NOTE]
- > It might take some time after onboarding for recommendations to appear. In fact, depending on on your server activity you might not receive *any* alerts. To generate test alerts to test your alerts are working correctly, follow the instructions in [the alert validation procedure](alert-validation.md).
+ > It might take some time after onboarding for recommendations to appear. In fact, depending on your server activity you might not receive *any* alerts. To generate test alerts to test your alerts are working correctly, follow the instructions in [the alert validation procedure](alert-validation.md).
## View security recommendations and alerts in Windows Admin Center
defender-for-iot How To Region Move https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-iot/device-builders/how-to-region-move.md
After transferring, and enabling the resource, you can link to the same log anal
In this section, you'll verify that the resource has been moved, that the connection to the IoT Hub has been enabled, and that everything is working correctly.
-**To verify the resource in in the correct region**:
+**To verify the resource is in the correct region**:
1. Sign in to the [Azure portal](https://portal.azure.com), and then select **All Resources**.
defender-for-iot How To Security Data Access https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-iot/device-builders/how-to-security-data-access.md
SecurityRecommendation
Get the number of distinct active security recommendations, grouped by IoT Hub, device, recommendation severity, and type. ```
-// Get the number of distinct active security recommendations, grouped by by
+// Get the number of distinct active security recommendations, grouped by
// IoT hub, device, recommendation severity and type // SecurityRecommendation
defender-for-iot Ot Virtual Appliances https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-iot/organizations/ot-virtual-appliances.md
Learn more:
- [On-premises management console as a virtual appliance with Microsoft Hyper-V](appliance-catalog/virtual-management-hyper-v.md) > [!IMPORTANT]
-> Other types of hypervisors, such as hosted hypervisors, may also run Defender for IoT. However, due due to their lack of exclusive hardware control and resource reservation, other types of hypervisors are not supported for production environments. For example: Parallels, Oracle VirtualBox, and VMware Workstation or Fusion
+> Other types of hypervisors, such as hosted hypervisors, may also run Defender for IoT. However, due to their lack of exclusive hardware control and resource reservation, other types of hypervisors are not supported for production environments. For example: Parallels, Oracle VirtualBox, and VMware Workstation or Fusion
> ## Virtual appliance design considerations
defender-for-iot References Work With Defender For Iot Cli Commands https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/defender-for-iot/organizations/references-work-with-defender-for-iot-cli-commands.md
To access the Defender for IoT CLI, you'll need access to the sensor or on-premi
## Privileged user access for OT monitoring
-Use the *support* user when using the Defender for IoT CLI, which is an an administrative account with access to all CLI commands. On the on-premises management console, use either the *support* or the *cyberx* user.
+Use the *support* user when using the Defender for IoT CLI, which is an administrative account with access to all CLI commands. On the on-premises management console, use either the *support* or the *cyberx* user.
In sensor software versions earlier than [23.1.x](whats-new.md#july-2023), the *cyberx* and *cyberx_host* privileged users are also available. In versions 23.1.x and higher, the *cyberx* and *cyberx_host* users are available, but not enabled by default. To enable these extra privileged users, [change their passwords](manage-users-sensor.md#change-a-sensor-users-password).
dev-box How To Request Quota Increase https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/dev-box/how-to-request-quota-increase.md
Last updated 08/22/2023
This article describes how to submit a support request for increasing the number of resources for Microsoft Dev Box in your Azure subscription.
+To ensure that resources are available for customers, Microsoft Dev Box has a limit on the number of each type of resource that can be used in a subscription. This limit is called a quota.
+
+There are different types of quota limits that you might encounter, depending on the resource type. For example:
+
+**Developer portal**
+
+Dev Box vCPU - you might encounter this quota error in the [developer portal](https://aka.ms/devbox-portal) during dev box creation.
+
+**Azure portal**
+
+- Dev Centers
+- Network connections
+- Projects
+- Pools
+- Dev Box Definitions
+ When you reach the limit for a resource in your subscription, you can request a limit increase (sometimes called a capacity increase, or a quota increase) to extend the number of resources available. The request process allows the Microsoft Dev Box team to ensure that your subscription isn't involved in any cases of fraud or unintentional, sudden large-scale deployments. The time it takes to increase your quota varies depending on the VM size, region, and number of resources requested. You won't have to go through the process of requesting extra capacity often. To ensure you have the resources you require when you need them, you should:
Learn more about the general [process for creating Azure support requests](../az
## Gather information for your request
-You'll find submitting a support request for additional quota is quicker if you gather the required information before you begin the request process.
+Submitting a support request for an increase in quota is quicker if you gather the required information before you begin the request process.
- **Determine your current quota usage**
You'll find submitting a support request for additional quota is quicker if you
## Submit a new support request
-Follow these steps to request a limit increase:
+Start the process of requesting a limit increase by opening **Support + troubleshooting** from the right of the toolbar.
++
+Azure presents two different ways to get you the right help and support. When **Support + troubleshooting** opens, you see either:
+- A question asking **How can we help you?**
+- A classic style support request form
+
+From the following tabs, select the style appropriate for your experience and use the steps to request a limit increase:
+
+#### [Question style](#tab/Questions/)
+
+1. On the Azure portal home page, select Support & troubleshooting from the top right.
+
+ :::image type="content" source="media/how-to-request-quota-increase/help-support-question.png" alt-text="Screenshot showing the How can we help you question." lightbox="media/how-to-request-quota-increase/help-support-question.png":::
+
+1. In the **How can we help you?** box, enter *quota limit*, and then select **Go**.
+
+ :::image type="content" source="media/how-to-request-quota-increase/help-support-quota-limit.png" alt-text="Screenshot showing the How can we help you question and quota limit answer." lightbox="media/how-to-request-quota-increase/help-support-quota-limit.png":::
+
+1. From the **Which service are you having an issue with?** list, select **Service and subscription limits (quotas)**, and then select **Next**.
+
+ :::image type="content" source="media/how-to-request-quota-increase/help-support-service-list.png" alt-text="Screenshot showing the Service and subscription limits (quotas) item." lightbox="media/how-to-request-quota-increase/help-support-service-list.png":::
+
+1. In the Service and subscription limits (quotas) section, select **Create a support request**.
+
+ :::image type="content" source="media/how-to-request-quota-increase/help-support-result.png" alt-text="Screenshot showing the Create a support request button." lightbox="media/how-to-request-quota-increase/help-support-result.png":::
+
+1. On the **New support request** page, enter the following information, and then select **Next**.
+
+ | Name | Value |
+ | -- | - |
+ | **Issue type** | *Service and subscription limits (quotas)* |
+ | **Subscription** | Select the subscription to which the request applies. |
+ | **Quota type** | *Microsoft Dev Box* |
+
+1. On the **Additional details** tab, in the **Problem details** section, select **Enter details**.
+
+ :::image type="content" source="media/how-to-request-quota-increase/enter-details.png" alt-text="Screenshot of the New support request page, highlighting Enter details." lightbox="media/how-to-request-quota-increase/enter-details.png":::
+
+1. In **Quota details**, enter the following information, and then select **Next**.
+
+ | Name | Value |
+ | -- | - |
+ | **Region** | Select the **Region** in which you want to increase your quota. |
+ | **Quota type** | When you select a Region, Azure displays your current usage and your current for all quota types. </br> Select the **Quota type** that you want to increase. |
+ | **New total limit** | Enter the new total limit that you want to request. |
+ | **Is it a limit decrease?** | Select **Yes** or **No**. |
+ | **Additional information** | Enter any extra information about your request. |
+
+ :::image type="content" source="media/how-to-request-quota-increase/quota-details.png" alt-text="Screenshot of the Quota details pane." lightbox="media/how-to-request-quota-increase/quota-details.png":::
+
+1. Select **Save and continue**.
+
+#### [Classic style](#tab/AzureADJoin/)
-1. On the Azure portal home page, select Support & troubleshooting from the top left, and then select **Help + support**.
+1. On the Azure portal home page, select Support & troubleshooting from the top right, and then select **Help + support**.
- :::image type="content" source="./media/how-to-request-capacity-increase/submit-new-request.png" alt-text="Screenshot of the Azure portal home page, highlighting the Request core limit increase button." lightbox="./media/how-to-request-capacity-increase/submit-new-request.png":::
+ :::image type="content" source="./media/how-to-request-quota-increase/submit-new-request.png" alt-text="Screenshot of the Azure portal home page, highlighting the Request core limit increase button." lightbox="./media/how-to-request-quota-increase/submit-new-request.png":::
1. On the **Help + support** page, select **Create a support request**.
- :::image type="content" source="./media/how-to-request-capacity-increase/create-support-request.png" alt-text="Screenshot of the Help + support page, highlighting Create a support request." lightbox="./media/how-to-request-capacity-increase/create-support-request.png":::
+ :::image type="content" source="./media/how-to-request-quota-increase/create-support-request.png" alt-text="Screenshot of the Help + support page, highlighting Create a support request." lightbox="./media/how-to-request-quota-increase/create-support-request.png":::
1. On the **New support request** page, enter the following information, and then select **Next**.
Follow these steps to request a limit increase:
1. On the **Additional details** tab, in the **Problem details** section, select **Enter details**.
- :::image type="content" source="media/how-to-request-capacity-increase/enter-details.png" alt-text="Screenshot of the New support request page, highlighting Enter details." lightbox="media/how-to-request-capacity-increase/enter-details.png":::
+ :::image type="content" source="media/how-to-request-quota-increase/enter-details.png" alt-text="Screenshot of the New support request page, highlighting Enter details." lightbox="media/how-to-request-quota-increase/enter-details.png":::
1. In **Quota details**, enter the following information, and then select **Next**.
Follow these steps to request a limit increase:
| **Is it a limit decrease?** | Select **Yes** or **No**. | | **Additional information** | Enter any extra information about your request. |
- :::image type="content" source="media/how-to-request-capacity-increase/quota-details.png" alt-text="Screenshot of the Quota details pane." lightbox="media/how-to-request-capacity-increase/quota-details.png":::
+ :::image type="content" source="media/how-to-request-quota-increase/quota-details.png" alt-text="Screenshot of the Quota details pane." lightbox="media/how-to-request-quota-increase/quota-details.png":::
1. Select **Save and continue**.+++ ## Complete the support request To complete the support request, enter the following information:
To complete the support request, enter the following information:
1. Select **Next**. 1. On the **Review + create** tab, review the information, and then select **Create**.
-
+ ## Related content - To learn how to check your quota usage, see [Determine usage and quota](./how-to-determine-your-quota-usage.md).
dev-box Monitor Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/dev-box/monitor-reference.md
The following table lists the properties of resource logs in DevCenter. The reso
| | | | | **time** | **TimeGenerated** | The date and time (UTC) when the operation occurred. | | **resourceId** | **ResourceId** | The DevCenter resource for which logs are enabled.|
-| **operationName** | **OperationName** | Name of the operation. If the event represents an Azure role-based access control (RBAC) operation, specify the the Azure RBAC operation name (for example, `Microsoft.DevCenter/projects/users/devboxes/write`). This name is typically modeled in the form of an Azure Resource Manager operation, even if it's not a documented Resource Manager operation: (`Microsoft.<providerName>/<resourceType>/<subtype>/<Write/Read/Delete/Action>`)|
+| **operationName** | **OperationName** | Name of the operation. If the event represents an Azure role-based access control (RBAC) operation, specify the Azure RBAC operation name (for example, `Microsoft.DevCenter/projects/users/devboxes/write`). This name is typically modeled in the form of an Azure Resource Manager operation, even if it's not a documented Resource Manager operation: (`Microsoft.<providerName>/<resourceType>/<subtype>/<Write/Read/Delete/Action>`)|
| **identity** | **CallerIdentity** | The OID of the caller of the event. | | **TargetResourceId** | **ResourceId** | The subresource that pertains to the request. Depending on the operation performed, this value may point to a `devbox` or `environment`.| | **resultSignature** | **ResponseCode** | The HTTP status code returned for the operation. |
digital-twins Concepts Security https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/digital-twins/concepts-security.md
For instructions on how to enable a managed identity for an Azure Digital Twins
Azure Digital Twins can connect to Event Hubs and Service Bus endpoints for sending event data, using those resources' public endpoints. However, if those resources are bound to a VNet, connectivity to the resources are blocked by default. As a result, this configuration prevents Azure Digital Twins from sending event data to your resources.
-To resolve this, enable connectivity from your Azure Digital Twins instance to your Event Hubs or Service Bus resources through the the *trusted Microsoft service* option (see [Trusted Microsoft services for Event Hubs](../event-hubs/event-hubs-ip-filtering.md#trusted-microsoft-services) and [Trusted Microsoft services for Service Bus](../service-bus-messaging/service-bus-service-endpoints.md#trusted-microsoft-services)).
+To resolve this, enable connectivity from your Azure Digital Twins instance to your Event Hubs or Service Bus resources through the *trusted Microsoft service* option (see [Trusted Microsoft services for Event Hubs](../event-hubs/event-hubs-ip-filtering.md#trusted-microsoft-services) and [Trusted Microsoft services for Service Bus](../service-bus-messaging/service-bus-service-endpoints.md#trusted-microsoft-services)).
You'll need to complete the following steps to enable the trusted Microsoft service connection.
digital-twins Tutorial End To End https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/digital-twins/tutorial-end-to-end.md
Save the file.
Now, to see the results of the data simulation that you've set up, open a new local console window and navigate to *digital-twins-samples-main\DeviceSimulator\DeviceSimulator*. >[!NOTE]
-> You should now have two open console windows: one that's open to the the *DeviceSimulator\DeviceSimulator* folder, and one from earlier that's still open to the *AdtSampleApp\SampleClientApp* folder.
+> You should now have two open console windows: one that's open to the *DeviceSimulator\DeviceSimulator* folder, and one from earlier that's still open to the *AdtSampleApp\SampleClientApp* folder.
Use the following dotnet command to run the device simulator project:
dms Tutorial Login Migration Ads https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/dms/tutorial-login-migration-ads.md
Before you begin the tutorial:
> [!IMPORTANT] > For large number of logins, we recommend using automation. With PowerShell or Azure CLI you can use the `CSVFilePath` switch, that allows you to pass a CSV file type as a list of logins to be migrated. >
- > Bulk login migrations might be time-consuming using Azure Data Studio, as you need to manually select each login to migrate on the the login selection screen.
+ > Bulk login migrations might be time-consuming using Azure Data Studio, as you need to manually select each login to migrate on the login selection screen.
## Open the Login Migration wizard in Azure Data Studio
energy-data-services How To Upload Large Files Using File Service https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/energy-data-services/how-to-upload-large-files-using-file-service.md
Title: How to upload large files using file service API in Microsoft Azure Data Manager for Energy
-description: This article describes how to to upload large files using File service API in Microsoft Azure Data Manager for Energy
+description: This article describes how to upload large files using File service API in Microsoft Azure Data Manager for Energy
event-grid Event Filtering https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/event-grid/event-filtering.md
Key is the field in the event data that you're using for filtering. It can be on
For events in the **Event Grid schema**, use the following values for the key: `ID`, `Topic`, `Subject`, `EventType`, `DataVersion`, or event data (like `data.key1`).
-For events in **Cloud Events schema**, use the following values for the key: `eventid`, `source`, `eventtype`, `eventtypeversion`, or event data (like `data.key1`).
+For events in **Cloud Events schema**, use the following values for the key: `id`, `source`, `type`, `specversion`, or custom properties using `.` as the nesting separator (example: `data.appEventTypeDetail.action`).
For **custom input schema**, use the event data fields (like `data.key1`). To access fields in the data section, use the `.` (dot) notation. For example, `data.siteName`, `data.appEventTypeDetail.action` to access `siteName` or `action` for the following sample event.
If you specify multiple different filters, an **AND** operation is done, so each
``` ## CloudEvents
-For events in the **CloudEvents schema**, use the following values for the key: `eventid`, `source`, `eventtype`, `eventtypeversion`, or event data (like `data.key1`).
+For events in the **CloudEvents schema**, use the following values for the key: `id`, `source`, `type`, `specversion`, or custom properties using `.` as the nesting operator (example: `data.appinfoA`).
You can also use [extension context attributes in CloudEvents 1.0](https://github.com/cloudevents/spec/blob/v1.0.1/spec.md#extension-context-attributes). In the following example, `comexampleextension1` and `comexampleothervalue` are extension context attributes.
event-grid Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/event-grid/policy-reference.md
Title: Built-in policy definitions for Azure Event Grid description: Lists Azure Policy built-in policy definitions for Azure Event Grid. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
event-hubs Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/event-hubs/policy-reference.md
Title: Built-in policy definitions for Azure Event Hubs description: Lists Azure Policy built-in policy definitions for Azure Event Hubs. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
event-hubs Transport Layer Security Enforce Minimum Version https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/event-hubs/transport-layer-security-enforce-minimum-version.md
Azure Event Hubs supports choosing a specific TLS version for namespaces. Curren
Azure Event Hubs namespaces permit clients to send and receive data with TLS 1.0 and above. To enforce stricter security measures, you can configure your Event Hubs namespace to require that clients send and receive data with a newer version of TLS. If an Event Hubs namespace requires a minimum version of TLS, then any requests made with an older version will fail. > [!IMPORTANT]
-> If you are using a service that connects to Azure Event Hubs, make sure that that service is using the appropriate version of TLS to send requests to Azure Event Hubs before you set the required minimum version for an Event Hubs namespace.
+> If you are using a service that connects to Azure Event Hubs, make sure that service is using the appropriate version of TLS to send requests to Azure Event Hubs before you set the required minimum version for an Event Hubs namespace.
## Permissions necessary to require a minimum version of TLS
expressroute Customer Controlled Gateway Maintenance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/expressroute/customer-controlled-gateway-maintenance.md
+
+ Title: 'Configure customer-controlled maintenance for your virtual network gateway'
+
+description: Learn how to configure customer-controlled maintenance for your gateways using the Azure portal, or PowerShell.
+++ Last updated : 11/01/2023++
+# Configure customer-controlled gateway maintenance for ExpressRoute (Preview)
+
+This article helps you configure customer-controlled maintenance windows for your ExpressRoute virtual network gateways. Learn how to schedule customer-controlled maintenance for your gateways using the Azure portal or PowerShell.
++
+For more information on limitations and frequently asked questions related to customer-controlled maintenance, see the [ExpressRoute FAQ](expressroute-faqs.md#customer-controlled).
++
+## Azure portal steps
++
+ Example:
+
+ :::image type="content" source="./media/customer-controlled-gateway-maintenance/select-resources.png" alt-text="Screenshot showing the select resources page." lightbox="./media/customer-controlled-gateway-maintenance/select-resources.png":::
++
+## Azure PowerShell steps
+
+6. Create the maintenance configuration assignment using the [New-AzConfigurationAssignment](/powershell/module/az.maintenance/new-azconfigurationassignment) cmdlet. The maintenance policy is applied to the resource within 24 hours.
+
+ ```azurepowershell-interactive
+ New-AzConfigurationAssignment -ResourceGroupName <rgName> -ProviderName "Microsoft.Network" -ResourceType "<your resource's resource type per ARM. For example, expressRouteGateways or virtualNetworkGateways>" -ResourceName "<your resource's name>" -ConfigurationAssignmentName "<assignment name>" -ResourceId $serviceResource.Id -MaintenanceConfigurationId $config.Id -Location "<arm location of resource>"
+ ```
+
+### To remove a configuration assignment
++
+## Next steps
+
+For more information, see the [ExpressRoute FAQ](expressroute-faqs.md#customer-controlled).
expressroute Expressroute Faqs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/expressroute/expressroute-faqs.md
No. You can purchase a private connection of any speed from your service provide
### Is it possible to use more bandwidth than I procured for my ExpressRoute circuit?
-Yes, you may use up to two times the bandwidth limit you procured by using the bandwidth available on the secondary connection of your ExpressRoute circuit. The built-in redundancy of your circuit is configured using primary and secondary connections, each of the procured bandwidth, to two Microsoft Enterprise Edge routers (MSEEs). The bandwidth available through your secondary connection can be used for more traffic if necessary. Since the secondary connection is meant for redundancy, it isn't guaranteed and shouldn't be used for extra traffic for a sustained period of time. To learn more about how to use both connections to transmit traffic, see [use AS PATH prepending](expressroute-optimize-routing.md#solution-use-as-path-prepending).
+Yes, you can use up to two times the bandwidth limit you procured by using the bandwidth available on the secondary connection of your ExpressRoute circuit. The built-in redundancy of your circuit is configured using primary and secondary connections, each of the procured bandwidth, to two Microsoft Enterprise Edge routers (MSEEs). The bandwidth available through your secondary connection can be used for more traffic if necessary. Since the secondary connection is meant for redundancy, it isn't guaranteed and shouldn't be used for extra traffic for a sustained period of time. To learn more about how to use both connections to transmit traffic, see [use AS PATH prepending](expressroute-optimize-routing.md#solution-use-as-path-prepending).
If you plan to use only your primary connection to transmit traffic, the bandwidth for the connection is fixed, and attempting to oversubscribe it results in increased packet drops. If traffic flows through an ExpressRoute Gateway, the bandwidth for the Gateway SKU is fixed and not burstable. For the bandwidth of each Gateway SKU, see [About ExpressRoute virtual network gateways](expressroute-about-virtual-network-gateways.md#aggthroughput).
If your ExpressRoute circuit is enabled for Azure Microsoft peering, you can acc
* CDN * Azure Front Door
-* Multi-factor Authentication Server (legacy)
+* Multifactor Authentication Server (legacy)
* Traffic Manager * Logic Apps
You can update the bandwidth of the ExpressRoute circuit using the Azure portal,
### I received a notification about maintenance on my ExpressRoute circuit. What is the technical effect of this maintenance?
-You should experience minimal to no disruption during maintenance if you operate your circuit in [active-active mode](./designing-for-high-availability-with-expressroute.md#active-active-connections). Maintenance gets performed on the primary and secondary connections of your circuit separately. During maintenance, you may see longer AS-path prepend over one of the connections. The reason is to gracefully shift traffic from one connection to another. You must not ignore longer AS path, as it can cause asymmetric routing, resulting in a service outage. It's advisable to configure [BFD](expressroute-bfd.md) for faster BGP failover between Primary and Secondary connection in the event a BGP failure is detected during maintenance. Scheduled maintenance is performed outside of business hours in the time zone of the peering location, and you can't select a maintenance time.
+You should experience minimal to no disruption during maintenance if you operate your circuit in [active-active mode](./designing-for-high-availability-with-expressroute.md#active-active-connections). Maintenance gets performed on the primary and secondary connections of your circuit separately. During maintenance, you might see longer AS-path prepend over one of the connections. The reason is to gracefully shift traffic from one connection to another. You must not ignore longer AS path, as it can cause asymmetric routing, resulting in a service outage. It's advisable to configure [BFD](expressroute-bfd.md) for faster BGP failover between Primary and Secondary connection in the event a BGP failure is detected during maintenance. Scheduled maintenance is performed outside of business hours in the time zone of the peering location, and you can't select a maintenance time.
### I received a notification about a software upgrade or maintenance on my ExpressRoute gateway. What is the technical effect of this maintenance?
-You should experience minimal to no disruption during a software upgrade or maintenance on your gateway. The ExpressRoute gateway is composed of multiple instances and during upgrades, instances are taken offline one at a time. There may be temporarily lower network throughput to the virtual network but the gateway itself doesn't experience any downtime.
+You should experience minimal to no disruption during a software upgrade or maintenance on your gateway. The ExpressRoute gateway is composed of multiple instances and during upgrades, instances are taken offline one at a time. There might be temporarily lower network throughput to the virtual network but the gateway itself doesn't experience any downtime.
### Why are certain ports opened on my ExpressRoute gateway?
Yes. ExpressRoute premium charges apply on top of ExpressRoute circuit charges a
ExpressRoute Local is a SKU of ExpressRoute circuit, in addition to the Standard SKU and the Premium SKU. A key feature of Local is that a Local circuit at an ExpressRoute peering location gives you access only to one or two Azure regions in or near the same metro. In contrast, a Standard circuit gives you access to all Azure regions in a geopolitical area and a Premium circuit to all Azure regions globally. Specifically, with a Local SKU you can only advertise routes over Microsoft and private peering from the corresponding local region of the ExpressRoute circuit. You won't receive routes for other regions different than the defined local region.
-ExpressRoute Local may not be available for an ExpressRoute Location. For peering location and supported Azure local region, see [locations and connectivity providers](expressroute-locations-providers.md#partners).
+ExpressRoute Local might not be available for an ExpressRoute Location. For peering location and supported Azure local region, see [locations and connectivity providers](expressroute-locations-providers.md#partners).
### What are the benefits of ExpressRoute Local?
For supported ExpressRoute provider ports contact ErTCasks@microsoft.com.
### What is the effect of maintenance on flow logging?
-You should experience minimal to no disruption during maintenance on your ExpressRoute Traffic Collector. ExpressRoute Traffic Collector has multiple instances on different update domains, during an upgrade, instances are taken offline one at a time. While you may experience lower ingestion of sample flows into the Log Analytics workspace, the ExpressRoute Traffic Collector itself doesn't experience any downtime. Loss of sampled flows during maintenance shouldn't affect network traffic analysis, when sampled data is aggregated over a longer time frame.
+You should experience minimal to no disruption during maintenance on your ExpressRoute Traffic Collector. ExpressRoute Traffic Collector has multiple instances on different update domains, during an upgrade, instances are taken offline one at a time. While you might experience lower ingestion of sample flows into the Log Analytics workspace, the ExpressRoute Traffic Collector itself doesn't experience any downtime. Loss of sampled flows during maintenance shouldn't affect network traffic analysis, when sampled data is aggregated over a longer time frame.
### Does ExpressRoute Traffic Collector support availability zones?
ExpressRoute Traffic Collector deployment by default has availability zones enab
You can associate a single ExpressRoute Direct circuit with multiple ExpressRoute Traffic Collectors deployed in different Azure region within a given geo-political region. It's recommended that you associate your ExpressRoute Direct circuit with multiple ExpressRoute Traffic Collectors as part of your disaster recovery and high availability plan.
+## <a name="customer-controlled"></a>Customer-controlled gateway maintenance
++
+### How do I find out more about customer-controlled gateway maintenance?
+
+For more information, see the [ExpressRoute customer-controlled gateway maintenance](customer-controlled-gateway-maintenance.md) article.
+ ## Privacy ### Does the ExpressRoute service store customer data?
expressroute How To Custom Route Alert https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/expressroute/how-to-custom-route-alert.md
At the end of the workflow configuration, you can check the consistency of the r
A logic app workflow accesses other apps, services, and the platform though connectors. The next step is to select a connector to access the Azure Automation account that was defined earlier.
-1. In **Logic Apps Designer**, below **Recurrence**, select **New step**. Under **Choose an action** and the the search box, select **All**.
+1. In **Logic Apps Designer**, below **Recurrence**, select **New step**. Under **Choose an action** and the search box, select **All**.
2. In the search box, type **Azure Automation** and search. Select **Create job**. **Create job** will be used to fire the automation runbook that was created earlier. :::image type="content" source="./media/custom-route-alert-portal/create-job.png" alt-text="Create job":::
Logic Apps provides many email connectors. In this example, we add an Outlook co
:::image type="content" source="./media/custom-route-alert-portal/office-365.png" alt-text="Sign in":::
-4. In the **Body** field, click **Add dynamic content**. From the Dynamic content panel, add the the variable **Emailbody**. Fill out the **Subject** and **To** fields.
+4. In the **Body** field, click **Add dynamic content**. From the Dynamic content panel, add the variable **Emailbody**. Fill out the **Subject** and **To** fields.
:::image type="content" source="./media/custom-route-alert-portal/emailbody.png" alt-text="Body":::
firewall-manager Migrate To Policy https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/firewall-manager/migrate-to-policy.md
If ($azfw.NetworkRuleCollections.Count -gt 0)
#Translate NatRuleCollection # Hierarchy for NAT rule collection is different for AZFW and FirewallPolicy. In AZFW you can have a NatRuleCollection with multiple NatRules # where each NatRule will have its own set of source , dest, translated IPs and ports.
-# In FirewallPolicy a NatRuleCollection has a a set of rules which has one condition (source and dest IPs and Ports) and the translated IP and ports
+# In FirewallPolicy a NatRuleCollection has a set of rules which has one condition (source and dest IPs and Ports) and the translated IP and ports
# as part of NatRuleCollection. # So when translating NAT rules we will have to create separate ruleCollection for each rule in AZFW and every ruleCollection will have only 1 rule. Write-Host "creating " $azfw.NatRuleCollections.Count " NAT rule collections"
frontdoor Front Door Diagnostics https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/frontdoor/front-door-diagnostics.md
Metrics are a feature for certain Azure resources that allow you to view perform
Activity logs provide information about the operations done on an Azure Front Door (classic) profile. They also determine the what, who, and when for any write operations (put, post, or delete) done against an Azure Front Door (classic) profile. >[!NOTE]
->If a request to the the origin times out, the value for HttpStatusCode is set to **0**.
+>If a request to the origin times out, the value for HttpStatusCode is set to **0**.
Access activity logs in your Front Door or all the logs of your Azure resources in Azure Monitor. To view activity logs:
frontdoor Front Door Routing Limits https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/frontdoor/front-door-routing-limits.md
Add together all of the composite route metrics for each route. This is your pro
### Example
-Suppose you have have two routes in your Front Door profile. The routes are named *Route 1* and *Route 2*. You plan to configure the routes as follows:
+Suppose you have two routes in your Front Door profile. The routes are named *Route 1* and *Route 2*. You plan to configure the routes as follows:
* *Route 1* will have 50 domains associated to it, and requires HTTPS for all inbound requests. *Route 1* specifies 80 paths. * *Route 2* will have 25 domains associated to it. *Route 2* specifies 25 paths, and supports both the HTTP and HTTPS protocols.
frontdoor Troubleshoot Compression https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/frontdoor/standard-premium/troubleshoot-compression.md
Navigate to your endpoint in the [Azure portal](https://portal.azure.com) and se
The **Via** HTTP header indicates to the web server that the request is being passed by a proxy server. Microsoft IIS web servers by default don't compress responses when the request contains a **Via** header. To override this behavior, do the following:
-* **IIS 6**: Set HcNoCompressionForProxies="FALSE" in the IIS Metabase properties. For for information, see [IIS 6 Compression](/previous-versions/iis/6.0-sdk/ms525390(v=vs.90)).
+* **IIS 6**: Set HcNoCompressionForProxies="FALSE" in the IIS Metabase properties. For more information, see [IIS 6 Compression](/previous-versions/iis/6.0-sdk/ms525390(v=vs.90)).
* **IIS 7 and up**: Set both **noCompressionForHttp10** and **noCompressionForProxies** to *False* in the server configuration. For more information, see, [HTTP Compression](https://www.iis.net/configreference/system.webserver/httpcompression). ## Next steps
governance Effects https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/governance/policy/concepts/effects.md
definitions as `constraintTemplate` is deprecated.
location must be publicly accessible. > [!WARNING]
- > Don't use SAS URIs, URL tokens, or or anything else that could expose secrets in plain text.
+ > Don't use SAS URIs, URL tokens, or anything else that could expose secrets in plain text.
- If _Base64Encoded_, paired with property `content` to provide the base 64 encoded constraint template. See
governance Built In Initiatives https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/governance/policy/samples/built-in-initiatives.md
Title: List of built-in policy initiatives description: List built-in policy initiatives for Azure Policy. Categories include Regulatory Compliance, Guest Configuration, and more. Previously updated : 10/23/2023 Last updated : 11/03/2023
governance Built In Policies https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/governance/policy/samples/built-in-policies.md
Title: List of built-in policy definitions description: List built-in policy definitions for Azure Policy. Categories include Tags, Regulatory Compliance, Key Vault, Kubernetes, Guest Configuration, and more. Previously updated : 10/23/2023 Last updated : 11/03/2023
governance Guest Configuration Baseline Linux https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/governance/policy/samples/guest-configuration-baseline-linux.md
For more information, see [Azure Policy guest configuration](../concepts/guest-c
|Ensure SSH MaxAuthTries is set to 6 or less<br /><sub>(106.7)</sub> |Description: Setting the `MaxAuthTries `parameter to a low number will minimize the risk of successful brute force attacks to the SSH server. While the recommended setting is 4, set the number based on site policy. |Ensure SSH MaxAuthTries is set to 6 or less Edit the `/etc/ssh/sshd_config` file to set the parameter as follows: ``` MaxAuthTries 6 ``` | |Ensure SSH access is limited<br /><sub>(106.11)</sub> |Description: Restricting which users can remotely access the system via SSH will help ensure that only authorized users access the system. |Ensure SSH access is limited Edit the `/etc/ssh/sshd_config` file to set one or more of the parameter as follows: ``` AllowUsers AllowGroups DenyUsers DenyGroups ``` | |Emulation of the rsh command through the ssh server should be disabled. - '/etc/ssh/sshd_config RhostsRSAAuthentication = no'<br /><sub>(107)</sub> |Description: An attacker could use flaws in the RHosts protocol to gain access |Run the command '/opt/microsoft/omsagent/plugin/omsremediate -r disable-ssh-rhost-rsa-auth'. This will add the line 'RhostsRSAAuthentication no' to the file '/etc/ssh/sshd_config' |
-|SSH host-based authentication should be disabled. - '/etc/ssh/sshd_config HostbasedAuthentication = no'<br /><sub>(108)</sub> |Description: An attacker could use use host-based authentication to gain access from a compromised host |Run the command '/opt/microsoft/omsagent/plugin/omsremediate -r disable-ssh-host-based-auth'. This will add the line 'HostbasedAuthentication no' to the file '/etc/ssh/sshd_config' |
+|SSH host-based authentication should be disabled. - '/etc/ssh/sshd_config HostbasedAuthentication = no'<br /><sub>(108)</sub> |Description: An attacker could use host-based authentication to gain access from a compromised host |Run the command '/opt/microsoft/omsagent/plugin/omsremediate -r disable-ssh-host-based-auth'. This will add the line 'HostbasedAuthentication no' to the file '/etc/ssh/sshd_config' |
|Root login via SSH should be disabled. - '/etc/ssh/sshd_config PermitRootLogin = no'<br /><sub>(109)</sub> |Description: An attacker could brute force the root password, or hide their command history by logging in directly as root |Run the command '/usr/local/bin/azsecd remediate -r disable-ssh-root-login'. This will add the line 'PermitRootLogin no' to the file '/etc/ssh/sshd_config' | |Remote connections from accounts with empty passwords should be disabled. - '/etc/ssh/sshd_config PermitEmptyPasswords = no'<br /><sub>(110)</sub> |Description: An attacker could gain access through password guessing |Run the command '/usr/local/bin/azsecd remediate (/opt/microsoft/omsagent/plugin/omsremediate) -r disable-ssh-empty-passwords'. This will add the line 'PermitEmptyPasswords no' to the file '/etc/ssh/sshd_config' | |Ensure SSH Idle Timeout Interval is configured.<br /><sub>(110.1)</sub> |Description: Having no timeout value associated with a connection could allow an unauthorized user access to another user's ssh session. Setting a timeout value at least reduces the risk of this happening. While the recommended setting is 300 seconds (5 minutes), set this timeout value based on site policy. The recommended setting for `ClientAliveCountMax` is 0. In this case, the client session will be terminated after 5 minutes of idle time and no keepalive messages will be sent. |Edit the /etc/ssh/sshd_config file to set the parameters according to the policy |
hdinsight-aks Cosmos Db For Apache Cassandra https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight-aks/flink/cosmos-db-for-apache-cassandra.md
public class CassandraUtils {
/**
- * This method creates a Cassandra Session based on the the end-point details given in config.properties.
+ * This method creates a Cassandra Session based on the end-point details given in config.properties.
* This method validates the SSL certificate based on ssl_keystore_file_path & ssl_keystore_password properties. * If ssl_keystore_file_path & ssl_keystore_password are not given then it uses 'cacerts' from JDK. * @return Session Cassandra Session
hdinsight-aks Trino Caching https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight-aks/trino/trino-caching.md
Title: Configure caching
description: Learn how to configure caching in Trino Previously updated : 10/19/2023 Last updated : 11/03/2023 # Configure caching
Last updated 10/19/2023
Querying object storage using the Hive connector is a common use case for Trino. This process often involves sending large amounts of data. Objects are retrieved from HDFS or another supported object store by multiple workers and processed by those workers. Repeated queries with different parameters, or even different queries from different users, often access and transfer the same objects.
-HDInsight on AKS has added **final result caching** capability for Trino, which provides the following benefits:
+HDInsight on AKS added **final result caching** capability for Trino, which provides the following benefits:
* Reduce the load on object storage. * Improve the query performance.
Available configuration parameters are:
>limit 10; >```
+Final result caching produces **JMX metrics** which can be viewed using [Managed Prometheus and Grafana](../monitor-with-prometheus-grafana.md). The following metrics are available:
+
+|Metric|Description|
+|||
+|`trino_cache_cachestats_requestcount`|Total number of queries going through cache layer. This number doesn't include queries executed with cache off.|
+|`trino_cache_cachestats_hitcount`|Number of cache hits i.e. number of queries when data was available and returned from the cache.|
+|`trino_cache_cachestats_misscount`|Number of cache misses i.e. number of queries when data wasn't available and had to be cached.|
+|`trino_cache_cachestats_hitrate`|Percentage representation of cache hits against total number of queries.|
+|`trino_cache_cachestats_totalevictedcount`|Number of cached queries evicted from the cache.|
+|`trino_cache_cachestats_totalbytesfromsource`|Number of bytes read from the source.|
+|`trino_cache_cachestats_totalbytesfromcache`|Number of bytes read from the cache.|
+|`trino_cache_cachestats_totalcachedbytes`|Total number of bytes cached.|
+|`trino_cache_cachestats_totalevictedbytes`|Total Number of bytes evicted.|
+|`trino_cache_cachestats_spaceused`|Current size of the cache.|
+|`trino_cache_cachestats_cachereadfailures`|Number of times when data can't be read from the cache due to any error.|
+|`trino_cache_cachestats_cachewritefailures`|Number of times when data can't be written into the cache due to any error.|
+ ### Using Azure portal 1. Sign in to [Azure portal](https://portal.azure.com).
hdinsight Disk Encryption https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight/disk-encryption.md
The contents of the resource management template, `azuredeploy.json`:
### Rotating the encryption key
-You can change the encryption keys used on your running cluster, using the Azure portal or Azure CLI. For this operation, the cluster must have access to both the current key and the intended new key, otherwise the rotate key operation will fail. For clusters created after the the November 2020 release you can choose if you want to your new key to have a version or not. For clusters created before the November 2020 release, you must use a versioned key when rotating the encryption key.
+You can change the encryption keys used on your running cluster, using the Azure portal or Azure CLI. For this operation, the cluster must have access to both the current key and the intended new key, otherwise the rotate key operation will fail. For clusters created after the November 2020 release you can choose if you want to your new key to have a version or not. For clusters created before the November 2020 release, you must use a versioned key when rotating the encryption key.
#### Using the Azure portal
hdinsight Apache Hive Migrate Workloads https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight/interactive-query/apache-hive-migrate-workloads.md
Create a directory called "schemacompare" under "/tmp" directory.
Put the "schemacompare_final.py" and "test.csv" into the folder "/tmp/schemacompare". Do "ls -ltrh /tmp/schemacompare/" and verify whether the files are present.
-To execute the Python script, use the command "python schemacompare_final.py". This script starts executing the script and it takes less than five minutes to complete. The above script automatically connects to your backend DB and fetches the details from each and every table, which Hive uses and update the details in the new csv file called "return.csv". After after creating the file return.csv, it compares the data with the file "test.csv" and prints the column name or datatype if there's anything missing under the tablename.
+To execute the Python script, use the command "python schemacompare_final.py". This script starts executing the script and it takes less than five minutes to complete. The above script automatically connects to your backend DB and fetches the details from each and every table, which Hive uses and update the details in the new csv file called "return.csv". After creating the file return.csv, it compares the data with the file "test.csv" and prints the column name or datatype if there's anything missing under the tablename.
Once after executing the script you can see the following lines, which indicate that the details are fetched for the tables and the script is in progressing
hdinsight Apache Hive Replication https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight/interactive-query/apache-hive-replication.md
The following steps are the sequential events that take place during the Hive Re
1. The `REPL_LOAD` command is issued from the secondary cluster. The command points to the path configured in Step 3.
-1. The secondary cluster reads the metadata file with tracked events that was created in Step 3. Ensure that that the secondary cluster has network connectivity to the Azure Data Lake Storage Gen2 storage of the primary cluster where the tracked events from `REPL_DUMP` are stored.
+1. The secondary cluster reads the metadata file with tracked events that was created in Step 3. Ensure that the secondary cluster has network connectivity to the Azure Data Lake Storage Gen2 storage of the primary cluster where the tracked events from `REPL_DUMP` are stored.
1. The secondary cluster spawns distributed copy (`DistCP`) compute.
hdinsight Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight/policy-reference.md
Title: Built-in policy definitions for Azure HDInsight description: Lists Azure Policy built-in policy definitions for Azure HDInsight. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
hdinsight Share Hive Metastore With Synapse https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/hdinsight/share-hive-metastore-with-synapse.md
If the underlying data of your Hive tables are stored in Azure Blob storage acco
3. Provide **Name** of the linked service. Record the name of the linked service, this info will be used in Spark session configuration shortly. 4. Select the Azure Blob Storage account. Make sure Authentication method is **Account key**. Currently Spark pool can only access Blob Storage account via account key. 5. **Test connection** and click **Create**.
-6. After creating the linked service to Blob Storage account, when you run Spark queries, make sure you run below Spark code in the notebook to get access to the the Blob Storage account for the Spark session. Learn more about why you need to do this [here](../synapse-analytics/spark/apache-spark-secure-credentials-with-tokenlibrary.md).
+6. After creating the linked service to Blob Storage account, when you run Spark queries, make sure you run below Spark code in the notebook to get access to the Blob Storage account for the Spark session. Learn more about why you need to do this [here](../synapse-analytics/spark/apache-spark-secure-credentials-with-tokenlibrary.md).
``` %%pyspark
healthcare-apis Overview Of Search https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/azure-api-for-fhir/overview-of-search.md
GET {{FHIR_URL}}/metadata
To see the search parameters in the capability statement, navigate to `CapabilityStatement.rest.resource.searchParam` to see the search parameters for each resource and `CapabilityStatement.rest.searchParam` to find the search parameters for all resources. > [!NOTE]
-> The Azure API for FHIR does not automatically create or index any search parameters that are not defined by the FHIR specification. However, we do provide support for you to to define your own [search parameters](how-to-do-custom-search.md).
+> The Azure API for FHIR does not automatically create or index any search parameters that are not defined by the FHIR specification. However, we do provide support for you to define your own [search parameters](how-to-do-custom-search.md).
### Composite search parameters Composite search allows you to search against value pairs. For example, if you were searching for a height observation where the person was 60 inches, you would want to make sure that a single component of the observation contained the code of height **and** the value of 60. You wouldn't want to get an observation where a weight of 60 and height of 48 was stored, even though the observation would have entries that qualified for value of 60 and code of height, just in different component sections.
healthcare-apis Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/azure-api-for-fhir/policy-reference.md
Title: Built-in policy definitions for Azure API for FHIR description: Lists Azure Policy built-in policy definitions for Azure API for FHIR. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
healthcare-apis Api Versioning Dicom Service https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/api-versioning-dicom-service.md
description: This guide gives an overview of the API version policies for the DI
-+ Last updated 10/13/2023
healthcare-apis Configure Cross Origin Resource Sharing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/configure-cross-origin-resource-sharing.md
Last updated 10/09/2023 -+ # Configure cross-origin resource sharing
healthcare-apis Dicom Change Feed Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-change-feed-overview.md
Title: Overview of DICOM change feed - Azure Health Data Services
description: In this article, you learn the concepts of DICOM change feed. -+ Last updated 10/9/2023
healthcare-apis Dicom Digital Pathology https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-digital-pathology.md
description: This guide is on using DICOM service for digital pathology
-+ Last updated 10/9/2023
healthcare-apis Dicom Extended Query Tags Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-extended-query-tags-overview.md
Title: DICOM extended query tags overview - Azure Health Data Services
description: In this article, you'll learn the concepts of Extended Query Tags. -+ Last updated 10/9/2023
healthcare-apis Dicom Register Application https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-register-application.md
Title: Register a client application for the DICOM service in Microsoft Entra ID
description: Learn how to register a client application for the DICOM service in Microsoft Entra ID. -+ Last updated 09/02/2022
healthcare-apis Dicom Service V2 Api Changes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-service-v2-api-changes.md
description: This guide gives an overview of the changes in the v2 API for the D
-+ Last updated 10/13/2023
healthcare-apis Dicom Services Conformance Statement V2 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-services-conformance-statement-v2.md
description: This document provides details about the DICOM Conformance Statemen
-+ Last updated 10/13/2023
healthcare-apis Dicom Services Conformance Statement https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/dicom/dicom-services-conformance-statement.md
description: This document provides details about the DICOM Conformance Statemen
-+ Last updated 10/13/2023
healthcare-apis Device Messages Through Iot Hub https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/iot/device-messages-through-iot-hub.md
You complete the steps by using Visual Studio Code with the Azure IoT Hub extens
* **Edit**: Clear any existing text, and then copy/paste the following test message JSON. > [!TIP]
- > You can use the **Copy** option in in the right corner of the below test message, and then paste it within the **Edit** window.
+ > You can use the **Copy** option in the right corner of the below test message, and then paste it within the **Edit** window.
```json {
healthcare-apis How To Configure Metrics https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/iot/how-to-configure-metrics.md
Metric category|Metric name|Metric description|
> [!IMPORTANT] > If you leave the MedTech service metrics page, the metrics settings for your MedTech service are lost and will have to be recreated. If you would like to save your MedTech service metrics for future viewing, you can pin them to an Azure portal dashboard as a tile. >
- > To learn how to to create an Azure portal dashboard and pin tiles, see [How to create an Azure portal dashboard and pin tiles](how-to-configure-metrics.md#how-to-create-an-azure-portal-dashboard-and-pin-tiles)
+ > To learn how to create an Azure portal dashboard and pin tiles, see [How to create an Azure portal dashboard and pin tiles](how-to-configure-metrics.md#how-to-create-an-azure-portal-dashboard-and-pin-tiles)
> [!TIP] > To learn more about advanced metrics display and sharing options, see [Analyze metrics with Azure Monitor metrics explorer](../../azure-monitor/essentials/analyze-metrics.md).
healthcare-apis Overview Of Device Mapping https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/iot/overview-of-device-mapping.md
The normalization process validates the device mapping before allowing it to be
|values[].required |True |True | > [!IMPORTANT]
-> The **Resolution type** specifies how the MedTech service associates device data with Device resources and Patient resources. The MedTech service reads Device and Patient resources from the FHIR service using [device identifiers](https://www.hl7.org/fhir/r4/device-definitions.html#Device.identifier) and [patient identifiers](https://www.hl7.org/fhir/r4/patient-definitions.html#Patient.identifier). If an [encounter identifier](https://hl7.org/fhir/r4/encounter-definitions.html#Encounter.identifier) is specified and extracted from the device data payload, it's linked to the observation if an encounter exists on the FHIR service with that identifier. If the [encounter identifier](../../healthcare-apis/release-notes.md#medtech-service) is successfully normalized, but no FHIR Encounter exists with that encounter identifier, a **FhirResourceNotFound** exception is thrown. For more information on configuring the the MedTech service **Resolution type**, see [Configure the Destination tab](deploy-manual-portal.md#configure-the-destination-tab).
+> The **Resolution type** specifies how the MedTech service associates device data with Device resources and Patient resources. The MedTech service reads Device and Patient resources from the FHIR service using [device identifiers](https://www.hl7.org/fhir/r4/device-definitions.html#Device.identifier) and [patient identifiers](https://www.hl7.org/fhir/r4/patient-definitions.html#Patient.identifier). If an [encounter identifier](https://hl7.org/fhir/r4/encounter-definitions.html#Encounter.identifier) is specified and extracted from the device data payload, it's linked to the observation if an encounter exists on the FHIR service with that identifier. If the [encounter identifier](../../healthcare-apis/release-notes.md#medtech-service) is successfully normalized, but no FHIR Encounter exists with that encounter identifier, a **FhirResourceNotFound** exception is thrown. For more information on configuring the MedTech service **Resolution type**, see [Configure the Destination tab](deploy-manual-portal.md#configure-the-destination-tab).
> [!NOTE] > The `values[].valueName, values[].valueExpression`, and `values[].required` elements are only required if you have a value entry in the array. It's valid to have no values mapped. These elements are used when the telemetry being sent is an event.
healthcare-apis Overview Of Fhir Destination Mapping https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/healthcare-apis/iot/overview-of-fhir-destination-mapping.md
CollectionFhir is the root template type used by the MedTech service FHIR destin
CodeValueFhir is currently the only template supported in the FHIR destination mapping. It allows you to define codes, the effective period, and the value of the observation. Multiple value types are supported: [SampledData](https://www.hl7.org/fhir/datatypes.html#SampledData), [CodeableConcept](https://www.hl7.org/fhir/datatypes.html#CodeableConcept), [Quantity](https://www.hl7.org/fhir/datatypes.html#Quantity), and [String](https://www.hl7.org/fhir/datatypes.html#string). Along with these configurable values, the identifier for the Observation resource and linking to the proper Device and Patient resources are handled automatically. > [!IMPORTANT]
-> The **Resolution type** specifies how the MedTech service associates device data with Device resources and Patient resources. The MedTech service reads Device and Patient resources from the FHIR service using [device identifiers](https://www.hl7.org/fhir/r4/device-definitions.html#Device.identifier) and [patient identifiers](https://www.hl7.org/fhir/r4/patient-definitions.html#Patient.identifier). If an [encounter identifier](https://hl7.org/fhir/r4/encounter-definitions.html#Encounter.identifier) is specified and extracted from the device data payload, it's linked to the observation if an encounter exists on the FHIR service with that identifier. If the [encounter identifier](../../healthcare-apis/release-notes.md#medtech-service) is successfully normalized, but no FHIR Encounter exists with that encounter identifier, a **FhirResourceNotFound** exception is thrown. For more information on configuring the the MedTech service **Resolution type**, see [Configure the Destination tab](deploy-manual-portal.md#configure-the-destination-tab).
+> The **Resolution type** specifies how the MedTech service associates device data with Device resources and Patient resources. The MedTech service reads Device and Patient resources from the FHIR service using [device identifiers](https://www.hl7.org/fhir/r4/device-definitions.html#Device.identifier) and [patient identifiers](https://www.hl7.org/fhir/r4/patient-definitions.html#Patient.identifier). If an [encounter identifier](https://hl7.org/fhir/r4/encounter-definitions.html#Encounter.identifier) is specified and extracted from the device data payload, it's linked to the observation if an encounter exists on the FHIR service with that identifier. If the [encounter identifier](../../healthcare-apis/release-notes.md#medtech-service) is successfully normalized, but no FHIR Encounter exists with that encounter identifier, a **FhirResourceNotFound** exception is thrown. For more information on configuring the MedTech service **Resolution type**, see [Configure the Destination tab](deploy-manual-portal.md#configure-the-destination-tab).
|Element|Description|Required| |:|:-|:-|
iot-central Howto Authorize Rest Api https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-central/core/howto-authorize-rest-api.md
Title: Authorize REST API in Azure IoT Central
-description: How to authenticate and authorize IoT Central REST API calls by using bearer tokens or or an IoT Central API token.
+description: How to authenticate and authorize IoT Central REST API calls by using bearer tokens or an IoT Central API token.
Last updated 07/25/2022
iot-central Howto Migrate To Iot Hub https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-central/core/howto-migrate-to-iot-hub.md
You need the following prerequisites to complete the device migration steps:
## Device requirements
-The devices that you want to migrate must implement the **DeviceMove** command in a component called **migration**. The command payload contains the *ID scope* of the destination DPS instance. The migrator tool repository includes an example [DTDL component model](https://raw.githubusercontent.com/Azure/iotc-migrator/main/assets/deviceMigrationComponent.json) that that defines the **DeviceMove** command. You can add this component to your existing device templates.
+The devices that you want to migrate must implement the **DeviceMove** command in a component called **migration**. The command payload contains the *ID scope* of the destination DPS instance. The migrator tool repository includes an example [DTDL component model](https://raw.githubusercontent.com/Azure/iotc-migrator/main/assets/deviceMigrationComponent.json) that defines the **DeviceMove** command. You can add this component to your existing device templates.
The tool assumes that the component name is `migration` and that the interface ID is `dtmi:azureiot:DeviceMigration;1`:
iot-central Tutorial Connect Device https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-central/core/tutorial-connect-device.md
zone_pivot_groups: programming-languages-set-twenty-six
#- id: programming-languages-set-twenty-six # Title: Python
-#Customer intent: As a device developer, I want to try out using device code that uses one of the the Azure IoT device SDKs. I want to understand how to send telemetry from a device, synchronize properties with the device, and control the device using commands.
+#Customer intent: As a device developer, I want to try out using device code that uses one of the Azure IoT device SDKs. I want to understand how to send telemetry from a device, synchronize properties with the device, and control the device using commands.
# Tutorial: Create and connect a client application to your Azure IoT Central application
iot-develop Quickstart Devkit Stm B L475e Iot Hub https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-develop/quickstart-devkit-stm-b-l475e-iot-hub.md
To connect the STM DevKit to Azure, you modify a configuration file for Wi-Fi an
1. On the STM DevKit MCU, locate the **Reset** button (1), the Micro USB port (2), which is labeled **USB STLink**, and the board part number (3). You'll refer to these items in the next steps. All of them are highlighted in the following picture:
- :::image type="content" source="media/quickstart-devkit-stm-b-l475e-iot-hub/stm-devkit-board-475.png" alt-text="Photo that that shows key components on the STM DevKit board.":::
+ :::image type="content" source="media/quickstart-devkit-stm-b-l475e-iot-hub/stm-devkit-board-475.png" alt-text="Photo that shows key components on the STM DevKit board.":::
1. Connect the Micro USB cable to the **USB STLINK** port on the STM DevKit, and then connect it to your computer.
iot-develop Quickstart Devkit Stm B L4s5i Iot Hub https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-develop/quickstart-devkit-stm-b-l4s5i-iot-hub.md
To connect the STM DevKit to Azure, you modify a configuration file for Wi-Fi an
1. On the STM DevKit MCU, locate the **Reset** button (1), the Micro USB port (2), which is labeled **USB STLink**, and the board part number (3). You'll refer to these items in the next steps. All of them are highlighted in the following picture:
- :::image type="content" source="media/quickstart-devkit-stm-b-l4s5i-iot-hub/stm-b-l4s5i.png" alt-text="Photo that that shows key components on the STM DevKit board.":::
+ :::image type="content" source="media/quickstart-devkit-stm-b-l4s5i-iot-hub/stm-b-l4s5i.png" alt-text="Photo that shows key components on the STM DevKit board.":::
1. Connect the Micro USB cable to the **USB STLINK** port on the STM DevKit, and then connect it to your computer.
iot-dps Iot Dps Ip Filtering https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-dps/iot-dps-ip-filtering.md
To edit an existing rule:
1. Select the IP filter rule data you want to change.
- :::image type="content" source="./media/iot-dps-ip-filtering/ip-filter-rule-edit.png" alt-text="Edit an an IP filter rule.":::
+ :::image type="content" source="./media/iot-dps-ip-filtering/ip-filter-rule-edit.png" alt-text="Edit an IP filter rule.":::
2. Make the change.
iot-dps Monitor Iot Dps Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-dps/monitor-iot-dps-reference.md
DPS uses the [AzureDiagnostics](/azure/azure-monitor/reference/tables/azurediagn
| Resource | String | The name forOF the resource where the event took place. For example, "MYEXAMPLEDPS". | | ResourceGroup | String | The name of the resource group where the resource is located. | | ResourceId | String | The Azure Resource Manager Resource ID for the resource where the event took place. |
-| ResourceProvider | String | The resource provider for the the event. For example, "MICROSOFT.DEVICES". |
+| ResourceProvider | String | The resource provider for the event. For example, "MICROSOFT.DEVICES". |
| ResourceType | String | The resource type for the event. For example, "PROVISIONINGSERVICES". | | ResultDescription | String | Error details for the event if unsuccessful. | | ResultSignature | String | HTTP status code for the event if unsuccessful. |
iot-hub-device-update Migration Public Preview Refresh To Ga https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-hub-device-update/migration-public-preview-refresh-to-ga.md
As the Device Update for IoT Hub service releases new versions, you'll want to u
To migrate successfully, you will have to upgrade the DU agent running on your devices. Note that as there are major changes with the GA release, we recommend that you follow the instructions closely to avoid errors. > [!NOTE]
-> All PPR device groups created will be automatically changed to GA groups. The groups and devices will be available after migration. The deployment history will not carry over to the the updated GA groups.
+> All PPR device groups created will be automatically changed to GA groups. The groups and devices will be available after migration. The deployment history will not carry over to the updated GA groups.
## Update the Device Update agent
iot-hub Migrate Tls Certificate https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-hub/migrate-tls-certificate.md
Previously updated : 10/31/2023 Last updated : 11/03/2023 # Migrate IoT Hub resources to a new TLS certificate root
You should start planning now for the effects of migrating your IoT hubs to the
## Timeline
-The IoT Hub team began migrating IoT hubs in February, 2023 and all IoT hubs have been migrated except for those that have already been approved for a later migration.
+The IoT Hub team began migrating IoT hubs in February, 2023 and the migration is complete except for hubs that have already been approved for a later migration. If your IoT hub is found to be using the Baltimore certificate without an agreement in place with the product team, your hub will be migrated without any further notice.
After all IoT hubs have migrated, DPS will perform its migration between January 15 and February 15, 2024.
-For each IoT hub, you can expect the following:
+For each IoT hub with an extension agreement in place, you can expect the following:
* **One to two weeks before migration**: The subscription owners of each IoT hub receive an email notification informing them of their migration date. This notification doesn't apply to hubs that are manually migrated. * **Day of the migration**: The IoT hub switches its TLS certificate to the DigiCert Global Root G2, which results in no downtime for the IoT hub. IoT Hub doesn't force device reconnections.
For each IoT hub, you can expect the following:
### Request an extension
-As of August, 2023 the extension request process is closed for IoT Hub and IoT Central.
+As of August, 2023 the extension request process is closed for IoT Hub and IoT Central. If your IoT hub is found to be using the Baltimore certificate without an extension agreement in place with the product team, your hub will be migrated without any further notice.
## Required steps
iot-hub Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot-hub/policy-reference.md
Title: Built-in policy definitions for Azure IoT Hub description: Lists Azure Policy built-in policy definitions for Azure IoT Hub. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
iot Iot Phone App How To https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/iot/iot-phone-app-how-to.md
To view the data the device is sending in your IoT Central application:
1. Sign in to your IoT Central application and navigate to the **Devices** page. Your device has been automatically assigned to the **Smartphone** device template. > [!TIP]
- > You may need to refresh the page in your web browser to see when the device is assigned to the the **Smartphone** device template.
+ > You may need to refresh the page in your web browser to see when the device is assigned to the **Smartphone** device template.
1. On the list of devices, click on the device name and then select **Overview**. The **Overview** page shows the telemetry from the smartphone sensors:
key-vault Quick Create Java https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/key-vault/certificates/quick-create-java.md
Title: Quickstart for Azure Key Vault Certificate client library - Java
-description: Learn about the the Azure Key Vault Certificate client library for Java with the steps in this quickstart.
+description: Learn about the Azure Key Vault Certificate client library for Java with the steps in this quickstart.
key-vault Key Management https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/key-vault/managed-hsm/key-management.md
az login
For more information on login options via the CLI, see [sign in with Azure CLI](/cli/azure/authenticate-azure-cli) > [!NOTE]
-> All the commands below show two usage methods. One using **--hsm-name** and **--name** (for key name) parameters and another using **--id** parameter where you can specify entire url including including key name where appropriate. The latter method is useful when the caller (a user or an application) has no read access on the control plane and only restricted access on the data plane.
+> All the commands below show two usage methods. One using **--hsm-name** and **--name** (for key name) parameters and another using **--id** parameter where you can specify the entire url including the key name where appropriate. The latter method is useful when the caller (a user or an application) has no read access on the control plane and only restricted access on the data plane.
> [!NOTE]
-> Some interactions with key material require specific Local RBAC permissions. For a full list of of built-in Local RBAC roles and permissions, see [Managed HSM local RBAC built-in roles](./built-in-roles.md). To assign these permissions to a user, see [Secure access to your managed HSMs](./secure-your-managed-hsm.md)
+> Some interactions with key material require specific Local RBAC permissions. For a full list of built-in Local RBAC roles and permissions, see [Managed HSM local RBAC built-in roles](./built-in-roles.md). To assign these permissions to a user, see [Secure access to your managed HSMs](./secure-your-managed-hsm.md)
## Create an HSM key > [!NOTE]
key-vault Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/key-vault/policy-reference.md
Title: Built-in policy definitions for Key Vault description: Lists Azure Policy built-in policy definitions for Key Vault. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
kinect-dk Body Sdk Setup https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/kinect-dk/body-sdk-setup.md
Launch the [Azure Kinect Viewer](azure-kinect-viewer.md) to check that your Azur
Launch the **Azure Kinect Body Tracking Viewer** to check that the Body Tracking SDK is set up correctly. The viewer is installed with the SDK msi installer. You can find it at your start menu or at `<SDK Installation Path>\tools\k4abt_simple_3d_viewer.exe`.
-If you don't have a powerful enough GPU and still want to test the result, you can launch the the **Azure Kinect Body Tracking Viewer** in the command line by the following command: `<SDK Installation Path>\tools\k4abt_simple_3d_viewer.exe CPU`
+If you don't have a powerful enough GPU and still want to test the result, you can launch the **Azure Kinect Body Tracking Viewer** in the command line by the following command: `<SDK Installation Path>\tools\k4abt_simple_3d_viewer.exe CPU`
If everything is set up correctly, a window with a 3D point cloud and tracked bodies should appear.
lab-services How To Create Schedules https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/lab-services/how-to-create-schedules.md
Create a scheduled event for the lab so that VMs in the lab are automatically st
> Before we get started, here's how schedules affect lab virtual machines: > >- Template virtual machine is not included in schedules.
->- Only assigned virtual machines are started. This means, if a machine is not claimed by an end user (student), the the machine will not start on the scheduled hours.
+>- Only assigned virtual machines are started. This means, if a machine is not claimed by an end user (student), the machine will not start on the scheduled hours.
>- All virtual machines (whether claimed by a user or not) are stopped based on the lab schedule. 1. Switch to the **Schedules** page, and select **Add scheduled event** on the toolbar.
lab-services How To Enable Nested Virtualization Template Vm Using Script https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/lab-services/how-to-enable-nested-virtualization-template-vm-using-script.md
The following steps describe the actions to enable Hyper-V on Windows Server usi
2. On the **Before you begin** page, select **Next**. 3. On the **Select installation type** page, keep the default selection of Role-based or feature-based installation and then select **Next**.
-4. On the **Select destination server** page, select Select a server from the server pool. The current server is already selected. Select **Next**.
+4. On the **Select destination server** page, select a server from the server pool. The current server is already selected. Select **Next**.
5. On the **Select server roles** page, select **Hyper-V**. 6. The **Add Roles and Features Wizard** pop-up appears. Select **Include management tools (if applicable)**. Select the **Add Features** button. 7. On the **Select server roles** page, select **Next**.
lab-services Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/lab-services/policy-reference.md
Title: Built-in policy definitions for Lab Services description: Lists Azure Policy built-in policy definitions for Azure Lab Services. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
lighthouse Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/lighthouse/concepts/enterprise.md
# Azure Lighthouse in enterprise scenarios
-A common scenario for [Azure Lighthouse](../overview.md) involves a service provider that manages resources in in its customers' Microsoft Entra tenants. The capabilities of Azure Lighthouse can also be used to simplify cross-tenant management within an enterprise that uses multiple Microsoft Entra tenants.
+A common scenario for [Azure Lighthouse](../overview.md) involves a service provider that manages resources in its customers' Microsoft Entra tenants. The capabilities of Azure Lighthouse can also be used to simplify cross-tenant management within an enterprise that uses multiple Microsoft Entra tenants.
## Single vs. multiple tenants
In cases where a [multitenant architecture](/azure/architecture/guide/multitenan
To use Azure Lighthouse in an enterprise, you'll need to determine which tenant will include the users who perform management operations on the other tenants. In other words, you will need to designate one tenant as the managing tenant for the other tenants.
-For example, say your organization has a single tenant that weΓÇÖll call *Tenant A*. Your organization then acquires *Tenant B* and *Tenant C*, and you you have business reasons that require you to maintain them as separate tenants. However, you'd like to use the same policy definitions, backup practices, and security processes for all of them, with management tasks performed by the same set of users.
+For example, say your organization has a single tenant that weΓÇÖll call *Tenant A*. Your organization then acquires *Tenant B* and *Tenant C*, and you have business reasons that require you to maintain them as separate tenants. However, you'd like to use the same policy definitions, backup practices, and security processes for all of them, with management tasks performed by the same set of users.
Since Tenant A already includes users in your organization who have been performing those tasks for Tenant A, you can onboard subscriptions within Tenant B and Tenant C, which allows the same users in Tenant A to perform those tasks across all tenants.
lighthouse Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/lighthouse/samples/policy-reference.md
Title: Built-in policy definitions for Azure Lighthouse description: Lists Azure Policy built-in policy definitions for Azure Lighthouse. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
logic-apps Azure Integration Services Choose Capabilities https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/azure-integration-services-choose-capabilities.md
Azure Integration Services offers many capabilities across this collection of in
| Service | When to choose | Why | ||-|--| | Azure Logic Apps | You have business processes to orchestrate across multiple systems where you understand their structures well. | - Provides greater developer productivity through the low-code workflow designer. <br><br>- Excels at wiring API calls together quickly using prebuilt, out-of-the-box connectors. <br><br>- Supports both synchronous and asynchronous processing. <br><br>- Offers rich debugging history for stateful workflows. <br><br>- Supports stateless workflows for low latency requirements. <br><br>- Supports creating custom APIs and custom connectors, which let you wrap existing REST APIs or SOAP APIs to access services where no prebuilt connector currently exists. (Consumption workflows only) <br><br> - Supports creating custom built-in connectors based on a service provider. (Standard workflows only) |
-| Azure Functions | You need to run complex business logic that's better implemented as code than as workflow expressions. <br><br>You need to build a centralized utility function that you can access from other integration platform components, such as Azure Logic Apps. <br><br>You have unique data transformation requirements. | Provides an event driven, compute-on-demand experience for developers that that need to extend the Azure application platform by implementing code triggered by events in Azure or other services and on-premises systems. |
+| Azure Functions | You need to run complex business logic that's better implemented as code than as workflow expressions. <br><br>You need to build a centralized utility function that you can access from other integration platform components, such as Azure Logic Apps. <br><br>You have unique data transformation requirements. | Provides an event driven, compute-on-demand experience for developers that need to extend the Azure application platform by implementing code triggered by events in Azure or other services and on-premises systems. |
| Azure Data Factory | You need the capability to transform and move large datasets across various data sources, such as file systems, database, SAP, Azure Blob Storage, Azure Data Explorer, Oracle, DB2, Amazon RDS, and more. | - Provides a cloud-based serverless ETL service for scale-out, dataset integration, and data transformation. Can handle large data and message processing requirements. <br><br>- Offers code-free UI for intuitive authoring and single-pane-of-glass monitoring and management. <br><br>- Supports lift-and-shift for existing SQL Server Integration Services (SSIS) packages to Azure and running them with full compatibility in Azure Data Factory. The SSIS Integration Runtime offers a fully managed service, so you don't have to worry about infrastructure management. | | Azure Service Bus | You need a messaging system that supports the publish-subscribe model, ordered delivery, duplicate detection, message scheduling, and message expiration scenarios. | - Provides a fully managed enterprise message broker with message queues and publish-subscribe topics. <br><br>- By decoupling applications and services from each other, this service provides the following benefits: <br><br> Load balancing across competing workers <br> Safe message routing, data transfer, and control across service and application boundaries <br> Coordinated transactional work that requires a high degree of reliability. <br><br>- Complements Azure Logic Apps and supports scenarios where you want to use SDKs, not connectors, to interact with Service Bus entities. | | Azure Event Grid | You need an event subscription architecture to stay updated on state changes in one or more applications and systems because your integration solutions depend heavily on events to communicate such changes and make any related data changes. | - Provides a highly scalable, serverless event broker for integrating applications using events. Event Grid delivers events to subscriber destinations such as applications, Azure services, or any endpoint where Event Grid has network access. Event sources can include applications, SaaS services, and Azure services. <br><br>- Increases efficiency by avoiding constant polling to determine state changes. As more underlying services emit events, subscription architecture increases in popularity. |
logic-apps Create Replication Tasks Azure Resources https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/create-replication-tasks-azure-resources.md
Based on the number of events that Event Hubs receives or messages that Service
The following examples illustrate hosting plan pricing tier and configuration options that provide the best throughput and cost for specific replication task scenarios, based on whether the scenario is Event Hubs or Service Bus and various configuration values. > [!NOTE]
-> The examples in the following sections use 800 as the default value for the the prefetch count,
+> The examples in the following sections use 800 as the default value for the prefetch count,
> maximum event batch size for Event Hubs, and maximum message count for Service Bus, assuming > that the event or message size is 1 KB. Based on your event sizes, you might want to adjust the > prefetch count, maximum event batch size, or maximum message count. For example, if your event
logic-apps Create Single Tenant Workflows Visual Studio Code https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/create-single-tenant-workflows-visual-studio-code.md
Deployment for the Standard logic app resource requires a hosting plan and prici
> > 1. In the Azure portal, go to your Application Insights resource. >
- > 2. On the resource resource menu, under **Investigate**, select **Application map**.
+ > 2. On the resource menu, under **Investigate**, select **Application map**.
> > 3. Review the operation names that appear in the map. >
logic-apps Mainframe Modernization Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/mainframe-modernization-overview.md
Title: Mainframe and midrange integration workflows
+ Title: Mainframe and midrange modernization
description: Learn about building mainframe and midrange system integration solutions in Azure Logic Apps using mainframe and midrange connectors.
logic-apps Monitor Logic Apps https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/monitor-logic-apps.md
Each time a trigger successfully fires, Azure Logic Apps creates a workflow inst
* In the **Logic app run details** pane, select the step that you want.
- ![Screenshot showing the the "Logic app run details" pane with the example failed step selected.](./media/monitor-logic-apps/select-failed-step.png)
+ ![Screenshot showing the "Logic app run details" pane with the example failed step selected.](./media/monitor-logic-apps/select-failed-step.png)
> [!NOTE] >
logic-apps Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/policy-reference.md
Title: Built-in policy definitions for Azure Logic Apps description: Lists Azure Policy built-in policy definitions for Azure Logic Apps. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023 ms.suite: integration
logic-apps Quickstart Create Deploy Azure Resource Manager Template https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/quickstart-create-deploy-azure-resource-manager-template.md
Follow the option that you want to use for deploying the quickstart template:
#### [CLI](#tab/azure-cli) ```azurecli-interactive
-read -p "Enter a project name name to use for generating resource names:" projectName &&
+read -p "Enter a project name to use for generating resource names:" projectName &&
read -p "Enter the location, such as 'westus':" location && templateUri="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.logic/logic-app-create/azuredeploy.json" && resourceGroupName="${projectName}rg" &&
logic-apps Quickstart Create Example Consumption Workflow https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/logic-apps/quickstart-create-example-consumption-workflow.md
This example uses an Office 365 Outlook action that sends an email each time tha
> other services might support or use different authentication types. Based on your scenario, > you can handle connection authentication in various ways. >
- > For example, if you use use Azure Resource Manager templates for deployment, you can increase
+ > For example, if you use Azure Resource Manager templates for deployment, you can increase
> security on inputs that change often by parameterizing values such as connection details. > For more information, review the following documentation: >
machine-learning Designer Error Codes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/component-reference/designer-error-codes.md
If the model was trained using any of the specialized training components, conne
The error of unique values is greater than allowed will occur if meeting **both** following conditions: - More than 97% instances of one column are unique values, which means nearly all categories are different from each other.-- One column has more than than 1000 unique values.
+- One column has more than 1000 unique values.
**Resolution:**
machine-learning Web Service Input Output https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/component-reference/web-service-input-output.md
Title: "Web Service Input/Output: Component reference"
-description: Learn how to use the the web service components in Azure Machine Learning designer to manage inputs and outputs.
+description: Learn how to use the web service components in Azure Machine Learning designer to manage inputs and outputs.
machine-learning Concept Soft Delete https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/concept-soft-delete.md
When deleting a workspace from the Azure portal, check __Delete the workspace pe
:::moniker range="azureml-api-1" > [!TIP]
-> The v1 SDK and CLI don't provide functionality to override the default soft-delete behavior. To override the default behavior from SDK or CLI, use the the v2 versions. For more information, see the [CLI & SDK v2](concept-v2.md) article or the [v2 version of this article](concept-soft-delete.md?view=azureml-api-2&preserve-view=true#deleting-a-workspace).
+> The v1 SDK and CLI don't provide functionality to override the default soft-delete behavior. To override the default behavior from SDK or CLI, use the v2 versions. For more information, see the [CLI & SDK v2](concept-v2.md) article or the [v2 version of this article](concept-soft-delete.md?view=azureml-api-2&preserve-view=true#deleting-a-workspace).
:::moniker-end :::moniker range="azureml-api-2"
machine-learning How To Access Azureml Behind Firewall https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-access-azureml-behind-firewall.md
__Azure Machine Learning compute instance and compute cluster hosts__
-__Docker images maintained by by Azure Machine Learning__
+__Docker images maintained by Azure Machine Learning__
| __Required for__ | __Hosts__ | __Protocol__ | __Ports__ | | -- | -- | -- | -- |
machine-learning How To Batch Scoring Script https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-batch-scoring-script.md
The `run()` method should return a Pandas `DataFrame` or an array/list. Each ret
> If you need to write predictions in a different way, you can [customize outputs in batch deployments](how-to-deploy-model-custom-output.md). > [!WARNING]
-> Do not not output complex data types (or lists of complex data types) rather than `pandas.DataFrame` in the `run` function. Those outputs will be transformed to string and they will be hard to read.
+> Do not output complex data types (or lists of complex data types) rather than `pandas.DataFrame` in the `run` function. Those outputs will be transformed to string and they will be hard to read.
The resulting DataFrame or array is appended to the output file indicated. There's no requirement on the cardinality of the results (1 file can generate 1 or many rows/elements in the output). All elements in the result DataFrame or array are written to the output file as-is (considering the `output_action` isn't `summary_only`).
machine-learning How To Mltable https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-mltable.md
ml_client = MLClient(
) # get the latest version of the data asset
-# Note: the variable VERSION is set in the previous code code
+# Note: the variable VERSION is set in the previous code
data_asset = ml_client.data.get(name="pets-mltable-example", version=VERSION) # the table from the data asset id
machine-learning How To Setup Mlops Azureml https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-setup-mlops-azureml.md
Title: Set up MLOps with Azure DevOps
description: Learn how to set up a sample MLOps environment in Azure Machine Learning --++ Previously updated : 11/29/2022 Last updated : 11/03/2023
machine-learning How To Share Models Pipelines Across Workspaces With Registries https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-share-models-pipelines-across-workspaces-with-registries.md
Fetch the scoring URI and submit a sample scoring request. Sample data for the s
```azurecli ENDPOINT_KEY=$(az ml online-endpoint get-credentials -n reg-ep-1234 -o tsv --query primaryKey)
-SCORING_URI=$(az ml online-endpoint show -n $ep_name -o tsv --query scoring_uri)
+SCORING_URI=$(az ml online-endpoint show -n reg-ep-1234 -o tsv --query scoring_uri)
curl --request POST "$SCORING_URI" --header "Authorization: Bearer $ENDPOINT_KEY" --header 'Content-Type: application/json' --data @./scoring-data.json ```
machine-learning How To Troubleshoot Kubernetes Extension https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/how-to-troubleshoot-kubernetes-extension.md
This table shows how to troubleshoot the error codes returned by the HealthCheck
|E45002 | PROMETHEUS_CONFLICT | The Prometheus Operator installed is conflict with your existing Prometheus Operator. For more information, see [Prometheus operator](#prometheus-operator) | |E45003 | BAD_NETWORK_CONNECTIVITY | You need to meet [network-requirements](./how-to-access-azureml-behind-firewall.md#scenario-use-kubernetes-compute).| |E45004 | AZUREML_FE_ROLE_CONFLICT |Azure Machine Learning extension isn't supported in the [legacy AKS](./how-to-attach-kubernetes-anywhere.md#kubernetescompute-and-legacy-akscompute). To install Azure Machine Learning extension, you need to [delete the legacy azureml-fe components](v1/how-to-create-attach-kubernetes.md#delete-azureml-fe-related-resources).|
-|E45005 | AZUREML_FE_DEPLOYMENT_CONFLICT | Azure Machine Learning extension isn't supported in the [legacy AKS](./how-to-attach-kubernetes-anywhere.md#kubernetescompute-and-legacy-akscompute). To install Azure Machine Learning extension, you need to [delete the legacy azureml-fe components](v1/how-to-create-attach-kubernetes.md#delete-azureml-fe-related-resources).|
+|E45005 | AZUREML_FE_DEPLOYMENT_CONFLICT | Azure Machine Learning extension isn't supported in the [legacy AKS](./how-to-attach-kubernetes-anywhere.md#kubernetescompute-and-legacy-akscompute). To install Azure Machine Learning extension, you need to run the command below this form to delete the legacy azureml-fe components, more detail you can referto [here](v1/how-to-create-attach-kubernetes.md#update-the-cluster).|
+
+Commands to delete the legacy azureml-fe components in the AKS cluster:
+```shell
+kubectl delete sa azureml-fe
+kubectl delete clusterrole azureml-fe-role
+kubectl delete clusterrolebinding azureml-fe-binding
+kubectl delete svc azureml-fe
+kubectl delete svc azureml-fe-int-http
+kubectl delete deploy azureml-fe
+kubectl delete secret azuremlfessl
+kubectl delete cm azuremlfeconfig
+```
## Open source components integration
machine-learning Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/policy-reference.md
Title: Built-in policy definitions for Azure Machine Learning description: Lists Azure Policy built-in policy definitions for Azure Machine Learning. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
machine-learning How To Evaluate Semantic Kernel https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/prompt-flow/how-to-evaluate-semantic-kernel.md
Similar to the integration of Langchain with Prompt flow, Semantic Kernel, which
To learn more, see [Customize environment for runtime](./how-to-customize-environment-runtime.md) for guidance. > [!IMPORTANT]
-> The approach to consume OpenAI or Azure OpenAI in Semantic Kernel is to to obtain the keys you have specified in environment variables or stored in a `.env` file.
+> The approach to consume OpenAI or Azure OpenAI in Semantic Kernel is to obtain the keys you have specified in environment variables or stored in a `.env` file.
In prompt flow, you need to use **Connection** to store the keys. You can convert these keys from environment variables to key-values in a custom connection in Prompt flow.
machine-learning How To Auto Train Forecast https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/v1/how-to-auto-train-forecast.md
A time series whose moments (mean and variance) change over time is called a **n
:::image type="content" source="../media/how-to-auto-train-forecast/non-stationary-retail-sales.png" alt-text="Diagram showing retail sales for a non-stationary time series.":::
-Next, let's examine the image below, which plots the the original series in first differences, $x_t = y_t - y_{t-1}$ where $x_t$ is the change in retail sales and $y_t$ and $y_{t-1}$ represent the original series and its first lag, respectively. The mean of the series is roughly constant regardless the time frame one is looking at. This is an example of a first order stationary times series. The reason we added the first order term is because the first moment (mean) does not change with time interval, the same cannot be said about the variance, which is a second moment.
+Next, let's examine the image below, which plots the original series in first differences, $x_t = y_t - y_{t-1}$ where $x_t$ is the change in retail sales and $y_t$ and $y_{t-1}$ represent the original series and its first lag, respectively. The mean of the series is roughly constant regardless the time frame one is looking at. This is an example of a first order stationary times series. The reason we added the first order term is because the first moment (mean) does not change with time interval, the same cannot be said about the variance, which is a second moment.
:::image type="content" source="../media/how-to-auto-train-forecast/weakly-stationary-retail-sales.png" alt-text="Diagram showing retail sales for a weakly stationary time series.":::
machine-learning How To Configure Auto Features https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/machine-learning/v1/how-to-configure-auto-features.md
featurization_config.blocked_transformers = ['LabelEncoder']
featurization_config.drop_columns = ['aspiration', 'stroke'] featurization_config.add_column_purpose('engine-size', 'Numeric') featurization_config.add_column_purpose('body-style', 'CategoricalHash')
-#default strategy mean, add transformer param for for 3 columns
+#default strategy mean, add transformer param for 3 columns
featurization_config.add_transformer_params('Imputer', ['engine-size'], {"strategy": "median"}) featurization_config.add_transformer_params('Imputer', ['city-mpg'], {"strategy": "median"}) featurization_config.add_transformer_params('Imputer', ['bore'], {"strategy": "most_frequent"})
mariadb Concepts Data In Replication https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mariadb/concepts-data-in-replication.md
The [*mysql system database*](https://mariadb.com/kb/en/library/the-mysql-databa
- If the source server has SSL enabled, ensure the SSL CA certificate provided for the domain has been included in the `mariadb.az_replication_change_master` stored procedure. Refer to the following [examples](howto-data-in-replication.md#link-the-source-and-replica-servers-to-start-data-in-replication) and the `master_ssl_ca` parameter. - Ensure the source server's IP address has been added to the Azure Database for MariaDB replica server's firewall rules. Update firewall rules using the [Azure portal](howto-manage-firewall-portal.md) or [Azure CLI](howto-manage-firewall-cli.md). - Ensure the machine hosting the source server allows both inbound and outbound traffic on port 3306.-- Ensure the the source server has a **public IP address**, the DNS is publicly accessible, or has a fully qualified domain name (FQDN).
+- Ensure that the source server has a **public IP address**, the DNS is publicly accessible, or has a fully qualified domain name (FQDN).
### Other
mariadb Concepts Servers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mariadb/concepts-servers.md
The following elements help ensure safe access to your database.
Azure Database for MariaDB gives you the ability to **Stop** the server when not in use and **Start** the server when you resume activity. This is essentially done to save costs on the database servers and only pay for the resource when in use. This becomes even more important for dev-test workloads and when you are only using the server for part of the day. When you stop the server, all active connections will be dropped. Later, when you want to bring the server back online, you can either use the [Azure portal](../mysql/how-to-stop-start-server.md) or [CLI](../mysql/how-to-stop-start-server.md).
-When the server is in the **Stopped** state, the server's compute is not billed. However, storage continues to to be billed as the server's storage remains to ensure that data files are available when the server is started again.
+When the server is in the **Stopped** state, the server's compute is not billed. However, storage continues to be billed as the server's storage remains to ensure that data files are available when the server is started again.
> [!IMPORTANT] > When you **Stop** the server it remains in that state for the next 7 days in a stretch. If you do not manually **Start** it during this time, the server will automatically be started at the end of 7 days. You can chose to **Stop** it again if you are not using the server.
mariadb Howto Redirection https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mariadb/howto-redirection.md
$db_name = 'testdb';
die ('Connect error (' . mysqli_connect_errno() . '): ' . mysqli_connect_error() . "\n"); } else {
- echo $db->host_info, "\n"; //if redirection succeeds, the host_info differs from the hostname you used used to connect
+ echo $db->host_info, "\n"; //if redirection succeeds, the host_info differs from the hostname you used to connect
$res = $db->query('SHOW TABLES;'); //test query with the connection print_r ($res); $db->close();
mariadb Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mariadb/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Database for MariaDB
migrate Deploy Appliance Script Government https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/deploy-appliance-script-government.md
ms. Previously updated : 09/15/2023- Last updated : 10/23/2023+
If you want to set up an appliance in the public cloud, follow [this article](d
You can use the script to deploy the Azure Migrate appliance on an existing physical or a virtualized server. -- The server that will act as the appliance must be running Windows Server 2022 and meet other requirements for [VMware](migrate-appliance.md#appliancevmware), [Hyper-V](migrate-appliance.md#appliancehyper-v), and [physical servers](migrate-appliance.md#appliancephysical).
+- The server that will act as the appliance must be running Windows Server 2019 or Windows Server 2022 and meet other requirements for [VMware](migrate-appliance.md#appliancevmware), [Hyper-V](migrate-appliance.md#appliancehyper-v), and [physical servers](migrate-appliance.md#appliancephysical).
- If you run the script on a server with Azure Migrate appliance already set up, you can choose to clean up the existing configuration and set up a fresh appliance of the desired configuration. When you execute the script, you will get a notification as shown below: :::image type="content" source="./media/deploy-appliance-script/script-reconfigure-appliance.png" alt-text="Screenshot that shows how to reconfigure an appliance.":::
migrate Deploy Appliance Script https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/deploy-appliance-script.md
ms. Previously updated : 09/15/2023- Last updated : 10/23/2023+
You can use the script to deploy the Azure Migrate appliance on an existing serv
Scenario | Requirements |
-VMware | Windows Server 2022, with 32 GB of memory, eight vCPUs, around 80 GB of disk storage.
-Hyper-V | Windows Server 2022, with 16 GB of memory, eight vCPUs, around 80 GB of disk storage.
+VMware | Windows Server 2019 or Windows Server 2022, with 32 GB of memory, eight vCPUs, around 80 GB of disk storage.
+Hyper-V | Windows Server 2019 or Windows Server 2022, with 16 GB of memory, eight vCPUs, around 80 GB of disk storage.
- The server also needs an external virtual switch. It requires a static or dynamic IP address. - Before you deploy the appliance, review detailed appliance requirements for [VMware](migrate-appliance.md#appliancevmware) and [Hyper-V](migrate-appliance.md#appliancehyper-v).
migrate How To Scale Out For Migration https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/how-to-scale-out-for-migration.md
ms. Previously updated : 09/15/2023- Last updated : 11/03/2023+
To add a scale-out appliance, follow the steps mentioned below:
### 2. Download the installer for the scale-out appliance
-In **Download Azure Migrate appliance**, click **Download**. You need to download the PowerShell installer script to deploy the scale-out appliance on an existing server running Windows Server 2022 and with the required hardware configuration (32-GB RAM, 8 vCPUs, around 80 GB of disk storage and internet access, either directly or through a proxy).
+In **Download Azure Migrate appliance**, click **Download**. You need to download the PowerShell installer script to deploy the scale-out appliance on an existing server running Windows Server 2019 or Windows Server 2022 and with the required hardware configuration (32-GB RAM, 8 vCPUs, around 80 GB of disk storage and internet access, either directly or through a proxy).
:::image type="content" source="./media/how-to-scale-out-for-migration/download-scale-out.png" alt-text="Download script for scale-out appliance":::
migrate Migrate Appliance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/migrate-appliance.md
ms. Previously updated : 08/22/2023- Last updated : 10/23/2023+
The following table summarizes the Azure Migrate appliance requirements for VMwa
**Appliance services** | The appliance has the following **Project limits** | An appliance can only be registered with a single project.<br> A single project can have multiple registered appliances. **Discovery limits** | An appliance can discover up to 10,000 severs running across multiple vCenter Servers.<br>A single appliance can connect to up to 10 vCenter Servers.
-**Supported deployment** | Deploy as new server running on vCenter Server using OVA template.<br><br> Deploy on an existing server running Windows Server 2022 using PowerShell installer script.
+**Supported deployment** | Deploy as new server running on vCenter Server using OVA template.<br><br> Deploy on an existing server running Windows Server 2019 or Windows Server 2022 using PowerShell installer script.
**OVA template** | Download from project or from [here](https://go.microsoft.com/fwlink/?linkid=2191954).<br><br> Download size is 11.9 GB.<br><br> The downloaded appliance template comes with a Windows Server 2022 evaluation license, which is valid for 180 days.<br>If the evaluation period is close to expiry, we recommend that you download and deploy a new appliance using OVA template, or you activate the operating system license of the appliance server. **OVA verification** | [Verify](tutorial-discover-vmware.md#verify-security) the OVA template downloaded from project by checking the hash values. **PowerShell script** | Refer to this [article](./deploy-appliance-script.md#set-up-the-appliance-for-vmware) on how to deploy an appliance using the PowerShell installer script.<br/><br/>
-**Hardware and network requirements** | The appliance should run on server with Windows Server 2022, 32-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/> The appliance requires internet access, either directly or through a proxy.<br/><br/> If you deploy the appliance using OVA template, you need enough resources on the vCenter Server to create a server that meets the hardware requirements.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2022, and meets hardware requirements.<br/>_(Currently the deployment of appliance is only supported on Windows Server 2022.)_
+**Hardware and network requirements** | The appliance should run on server with Windows Server 2019 or Windows Server 2022, 32-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/> The appliance requires internet access, either directly or through a proxy.<br/><br/> If you deploy the appliance using OVA template, you need enough resources on the vCenter Server to create a server that meets the hardware requirements.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2019 or Windows Server 2022, and meets hardware requirements.
**VMware requirements** | If you deploy the appliance as a server on vCenter Server, it must be deployed on a vCenter Server running 5.5, 6.0, 6.5, 6.7 or 7.0 and an ESXi host running version 5.5 or later.<br/><br/> **VDDK (agentless migration)** | To use the appliance for agentless migration of servers, the VMware vSphere VDDK must be installed on the appliance server.
The following table summarizes the Azure Migrate appliance requirements for VMwa
**Appliance services** | The appliance has the following **Project limits** | An appliance can only be registered with a single project.<br> A single project can have multiple registered appliances. **Discovery limits** | An appliance can discover up to 5000 servers running in Hyper-V environment.<br> An appliance can connect to up to 300 Hyper-V hosts.
-**Supported deployment** | Deploy as server running on a Hyper-V host using a VHD template.<br><br> Deploy on an existing server running Windows Server 2022 using PowerShell installer script.
+**Supported deployment** | Deploy as server running on a Hyper-V host using a VHD template.<br><br> Deploy on an existing server running Windows Server 2019 or Windows Server 2022 using PowerShell installer script.
**VHD template** | Zip file that includes a VHD. Download from project or from [here](https://go.microsoft.com/fwlink/?linkid=2140422).<br><br> Download size is 8.91 GB.<br><br> The downloaded appliance template comes with a Windows Server 2022 evaluation license, which is valid for 180 days. If the evaluation period is close to expiry, we recommend that you download and deploy a new appliance, or that you activate the operating system license of the appliance server. **VHD verification** | [Verify](tutorial-discover-hyper-v.md#verify-security) the VHD template downloaded from project by checking the hash values. **PowerShell script** | Refer to this [article](./deploy-appliance-script.md#set-up-the-appliance-for-hyper-v) on how to deploy an appliance using the PowerShell installer script.<br/>
-**Hardware and network requirements** | The appliance should run on server with Windows Server 2022, 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/> The appliance needs a static or dynamic IP address, and requires internet access, either directly or through a proxy.<br/><br/> If you run the appliance as a server running on a Hyper-V host, you need enough resources on the host to create a server that meets the hardware requirements.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2022, and meets hardware requirements.<br/>_(Currently the deployment of appliance is only supported on Windows Server 2022.)_
-**Hyper-V requirements** | If you deploy the appliance with the VHD template, the appliance provided by Azure Migrate is Hyper-V VM version 5.0.<br/><br/> The Hyper-V host must be running Windows Server 2012 R2 or later.
+**Hardware and network requirements** | The appliance should run on server with Windows Server 2019 or Windows Server 2022, 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/> The appliance needs a static or dynamic IP address, and requires internet access, either directly or through a proxy.<br/><br/> If you run the appliance as a server running on a Hyper-V host, you need enough resources on the host to create a server that meets the hardware requirements.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2019 or Windows Server 2022, and meets hardware requirements.
+**Hyper-V requirements** | If you deploy the appliance with the VHD template, the appliance provided by Azure Migrate is Hyper-V VM version 5.0.<br/><br/> The Hyper-V host must be running Windows Server 2019 or Windows Server 2022.
## Appliance - Physical
The following table summarizes the Azure Migrate appliance requirements for VMwa
**Supported deployment** | Deploy on an existing server running Windows Server 2022 using PowerShell installer script. **PowerShell script** | Download the script (AzureMigrateInstaller.ps1) in a zip file from the project or from [here](https://go.microsoft.com/fwlink/?linkid=2140334). [Learn more](tutorial-discover-physical.md).<br><br> Download size is 85.8 MB. **Script verification** | [Verify](tutorial-discover-physical.md#verify-security) the PowerShell installer script downloaded from project by checking the hash values.
-**Hardware and network requirements** | The appliance should run on server with Windows Server 2022, 16-GB RAM, 8 vCPUs, around 80 GB of disk storage.<br/> The appliance needs a static or dynamic IP address, and requires internet access, either directly or through a proxy.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2022, and meets hardware requirements.<br/>_(Currently the deployment of appliance is only supported on Windows Server 2022.)_
+**Hardware and network requirements** | The appliance should run on server with Windows Server 2019 or Windows Server 2022, 16-GB RAM, 8 vCPUs, around 80 GB of disk storage.<br/> The appliance needs a static or dynamic IP address, and requires internet access, either directly or through a proxy.<br/><br/> If you run the appliance on an existing server, make sure that it is running Windows Server 2019 or Windows Server 2022, and meets hardware requirements.
## URL access
migrate Migrate Support Matrix Hyper V https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/migrate-support-matrix-hyper-v.md
ms. Previously updated : 05/15/2023
-ms.cutom: engagement-fy23
Last updated : 10/23/2023
+ms.cutom: engagement-fy24
# Support matrix for Hyper-V assessment
To set up discovery and assessment of servers running on Hyper-V, you create a p
| **Support** | **Details** | :- | :- |
-| **Hyper-V host** | The Hyper-V host can be standalone or deployed in a cluster.<br/><br/> The Hyper-V host can run Windows Server 2022, Windows Server 2019, or Windows Server 2012 R2. Server core installations of these operating systems are also supported. <br/>You can't assess servers located on Hyper-V hosts running Windows Server 2012.
+| **Hyper-V host** | The Hyper-V host can be standalone or deployed in a cluster.<br/><br/> The Hyper-V host can run Windows Server 2022, Windows Server 2019, Windows Server 2016, or Windows Server 2012 R2. Server core installations of these operating systems are also supported. <br/>You can't assess servers located on Hyper-V hosts running Windows Server 2012.
| **Permissions** | You need Administrator permissions on the Hyper-V host. <br/> If you don't want to assign Administrator permissions, create a local or domain user account, and add the user account to these groups- Remote Management Users, Hyper-V Administrators, and Performance Monitor Users. | | **PowerShell remoting** | [PowerShell remoting](/powershell/module/microsoft.powershell.core/enable-psremoting) must be enabled on each Hyper-V host. | | **Hyper-V Replica** | If you use Hyper-V Replica (or you have multiple servers with the same server identifiers), and you discover both the original and replicated servers using Azure Migrate, the assessment generated by Azure Migrate might not be accurate. |
migrate Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/policy-reference.md
Title: Built-in policy definitions for Azure Migrate description: Lists Azure Policy built-in policy definitions for Azure Migrate. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
migrate Tutorial Discover Aws https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/tutorial-discover-aws.md
ms. Previously updated : 10/15/2023 Last updated : 11/03/2023 #Customer intent: As a server admin I want to discover my AWS instances.
Before you start this tutorial, check you have these prerequisites in place.
**Requirement** | **Details** |
-**Appliance** | You need an EC2 VM on which to run the Azure Migrate appliance. The machine should have:<br/><br/> - Windows Server 2016 installed.<br/> _Running the appliance on a machine with Windows Server 2019 isn't supported_.<br/><br/> - 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/><br/> - A static or dynamic IP address, with internet access, either directly or through a proxy.
+**Appliance** | You need an EC2 VM on which to run the Azure Migrate appliance. The machine should have:<br/><br/> - Windows Server 2019 or Windows Server 2022 installed. - 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/><br/> - A static or dynamic IP address, with internet access, either directly or through a proxy.
**Windows instances** | Allow inbound connections on WinRM port 5985 (HTTP) for discovery of Windows servers. **Linux instances** | Allow inbound connections on port 22 (TCP) for discovery of Linux servers.<br/><br/> The instances should use `bash` as the default shell, otherwise discovery will fail.
migrate Tutorial Discover Gcp https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/tutorial-discover-gcp.md
ms. Previously updated : 10/25/2023 Last updated : 11/03/2023 #Customer intent: As a server admin I want to discover my GCP instances.
Before you start this tutorial, check you have these prerequisites in place.
**Requirement** | **Details** |
-**Appliance** | You need a server on GCP on which to run the Azure Migrate appliance. The machine should have:<br/><br/> - Windows Server 2016 installed.<br/> _Running the appliance on a machine with Windows Server 2019 isn't supported_.<br/><br/> - 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/><br/> - A static or dynamic IP address, with internet access, either directly or through a proxy.
+**Appliance** | You need a server on GCP on which to run the Azure Migrate appliance. The machine should have:<br/><br/> - Windows Server 2019 or Windows Server 2022 installed.<br/> _Running the appliance on a machine with Windows Server 2019 isn't supported_.<br/><br/> - 16-GB RAM, 8 vCPUs, around 80 GB of disk storage, and an external virtual switch.<br/><br/> - A static or dynamic IP address, with internet access, either directly or through a proxy.
**Windows server instances** | Allow inbound connections on WinRM port 5985 (HTTP) for discovery of Windows servers. **Linux server instances** | Allow inbound connections on port 22 (TCP) for discovery of Linux servers.
migrate Tutorial Discover Hyper V https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/tutorial-discover-hyper-v.md
Before you start this tutorial, check you have these prerequisites in place.
**Requirement** | **Details** |
-**Hyper-V host** | Hyper-V hosts on which servers are located can be standalone, or in a cluster.<br/><br/> The host must be running Windows Server 2019, Windows Server 2016, or Windows Server 2012 R2.<br/><br/> Verify inbound connections are allowed on WinRM port 5985 (HTTP), so that the appliance can connect to pull server metadata and performance data, using a Common Information Model (CIM) session.
+**Hyper-V host** | Hyper-V hosts on which servers are located can be standalone, or in a cluster.<br/><br/> The host must be running Windows Server 2022, Windows Server 2019, or Windows Server 2016.<br/><br/> Verify inbound connections are allowed on WinRM port 5985 (HTTP), so that the appliance can connect to pull server metadata and performance data, using a Common Information Model (CIM) session.
**Appliance deployment** | Hyper-V host needs resources to allocate a server for the appliance:<br/><br/> - 16 GB of RAM, 8 vCPUs, and around 80 GB of disk storage.<br/><br/> - An external virtual switch, and internet access on the appliance, directly or via a proxy. **Servers** | All Windows and Linux OS versions are supported for discovery of configuration and performance metadata. <br /><br /> For application discovery on servers, all Windows and Linux OS versions are supported. Check the [OS versions supported for agentless dependency analysis](migrate-support-matrix-hyper-v.md#dependency-analysis-requirements-agentless).<br /><br /> To discover ASP.NET web apps running on IIS web server, check [supported Windows OS and IIS versions](migrate-support-matrix-vmware.md#web-apps-discovery-requirements). For discovery of installed applications and for agentless dependency analysis, Windows servers must have PowerShell version 2.0 or later installed.<br /><br /> To discover Java web apps running on Apache Tomcat web server, check [supported Linux OS and Tomcat versions](migrate-support-matrix-vmware.md#web-apps-discovery-requirements). **SQL Server access** | To discover SQL Server instances and databases, the Windows or SQL Server account must be a member of the sysadmin server role or have [these permissions](migrate-support-matrix-hyper-v.md#configure-the-custom-login-for-sql-server-discovery) for each SQL Server instance.
Set up a new project.
Azure Migrate uses a lightweight Azure Migrate appliance. The appliance performs server discovery and sends server configuration and performance metadata to Azure Migrate. The appliance can be set up by deploying a VHD file that can be downloaded from the project. > [!NOTE]
-> If for some reason you can't set up the appliance using the template, you can set it up using a PowerShell script on an existing Windows Server 2016 server. [Learn more](deploy-appliance-script.md#set-up-the-appliance-for-hyper-v).<br/>
-> The option to deploy an appliance using an VHD template isn't supported in Azure Government cloud. [Learn more](./deploy-appliance-script-government.md) on how to deploy an appliance for Azure Government cloud.
+> - If for some reason you can't set up the appliance using the template, you can set it up using a PowerShell script on an existing Windows Server 2019 or Windows Server 2022. [Learn more](deploy-appliance-script.md#set-up-the-appliance-for-hyper-v).
+> - The option to deploy an appliance using a VHD template isn't supported in Azure Government cloud. [Learn more](./deploy-appliance-script-government.md) on how to deploy an appliance for Azure Government cloud.
This tutorial sets up the appliance on a server running in Hyper-V environment, as follows:
migrate Tutorial Discover Vmware https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/migrate/tutorial-discover-vmware.md
To set up a new project:
The Azure Migrate: Discovery and assessment tool uses a lightweight Azure Migrate appliance. The appliance completes server discovery and sends server configuration and performance metadata to Azure Migrate. Set up the appliance by deploying an OVA template that can be downloaded from the project. > [!NOTE]
-> If you can't set up the appliance by using the OVA template, you can set it up by running a PowerShell script on an existing server running Windows Server 2016. Learn how to [use PowerShell to set up an Azure Migrate appliance](deploy-appliance-script.md#set-up-the-appliance-for-vmware). <br/>
+> If you can't set up the appliance by using the OVA template, you can set it up by running a PowerShell script on an existing server running Windows Server 2019 or Windows Server 2022. Learn how to [use PowerShell to set up an Azure Migrate appliance](deploy-appliance-script.md#set-up-the-appliance-for-vmware). <br/>
> The option to deploy an appliance using an OVA template isn't supported in Azure Government cloud. [Learn more](./deploy-appliance-script-government.md) on how to deploy an appliance for Azure Government cloud. ### Deploy by using an OVA template
mysql Whats New https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mysql/flexible-server/whats-new.md
Azure Database for MySQL Flexible Server now supports [generated invisible prima
## October 2022 -- **AMD compute SKUs for General Purpose and Business Critical tiers in in Azure Database for MySQL - Flexible Server**
+- **AMD compute SKUs for General Purpose and Business Critical tiers in Azure Database for MySQL - Flexible Server**
You can now choose between Intel and AMD hardware for Azure Database for MySQL - Flexible Servers based on the General Purpose (Dadsv5-series) and Business Critical (Eadsv5-series) tiers. AMD SKU offers competitive price-performance options to all Azure Database for MySQL - Flexible server users. To ensure transparency in the portal, you can select the compute hardware vendor for both primary and secondary server. After determining the best compute processor for your workload, deploy flexible servers in more available regions and zones. [Learn more](./concepts-service-tiers-storage.md)
mysql Concepts Servers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mysql/single-server/concepts-servers.md
The following elements help ensure safe access to your database.
Azure Database for MySQL gives you the ability to **Stop** the server when not in use and **Start** the server when you resume activity. This is essentially done to save costs on the database servers and only pay for the resource when in use. This becomes even more important for dev-test workloads and when you are only using the server for part of the day. When you stop the server, all active connections will be dropped. Later, when you want to bring the server back online, you can either use the [Azure portal](how-to-stop-start-server.md) or [CLI](how-to-stop-start-server.md).
-When the server is in the **Stopped** state, the server's compute is not billed. However, storage continues to to be billed as the server's storage remains to ensure that data files are available when the server is started again.
+When the server is in the **Stopped** state, the server's compute is not billed. However, storage continues to be billed as the server's storage remains to ensure that data files are available when the server is started again.
> [!IMPORTANT] > When you **Stop** the server it remains in that state for the next 7 days in a stretch. If you do not manually **Start** it during this time, the server will automatically be started at the end of 7 days. You can chose to **Stop** it again if you are not using the server.
mysql Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/mysql/single-server/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Database for MySQL
network-watcher Migrate To Connection Monitor From Connection Monitor Classic https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/network-watcher/migrate-to-connection-monitor-from-connection-monitor-classic.md
Title: Migrate to Connection Monitor from Connection Monitor
+ Title: Migrate to Connection monitor from Connection monitor (classic)
-description: Learn how to migrate to Connection Monitor from Connection Monitor.
-
+description: Learn how to migrate your connection monitors from Connection monitor (classic) to the new Connection monitor.
+ - Previously updated : 06/30/2021--
-#Customer intent: I need to migrate from Connection Monitor to Connection Monitor.
Last updated : 11/03/2023+
+#CustomerIntent: As an Azure administrator, I want to migrate my connection monitors from Connection monitor (classic) to the new Connection monitor so I avoid service disruption.
-# Migrate to Connection Monitor from Connection Monitor (Classic)
+
+# Migrate to Connection monitor from Connection monitor (classic)
> [!IMPORTANT]
-> Starting 1 July 2021, you will not be able to add new connection monitors in Connection Monitor (classic) but you can continue to use existing connection monitors created prior to 1 July 2021. To minimize service disruption to your current workloads, [migrate from Connection Monitor (classic) to the new Connection Monitor](migrate-to-connection-monitor-from-connection-monitor-classic.md) in Azure Network Watcher before 29 February 2024.
+> Starting July 1, 2021, you will not be able to add new connection monitors in Connection Monitor (classic) but you can continue to use existing connection monitors created prior to 1 July 2021. To minimize service disruption to your current workloads, migrate from Connection Monitor (classic) to the new Connection Monitor in Azure Network Watcher before February 29, 2024.
-You can migrate existing connection monitors to new, improved Connection Monitor with only a few clicks and with zero downtime. To learn more about the benefits, see [Connection Monitor](./connection-monitor-overview.md).
+You can migrate existing connection monitors to new, improved Connection monitor with only a few clicks and with zero downtime. To learn more about the benefits of the new Connection monitor, see [Connection monitor overview](connection-monitor-overview.md).
## Key points to note The migration helps produce the following results:
-* Agents and firewall settings work as is. No changes are required.
-* Existing connection monitors are mapped to Connection Monitor > Test Group > Test format. By selecting **Edit**, you can view and modify the properties of the new Connection Monitor, download a template to make changes to Connection Monitor, and submit it via Azure Resource Manager.
-* Azure virtual machines with the Network Watcher extension send data to both the workspace and the metrics. Connection Monitor makes the data available through the new metrics (ChecksFailedPercent and RoundTripTimeMs) instead of the old metrics (ProbesFailedPercent and AverageRoundtripMs). The old metrics will get migrated to new metrics as ProbesFailedPercent -> ChecksFailedPercent and AverageRoundtripMs -> RoundTripTimeMs.
-* Data monitoring:
- * **Alerts**: Migrated automatically to the new metrics.
- * **Dashboards and integrations**: Require manually editing of the metrics set.
+- Agents and firewall settings work as is. No changes are required.
+- Existing connection monitors are mapped to Connection monitor > Test group > Test format. By selecting **Edit**, you can view and modify the properties of the new Connection monitor, download a template to make changes to Connection monitor, and submit it via Azure Resource Manager.
+- Azure virtual machines with the Network Watcher extension send data to both the workspace and the metrics. Connection monitor makes the data available through the new metrics `ChecksFailedPercent` and `RoundTripTimeMs` instead of the old metrics `ProbesFailedPercent` and `AverageRoundtripMs` respectively.
+- Data monitoring:
+ - **Alerts**: Migrated automatically to the new metrics.
+ - **Dashboards and integrations**: Require manual editing of the metrics set.
## Prerequisites
-1. If you're using a custom workspace, ensure that Network Watcher is enabled in your subscription and in the region of your Log Analytics workspace. If not you will see an error stating "Before you attempt migrate, please enable Network watcher extension in selection subscription and location of LA workspace selected."
-1. In case virtual machines used as sources in connection monitor (classic) no longer have the Network Watcher extension enabled, you will see an error message stating "Connection monitors having following tests cannot be imported as one or more azure virtual machines don't have network watcher extension installed. Install network watcher extension and click refresh to import them."
--
+- If you're using a custom workspace, ensure that Network Watcher is enabled in your subscription and in the region of your Log Analytics workspace. If not, you get an error stating "Before you attempt to migrate, please enable Network watcher extension in the subscription and location of LA workspace selected."
+- In case virtual machines used as sources in Connection monitor (classic) no longer have the Network Watcher extension enabled, you get an error message stating "Connection monitors having following tests cannot be imported as one or more Azure virtual machines don't have network watcher extension installed. Install Network Watcher extension and click refresh to import them."
## Migrate the connection monitors
-1. To migrate the older connection monitors to the newer one, select **Connection Monitor**, and then select **Migrate Connection Monitors**.
+1. To migrate the older connection monitors to the new Connection monitor, select **Connection monitor**, and then select **Migrate Connection Monitors**.
- ![Screenshot showing the migration of connection monitors to Connection Monitor.](./media/connection-monitor-2-preview/migrate-cm-to-cm-preview.png)
+ :::image type="content" source="./media/migrate-to-connection-monitor-from-connection-monitor-classic/migrate-classic-connection-monitors.png" alt-text="Screenshot showing the migration of connection monitors to the new Connection monitor." lightbox="./media/migrate-to-connection-monitor-from-connection-monitor-classic/migrate-classic-connection-monitors.png":::
1. Select your subscription and the connection monitors you want to migrate, and then select **Migrate selected**.
-With only a few clicks, you've migrated the existing connection monitors to Connection Monitor. Once migrated from CM (Classic) to CM, you will not be able to see the monitor under CM (Classic)
-
-You can now customize Connection Monitor properties, change the default workspace, download templates, and check the migration status.
+After you migrated from Connection monitor (classic) to Connection monitor, you won't be able to see the connection monitors under Connection monitor (classic)
-After the migration begins, the following changes take place:
-* The Azure Resource Manager resource changes to the newer connection monitor.
- * The name, region, and subscription of the connection monitor remain unchanged. The resource ID is unaffected.
- * Unless the connection monitor is customized, a default Log Analytics workspace is created in the subscription and in the region of the connection monitor. This workspace is where monitoring data is stored. The test result data is also stored in the metrics.
- * Each test is migrated to a test group called *defaultTestGroup*.
- * Source and destination endpoints are created and used in the new test group. The default names are *defaultSourceEndpoint* and *defaultDestinationEndpoint*.
- * The destination port and probing interval are moved to a test configuration called *defaultTestConfiguration*. The protocol is set based on the port values. Success thresholds and other optional properties are left blank.
-* Metrics alerts are migrated to Connection Monitor metrics alerts. The metrics are different, hence the change. For more information, see [Network connectivity monitoring with Connection Monitor](./connection-monitor-overview.md#metrics-in-azure-monitor).
-* The migrated connection monitors are no longer displayed as the older connection monitor solution. They're now available for use only in Connection Monitor.
-* Any external integrations, such as dashboards in Power BI and Grafana, and integrations with Security Information and Event Management (SIEM) systems, must be migrated manually. This is the only manual step you need to perform to migrate your setup.
+You can now customize Connection monitor properties, change the default workspace, download templates, and check the migration status.
-## Common Errors Encountered
+After the migration begins, the following changes take place:
-Below are some common errors faced during the migration :
+- The Azure Resource Manager resource changes to the newer connection monitor:
+ - The name, region, and subscription of the connection monitor remain unchanged. The resource ID is unaffected.
+ - Unless the connection monitor is customized, a default Log Analytics workspace is created in the subscription and in the region of the connection monitor. This workspace is where monitoring data is stored. The test result data is also stored in the metrics.
+ - Each test is migrated to a test group called *defaultTestGroup*.
+ - Source and destination endpoints are created and used in the new test group. The default names are *defaultSourceEndpoint* and *defaultDestinationEndpoint*.
+ - The destination port and probing interval are moved to a test configuration called *defaultTestConfiguration*. The protocol is set based on the port values. Success thresholds and other optional properties are left blank.
+- Metrics alerts are migrated to Connection monitor metrics alerts. The metrics are different, hence the change. For more information, see [Metrics in Azure Monitor](connection-monitor-overview.md#metrics-in-azure-monitor).
+- The migrated connection monitors are no longer displayed as the older connection monitor solution. They're now available for use only in Connection monitor.
+- Any external integrations, such as dashboards in Power BI and Grafana, and integrations with Security Information and Event Management (SIEM) systems, must be migrated manually. This is the only manual step you need to perform to migrate your setup.
-| Error | Reason |
-|||
-|Following Connection monitors cannot be imported as one or more Subscription/Region combination don't have network watcher enabled. Enable network watcher and click refresh to import them. List of Connection monitor - {0} | This error occurs when User is migrating tests from CM(classic) to Connection Monitor and Network Watcher Extension is not enabled in one or more subscriptions and regions of CM (classic). User needs to enable NW Extension in the subscription and refresh to import them before migrating again |
-|Connection monitors having following tests cannot be imported as one or more azure virtual machines don't have network watcher extension installed. Install network watcher extension and click refresh to import them. List of tests - {0} | This error occurs when User is migrating tests from CM(classic) to Connection Monitor and Network Watcher Extension is not installed in one or more Azure VMs of CM (classic). User needs to install NW Extension in the Azure VM and refresh before migrating again |
-|No rows to display | This error occurs when User is trying to migrate subscriptions from CM (Classic) to CM but no CM (classic) is created in the subscriptions |
+## Common errors encountered
-## Next steps
+The following table list common errors that you might encounter during the migration:
-To learn more about Connection Monitor, see:
-* [Migrate from Network Performance Monitor to Connection Monitor](./migrate-to-connection-monitor-from-network-performance-monitor.md)
-* [Create Connection Monitor by using the Azure portal](./connection-monitor-create-using-portal.md)
+| Error | Reason |
+| -- | |
+| Following Connection monitors cannot be imported as one or more Subscription/Region combinations don't have network watcher enabled. Enable network watcher and click refresh to import them. | This error occurs when you migrate tests from Connection monitor (classic) to Connection monitor and Network Watcher extension isn't enabled in one or more subscriptions and regions of Connection monitor (classic). You need to enable Network Watcher extension in all subscriptions and regions used in Connection monitor (classic). |
+| Connection monitors having following tests cannot be imported as one or more Azure virtual machines don't have Network Watcher extension installed. Install Network Watcher extension and select refresh to import the tests. | This error occurs when you migrate tests from Connection monitor (classic) to Connection monitor and Network Watcher extension isn't installed in one or more Azure VMs of Connection monitor (classic). You need to install the Network Watcher extension in all Azure VMs of Connection monitor (classic), and then refresh before migrating again. |
+| No rows to display | This error occurs when you try to migrate subscriptions from Connection monitor (classic) to Connection monitor but no Connection monitor (classic) is created in the subscriptions. |
+## Related content
-
-
-
+- [Migrate from Network Performance Monitor to Connection Monitor](migrate-to-connection-monitor-from-network-performance-monitor.md).
+- [Create Connection Monitor by using the Azure portal](connection-monitor-create-using-portal.md).
networking Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/networking/policy-reference.md
Title: Built-in policy definitions for Azure networking services description: Lists Azure Policy built-in policy definitions for Azure networking services. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
notification-hubs Notification Hubs Push Notification Fixer https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/notification-hubs/notification-hubs-push-notification-fixer.md
The Token obtained from the Token Provider is wrong
This message indicates either that the credentials configured in Notification Hubs are invalid or that there's an issue with the registrations in the hub. Delete this registration and let the client re-create the registration before sending the message. > [!NOTE]
-> Use of the `EnableTestSend` property is heavily throttled. Use this option only in a development/test environment and with a limited set of registrations. Debug notifications are sent to only 10 devices. There's also a limit on processing debug sends, at 10 per minute. Debug notifications are also excluded the the Azure Notification Hubs SLA.
+> Use of the `EnableTestSend` property is heavily throttled. Use this option only in a development/test environment and with a limited set of registrations. Debug notifications are sent to only 10 devices. There's also a limit on processing debug sends, at 10 per minute. Debug notifications are also excluded from the Azure Notification Hubs SLA.
### Review telemetry
operator-nexus List Of Metrics Collected https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/operator-nexus/list-of-metrics-collected.md
This section provides the list of metrics collected from the different component
- [Network Devices Metrics](#network-devices-metrics) ## Nexus Cluster
+All these metrics for Nexus Cluster are collected and delivered to Azure Monitor per minute.
+ ### ***Kubernetes API server*** | Metric | Category | Display Name | Unit | Description | Dimensions |
This section provides the list of metrics collected from the different component
|NcVmiCpuAffinity|Network Cloud|CPU Pinning Map (Preview)|Count|Pinning map of virtual CPUs (vCPUs) to CPUs|CPU,NUMA Node,VMI Namespace,VMI Node,VMI Name| ## Baremetal servers
+Baremetal server metrics are collected and delivered to Azure Monitor per minute.
+ ### ***node metrics*** | Metric | Category | Display Name | Unit | Description | Dimensions |
NodeVmstatPswpIn|VM Stat|Node VM PSWP In|Count|Information in /proc/vmstat perta
NodeVmstatPswpout|VM Stat|Node VM PSWP Out|Count|Information in /proc/vmstat pertaining to the field pswpout|Host| ## Storage Appliances
+All the metrics from Storage appliance are collected and delivered to Azure Monitor per minute.
+ ### ***pure storage***
PurefaVolumeSpaceSizeBytes|Volume|Nexus Storage Volume Space Size Bytes|Bytes|St
## Network Fabric Metrics ### Network Devices Metrics
-| Metric Name | Metric Display Name| Category | Unit | Aggregation Type | Description | Dimensions | Exportable via <br/>Diagnostic Settings? |
-|-|:-:|:-:|:--:|:-:|-|::|:-:|
-| CpuUtilizationMax | Cpu Utilization Max | Resource Utilization | % | Average | Maximum CPU utilization of the device over a given interval | CPU Cores | No* |
-| CpuUtilizationMin | Cpu Utilization Min | Resource Utilization | % | Average | Minimum CPU utilization of the device over a given interval | CPU Cores | No* |
-| FanSpeed | Fan Speed | Resource Utilization | RPM | Average | Running speed of the fan at any given point of time | Fan number | No* |
-| MemoryAvailable | Memory Available | Resource Utilization | GiB | Average | The amount of memory available or allocated to the device at a given point in time | NA | No* |
-| MemoryUtilized | Memory Utilized | Resource Utilization | GiB | Average | The amount of memory utilized by the device at a given point in time | NA | No* |
-| PowerSupplyInputCurrent | Power Supply Input Current | Resource Utilization | Amps | Average | The input current draw of the power supply | NA | No* |
-| PowerSupplyInputVoltage | Power Supply Input Voltage | Resource Utilization | Volts | Average | The input voltage of the power supply | NA | No* |
-| PowerSupplyMaximumPowerCapacity | Power Supply Maximum Power Capacity | Resource Utilization | Watts | Average | Maximum power capacity of the power supply | NA | No* |
-| PowerSupplyOutputCurrent | Power Supply Output Current | Resource Utilization | Amps | Average | The output current supplied by the power supply | NA | No* |
-| PowerSupplyOutputPower| Power Supply Output Power | Resource Utilization | Watts | Average | The output power supplied by the power supply | NA | No* |
-| PowerSupplyOutputVoltage | Power Supply Output Voltage | Resource Utilization | Volts | Average | The output voltage supplied the power supply | NA | No* |
-| BgpPeerStatus | BGP Peer Status | BGP Status | Count | Average | Operational state of the BGP Peer represented in numerical form. 1-Idle, 2-Connect, 3-Active, 4-OpenSent, 5-OpenConfirm, 6-Established | NA | No* |
-| InterfaceOperStatus | Interface Operational State | Interface Operational State | Count | Average | Operational state of the Interface represented in numerical form. 0-Up, 1-Down, 2-Lower Layer Down, 3-Testing, 4-Unknown, 5-Dormant, 6-Not Present | NA | No* |
-| IfEthInCrcErrors | Ethernet Interface In CRC Errors | Interface State Counters | Count | Average | The count of incoming CRC errors caused by several factors for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthInFragmentFrames | Ethernet Interface In Fragment Frames | Interface State Counters | Count | Average | The count of incoming fragmented frames for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthInJabberFrames | Ethernet Interface In Jabber Frames | Interface State Counters | Count | Average | The count of incoming jabber frames. Jabber frames are typically oversized frames with invalid CRC | Interface name | No* |
-| IfEthInMacControlFrames | Ethernet Interface In MAC Control Frames | Interface State Counters | Count | Average | The count of incoming MAC layer control frames for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthInMacPauseFrames | Ethernet Interface In MAC Pause Frames | Interface State Counters | Count | Average | The count of incoming MAC layer pause frames for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthInOversizeFrames | Ethernet Interface In Oversize Frames | Interface State Counters | Count | Average | The count of incoming oversized frames (larger than 1518 octets) for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthOutMacControlFrames | Ethernet Interface Out MAC Control Frames | Interface State Counters | Count | Average | The count of outgoing MAC layer control frames for an ethernet interface over a given interval of time | Interface name | No* |
-| IfEthOutMacPauseFrames | Ethernet Interface Out MAC Pause Frames | Interface State Counters | Count | Average | Shows the count of outgoing MAC layer pause frames for an ethernet interface over a given interval of time | Interface name | No* |
-| IfInBroadcastPkts | Interface In Broadcast Pkts | Interface State Counters | Count | Average | The count of incoming broadcast packets for an interface over a given interval of time | Interface name | No* |
-| IfInDiscards | Interface In Discards | Interface State Counters | Count | Average | The count of incoming discarded packets for an interface over a given interval of time | Interface name | No* |
-| IfInErrors | Interface In Errors | Interface State Counters | Count | Average | The count of incoming packets with errors for an interface over a given interval of time | Interface name | No* |
-| IfInFcsErrors | Interface In FCS Errors | Interface State Counters | Count | Average | The count of incoming packets with FCS (Frame Check Sequence) errors for an interface over a given interval of time | Interface name | No* |
-| IfInMulticastPkts | Interface In Multicast Pkts | Interface State Counters | Count | Average | The count of incoming multicast packets for an interface over a given interval of time | Interface name | No* |
-| IfInOctets | Interface In Octets | Interface State Counters | Count | Average | The total number of incoming octets received by an interface over a given interval of time | Interface name | No* |
-| IfInUnicastPkts | Interface In Unicast Pkts | Interface State Counters | Count | Average | The count of incoming unicast packets for an interface over a given interval of time | Interface name | No* |
-| IfInPkts | Interface In Pkts | Interface State Counters | Count | Average | The total number of incoming packets received by an interface over a given interval of time. Includes all packets - unicast, multicast, broadcast, bad packets, etc. | Interface name | No* |
-| IfOutBroadcastPkts | Interface Out Broadcast Pkts | Interface State Counters | Count | Average | The count of outgoing broadcast packets for an interface over a given interval of time | Interface name | No* |
-| IfOutDiscards | Interface Out Discards | Interface State Counters | Count | Average | The count of outgoing discarded packets for an interface over a given interval of time | Interface name | No* |
-| IfOutErrors | Interface Out Errors | Interface State Counters | Count | Average | The count of outgoing packets with errors for an interface over a given interval of time | Interface name | No* |
-| IfOutMulticastPkts | Interface Out Multicast Pkts | Interface State Counters | Count | Average | The count of outgoing multicast packets for an interface over a given interval of time | Interface name | No* |
-| IfOutOctets | Interface Out Octets | Interface State Counters | Count | Average | The total number of outgoing octets sent from an interface over a given interval of time | Interface name | No* |
-| IfOutUnicastPkts | Interface Out Unicast Pkts | Interface State Counters | Count | Average | The count of outgoing unicast packets for an interface over a given interval of time | Interface name | No* |
-| IfOutPkts | Interface Out Pkts | Interface State Counters | Count | Average | The total number of outgoing packets sent from an interface over a given interval of time. Includes all packets - unicast, multicast, broadcast, bad packets, etc. | Interface name | No* |
-| LacpErrors | LACP Errors | LACP State Counters | Count | Average | The count of LACPDU illegal packet errors | Interface name | No* |
-| LacpInPkts | LACP In Pkts | LACP State Counters | Count | Average | The count of LACPDU packets received by an interface over a given interval of time | Interface name | No* |
-| LacpOutPkts | LACP Out Pkts | LACP State Counters | Count | Average | The count of LACPDU packets sent by an interface over a given interval of time | Interface name | No* |
-| LacpRxErrors | LACP Rx Errors | LACP State Counters | Count | Average | The count of LACPDU packets with errors received by an interface over a given interval of time | Interface name | No* |
-| LacpTxErrors | LACP Tx Errors | LACP State Counters | Count | Average | The count of LACPDU packets with errors transmitted by an interface over a given interval of time | Interface name | No* |
-| LacpUnknownErrors | LACP Unknown Errors | LACP State Counters | Count | Average | The count of LACPDU packets with unknown errors over a given interval of time | Interface name | No* |
-| LldpFrameIn | LLDP Frame In | LLDP State Counters | Count | Average | The count of LLDP frames received by an interface over a given interval of time | Interface name | No* |
-| LldpFrameOut | LLDP Frame Out | LLDP State Counters | Count | Average | The count of LLDP frames trasmitted from an interface over a given interval of time | Interface name | No* |
-| LldpTlvUnknown | LLDP Tlv Unknown | LLDP State Counters | Count | Average | The count of LLDP frames received with unknown TLV by an interface over a given interval of time | Interface name | No* |
-
-\*Network Devices Metrics streaming via Diagnostic Setting is a work in progress and will be enabled in an upcoming release.
+The collection interval for Network Fabric device metrics varies and you can find more information per metric (please refer to column "Collection Interval").
+
+| Metric Name | Metric Display Name| Category | Unit | Aggregation Type | Description | Dimensions | Exportable via <br/>Diagnostic Settings? | Collection Interval |
+|-|:-:|:-:|:--:|:-:|-|::|:-:|:-:|
+| AclMatchedPackets | Acl Matched Packets | ACL State Counters | Count | Average | Count of the number of packets matching the current ACL entry | AclSetName | Yes | Every 5 mins |
+| ComponentOperStatus | Component Operational State | Component Operational State | NA | NA | The current operational status of the component | Component Name | Yes | Every 5 mins and on state change |
+| CpuUtilizationMax | Cpu Utilization Max | Resource Utilization | % | Average | Maximum CPU utilization of the device over a given interval | CPU Cores | Yes | Per minute |
+| CpuUtilizationMin | Cpu Utilization Min | Resource Utilization | % | Average | Minimum CPU utilization of the device over a given interval | CPU Cores | Yes | Per minute |
+| CpuUtilizationAvg | Cpu Utilization Avg | Resource Utilization | % | Average | Avg cpu utilization. The Avg value of the percentage measure of the statistic over the time interval. | CPU Cores | Yes | Per minute |
+| CpuUtilizationInstant | Cpu Utilization Instant | Resource Utilization | % | Average | Instantaneous Cpu utilization. The instantaneous value of the percentage measure of the statistic over the time interval. | CPU Cores | Yes | Per minute |
+| FanSpeed | Fan Speed | Resource Utilization | RPM | Average | Running speed of the fan at any given point of time | Fan number | Yes | Per minute |
+| MemoryAvailable | Memory Available | Resource Utilization | GiB | Average | The amount of memory available or allocated to the device at a given point in time | NA | Yes | Per minute |
+| MemoryUtilized | Memory Utilized | Resource Utilization | GiB | Average | The amount of memory utilized by the device at a given point in time | NA | Yes | Per minute |
+| TemperatureMax | Temperature Max | Resource Utilization | NA | Maximum | Max temperature in degrees Celsius of the component. The maximum value of the statistic over the sampling period | NA | Yes | Per minute |
+| TemperatureInstant | Temperature Instantaneous | Resource Utilization | NA | NA | The instantaneous value of temperature in degrees Celsius of the component. | NA | Yes | Per minute |
+| PowerSupplyInputCurrent | Power Supply Input Current | Resource Utilization | Amps | Average | The input current draw of the power supply | NA | Yes | Per minute |
+| PowerSupplyInputVoltage | Power Supply Input Voltage | Resource Utilization | Volts | Average | The input voltage of the power supply | NA | Yes | Per minute |
+| PowerSupplyMaximumPowerCapacity | Power Supply Maximum Power Capacity | Resource Utilization | Watts | Average | Maximum power capacity of the power supply | NA | Yes | Per minute |
+| PowerSupplyOutputCurrent | Power Supply Output Current | Resource Utilization | Amps | Average | The output current supplied by the power supply | NA | Yes | Per minute |
+| PowerSupplyOutputPower| Power Supply Output Power | Resource Utilization | Watts | Average | The output power supplied by the power supply | NA | Yes | Per minute |
+| PowerSupplyOutputVoltage | Power Supply Output Voltage | Resource Utilization | Volts | Average | The output voltage supplied the power supply | NA | Yes | Per minute |
+| BgpPeerStatus | BGP Peer Status | BGP Status | Count | Average | Operational state of the BGP Peer represented in numerical form. 1-Idle, 2-Connect, 3-Active, 4-OpenSent, 5-OpenConfirm, 6-Established | NA | Yes | Every 5 mins and on state change |
+| InterfaceOperStatus | Interface Operational State | Interface Operational State | Count | Average | Operational state of the Interface represented in numerical form. 0-Up, 1-Down, 2-Lower Layer Down, 3-Testing, 4-Unknown, 5-Dormant, 6-Not Present | NA | Yes | Every 5 mins and on state change |
+| IfEthInCrcErrors | Ethernet Interface In CRC Errors | Interface State Counters | Count | Average | The count of incoming CRC errors caused by several factors for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthInFragmentFrames | Ethernet Interface In Fragment Frames | Interface State Counters | Count | Average | The count of incoming fragmented frames for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthInJabberFrames | Ethernet Interface In Jabber Frames | Interface State Counters | Count | Average | The count of incoming jabber frames. Jabber frames are typically oversized frames with invalid CRC | Interface name | Yes | Every 5 mins |
+| IfEthInMacControlFrames | Ethernet Interface In MAC Control Frames | Interface State Counters | Count | Average | The count of incoming MAC layer control frames for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthInMacPauseFrames | Ethernet Interface In MAC Pause Frames | Interface State Counters | Count | Average | The count of incoming MAC layer pause frames for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthInMaxsizeExceeded | Ethernet Interface In Maxsize Exceeded | Interface State Counters | Count | Average | The total number frames received that are well-formed dropped due to exceeding the maximum frame size on the interface | Interface name | Yes | Every 5 mins |
+| IfEthInOversizeFrames | Ethernet Interface In Oversize Frames | Interface State Counters | Count | Average | The count of incoming oversized frames (larger than 1518 octets) for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthOutMacControlFrames | Ethernet Interface Out MAC Control Frames | Interface State Counters | Count | Average | The count of outgoing MAC layer control frames for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfEthOutMacPauseFrames | Ethernet Interface Out MAC Pause Frames | Interface State Counters | Count | Average | Shows the count of outgoing MAC layer pause frames for an ethernet interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInBroadcastPkts | Interface In Broadcast Pkts | Interface State Counters | Count | Average | The count of incoming broadcast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInDiscards | Interface In Discards | Interface State Counters | Count | Average | The count of incoming discarded packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInErrors | Interface In Errors | Interface State Counters | Count | Average | The count of incoming packets with errors for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInFcsErrors | Interface In FCS Errors | Interface State Counters | Count | Average | The count of incoming packets with FCS (Frame Check Sequence) errors for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInMulticastPkts | Interface In Multicast Pkts | Interface State Counters | Count | Average | The count of incoming multicast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInOctets | Interface In Octets | Interface State Counters | Count | Average | The total number of incoming octets received by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInUnicastPkts | Interface In Unicast Pkts | Interface State Counters | Count | Average | The count of incoming unicast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfInPkts | Interface In Pkts | Interface State Counters | Count | Average | The total number of incoming packets received by an interface over a given interval of time. Includes all packets - unicast, multicast, broadcast, bad packets, etc. | Interface name | Yes | Every 5 mins |
+| IfOutBroadcastPkts | Interface Out Broadcast Pkts | Interface State Counters | Count | Average | The count of outgoing broadcast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutDiscards | Interface Out Discards | Interface State Counters | Count | Average | The count of outgoing discarded packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutErrors | Interface Out Errors | Interface State Counters | Count | Average | The count of outgoing packets with errors for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutMulticastPkts | Interface Out Multicast Pkts | Interface State Counters | Count | Average | The count of outgoing multicast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutOctets | Interface Out Octets | Interface State Counters | Count | Average | The total number of outgoing octets sent from an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutUnicastPkts | Interface Out Unicast Pkts | Interface State Counters | Count | Average | The count of outgoing unicast packets for an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| IfOutPkts | Interface Out Pkts | Interface State Counters | Count | Average | The total number of outgoing packets sent from an interface over a given interval of time. Includes all packets - unicast, multicast, broadcast, bad packets, etc. | Interface name | Yes | Every 5 mins |
+| LacpErrors | LACP Errors | LACP State Counters | Count | Average | The count of LACPDU illegal packet errors | Interface name | Yes | Every 5 mins |
+| LacpInPkts | LACP In Pkts | LACP State Counters | Count | Average | The count of LACPDU packets received by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LacpOutPkts | LACP Out Pkts | LACP State Counters | Count | Average | The count of LACPDU packets sent by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LacpRxErrors | LACP Rx Errors | LACP State Counters | Count | Average | The count of LACPDU packets with errors received by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LacpTxErrors | LACP Tx Errors | LACP State Counters | Count | Average | The count of LACPDU packets with errors transmitted by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LacpUnknownErrors | LACP Unknown Errors | LACP State Counters | Count | Average | The count of LACPDU packets with unknown errors over a given interval of time | Interface name | Yes | Every 5 mins |
+| LldpFrameIn | LLDP Frame In | LLDP State Counters | Count | Average | The count of LLDP frames received by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LldpFrameOut | LLDP Frame Out | LLDP State Counters | Count | Average | The count of LLDP frames trasmitted from an interface over a given interval of time | Interface name | Yes | Every 5 mins |
+| LldpTlvUnknown | LLDP Tlv Unknown | LLDP State Counters | Count | Average | The count of LLDP frames received with unknown TLV by an interface over a given interval of time | Interface name | Yes | Every 5 mins |
operator-service-manager How To Delete Operator Resources https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/operator-service-manager/how-to-delete-operator-resources.md
In this how-to guide, you learn how to delete operator resources that include Si
:::image type="content" source="media/how-to-delete-operator-resource-confirm-prompt.png" alt-text="Diagram showing the Confirmation prompt with a warning message."::: > [!NOTE]
-> Deleting a Site Network Service (SNS) can be time consuming. It it important to inform the user in advance that deletions may take between 5 minutes to over an hour.
+> Deleting a Site Network Service (SNS) can be time consuming. It is important to inform the user in advance that deletions may take between 5 minutes to over an hour.
### Troubleshoot deletion errors
orbital About Ground Stations https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/orbital/about-ground-stations.md
In addition, we support public satellites for downlink-only operations that util
Azure Orbital Ground Station offers a common data plane and API to access all antenna in the global network. An active contract with the partner network(s) you wish to integrate with Azure Orbital Ground Station is required to onboard with a partner.
-## Next Steps
+## Next steps
+- [Get started with Azure Orbital Ground Station](get-started.md)
- [Support all mission phases](mission-phases.md)
orbital Get Started https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/orbital/get-started.md
Title: Get Started with Azure Orbital Ground Station
+ Title: Azure Orbital Ground Station - Get started
description: How to get started with Azure Orbital Ground Station.
# Customer intent: As a satellite operator, I want to learn how to get started with Azure Orbital Ground Station.
-# Get Started with Azure Orbital Ground Station
+# Get started with Azure Orbital Ground Station
Azure Orbital Ground Station can be used to communicate with a private satellite or a selection of public satellites.
orbital Prepare For Launch https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/orbital/prepare-for-launch.md
+
+ Title: Azure Orbital Ground Station - Prepare for launch and early operations
+description: Learn how to get ready for Launch with Azure Orbital.
++++ Last updated : 10/12/2023+++
+# Prepare for launch and early operations
+
+Follow these steps to get ready for an upcoming satellite launch and acquire your satellite with Azure Orbital Ground Station.
+
+## Prerequisites
+
+- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
+- Contributor permissions at the subscription level.
+- A [Basic Support Plan](https://azure.microsoft.com/support/plans/) or higher to submit a spacecraft authorization request.
+- Private spacecraft: an active satellite license. In certain countries including the United States, authorization for market access (or a waiver of the United StatesΓÇÖ market access rules) is required for satellites not licensed in the country.
+- Private spacecraft: added as a point of communication to Microsoft and/or Partner ground stations. For more information, see [initiate ground station licensing](initiate-licensing.md).
+- A [contact profile resource](concepts-contact-profile.md)
+
+## Compatibility testing
+
+Compatibility testing is an important risk reduction process in the launch campaign. Azure Orbital Ground Station provides two options to perform compatibility testing.
+
+### Option 1 - Buy your own set of equipment for your lab
+
+This option is preferred if you're standing up a new satellite constellation and plan to periodically launch satellites. By procuring your own lab equipment, you can fully verify all aspects of RF functionality.
+
+We can connect you with our digitizer and software modem partner, [Kratos](https://www.kratosdefense.com/products/space/signals/signal-processing). Relevant equipment could include [wideband and narrowband digitizers](https://www.kratosdefense.com/products/space/networks/network-devices/spectralnet?r=krtl), a [wideband software receiver](https://www.kratosdefense.com/products/space/signals/signal-processing/quantumrx), and a [virtualized narrowband modem](https://www.kratosdefense.com/products/space/satellites/ttc-devices-and-software/quantumradio).
+
+### Option 2 - Use our Free Professional Services
+
+Depending on your scenario, it might be impractical for you to obtain your own lab equipment. We can help through our Free Professional Services program at no additional cost.
+
+This option is evaluated on a case-by-case basis, so reach out to the Azure Orbital Ground Station team to learn more. A typical offering is shown below:
+
+For each channel, we execute a replay of a customer furnished RF test vector in our lab against flight-like equipment.
+1. The customer provides RF test vectors in raw 32-bit I/Q format or bitstream test vectors in a raw format.
+1. Our team provides a capture of the system output of the other end of the RF chain. Expect a 21 day turn around time.
+1. We can repeat Steps 1 and 2 up to two more times to eliminate any bugs.
+
+## Acquisition of satellite after launch vehicle separation
+
+Satellites typically don't have accurate [TLEs](spacecraft-object.md#ephemeris) before and shortly after launch, and contact windows can shift as the TLE estimates improve. In order to accommodate this uncertainty, Azure Orbital Ground Station supports a Launch Window Scheduling feature in Preview. This feature allows you to reserve contact windows for this critical mission phase ahead of launch without requiring an accurate satellite TLE. You can provide as many TLE updates as needed until five minutes ahead of the scheduled contact start time.
+
+Our team enables the Launch Window Scheduling feature manually on a per-spacecraft basis, so contact Azure Orbital Ground Station to request this Preview feature for your upcoming launch campaign.
+
+The following outlines a typical contact scheduling flow when using Launch Window Scheduling:
+1. You don't need an accurate TLE to schedule a contact. [Update the spacecraft resource](update-tle.md) with the best estimate TLE.
+1. Specify the time window of interest for your contact by adjusting the **Start Time** and **End Time** fields in the [List Available Contacts API](https://learn.microsoft.com/rest/api/orbital/azureorbitalgroundstation/spacecrafts/list-available-contacts?view=rest-orbital-azureorbitalgroundstation-2022-11-01&tabs=HTTP) or [Portal contact scheduling flow](schedule-contact.md). To account for the unpredictability of launch and vehicle separation, we recommend your window include additional time before and after the anticipated satellite pass.
+1. The service returns contact options if a whole window or partial window is available in your specified block.
+1. [Schedule the contact](schedule-contact.md) as normal.
+
+ > [!NOTE]
+ > [TLE updates](update-tle.md) for Launch Window Scheduling contacts are performed the same way as regular contacts. The TLE will lock five minutes before the start time of a Launch Window Schedule contact. The ground station antenna will use this TLE and move when it computes the satellite is ascending above the minimum elevation.
+
+## Next steps
+
+- [Schedule a contact](schedule-contact.md)
+- [Update the spacecraft TLE](update-TLE.md)
+- [Receive real-time antenna telemetry](receive-real-time-telemetry.md)
+- [Use Azure Resource Graph queries](resource-graph-samples.md)
orbital Receive Real Time Telemetry https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/orbital/receive-real-time-telemetry.md
You can update the settings of an existing contact profile by
You can verify both the presence and content of incoming telemetry data multiple ways.
-### Event Hubs Namespace
+### Event Hubs namespace dashboard
To verify that events are being received in your Event Hubs, you can check the graphs present on the overview page of your Event Hubs namespace within your resource group. This view shows data across all Event Hubs instances within a namespace. You can navigate to the overview page of a specific Event Hub instance in your resource group to see the graphs for that instance.
Follow the [instructions to enable Capture](../../articles/event-hubs/event-hubs
## Understand telemetry points
-### Current Telemetry Schema Version: 4.0
+### Current telemetry schema version: 4.0
The ground station provides telemetry using Avro as a schema. The schema is below: ```json
The following table provides the source device/point, possible values, and defin
| modemLockStatus | Modem: carrierLockState | ΓÇó NULL (Modem model other than QRadio or QRx; couldnΓÇÖt parse lock status Enum) <br> ΓÇó Empty string (if metric reading was null) <br> ΓÇó String: Lock status | Confirmation that the modem was locked. | | commandsSent | Modem: commandsSent | ΓÇó NULL (if not Uplink and QRadio) <br> ΓÇó Double: # of commands sent | Confirmation that commands were sent during the contact. |
-## Event Consumers
+## Event consumers
You can write simple consumer apps to receive events from your Event Hubs using [event consumers](../../articles/event-hubs/event-hubs-features.md#event-consumers). Refer to the following documentation to learn how to send and receive events Event Hubs in various languages: - [Python](../event-hubs/event-hubs-python-get-started-send.md)
orbital Register Spacecraft https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/orbital/register-spacecraft.md
# Customer intent: As a satellite operator, I want to ingest data from my satellite into Azure.
-# Register and Authorize Spacecraft
+# Register and authorize spacecraft
To contact a satellite, it must be registered and authorized as a spacecraft resource with Azure Orbital Ground Station.
To contact a satellite, it must be registered and authorized as a spacecraft res
Sign in to the [Azure portal](https://aka.ms/orbital/portal).
-## Create spacecraft resource
+## Create a spacecraft resource
Create a [spacecraft resource](spacecraft-object.md) as a representation of your satellite in Azure.
partner-solutions Dynatrace Free Trial https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/partner-solutions/dynatrace/dynatrace-free-trial.md
+
+ Title: 'Dynatrace: start a free trial'
+description: This article describes how to use the Azure portal to try Dynatrace for free.
+ Last updated : 10/30/2023+++
+# QuickStart: Start a free trial
+
+A 30-day free trial of Azure Native Dynatrace Service is available on [Azure Marketplace](https://azuremarketplace.microsoft.com/marketplace/apps/dynatrace.dynatrace_portal_integration?tab=Overview). You can sign up using the trial plan published by Dynatrace. During the trial period, you can create a Dynatrace resource on Azure and use integrated services such as log forwarding, agent based monitoring and unified Azure billing. Before the free trial expires, you can seamlessly upgrade to a paid public plan or a private offer customized for your organization.
+
+## Subscribe to a free trial
+
+You can access the trial plan by finding Azure Native Dynatrace Service on Azure portal or in the Azure Marketplace. Refer to the guide to [create a new resource](dynatrace-create.md#find-offer) and choose the free trial public plan while subscribing.
+
+## Free trial upgrade and expiry
+
+Azure Native Dynatrace Service gives an option to upgrade to a paid plan through the portal experience. Select **Upgrade to paid** to choose one of the paid plans published by Dynatrace or contact [sales@dynatrace.com](mailto:sales@dynatrace.com) for a custom offer for your organization.
++
+Upon expiration of the free trial, your services will be shut down and no logs or metrics will flow to your Dynatrace environment.
+
+## Dynatrace links
+
+For more help using Azure Native Dynatrace Service, visit the [Dynatrace](https://dt-url.net/azurenativedynatraceservice) documentation.
+
+## Next steps
+
+- To create an instance of Dynatrace, see [QuickStart: Get started with Dynatrace](dynatrace-create.md).
+- Get started with Azure Native Dynatrace Service on
+
+ > [!div class="nextstepaction"]
+ > [Azure portal](https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Dynatrace.Observability%2Fmonitors)
+
+ > [!div class="nextstepaction"]
+ > [Azure Marketplace](https://azuremarketplace.microsoft.com/marketplace/apps/dynatrace.dynatrace_portal_integration?tab=Overview)
partner-solutions Dynatrace Troubleshoot https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/partner-solutions/dynatrace/dynatrace-troubleshoot.md
This document contains information about troubleshooting your solutions that use
- Create fails because Last Name is empty. The issue happens when the user info in Microsoft Entra ID is incomplete and doesn't contain Last Name. Contact your Azure tenant's global administrator to rectify the issue and try again.
-### Logs not being emitted or Limit reached issue
+### Logs not being emitted or limit reached issue
- Resource doesn't support sending logs. Only resource types with monitoring log categories can be configured to send logs. For more information, see [supported categories](../../azure-monitor/essentials/resource-logs-categories.md). -- Limit of five diagnostic settings reached. This will display the message of Limit reached against the resource. Each Azure resource can have a maximum of five diagnostic settings. For more information, see [diagnostic settings](../../azure-monitor/essentials/diagnostic-settings.md?tabs=portal) You can go-ahead and remove the other destinations to make sure each resource is sending data to at max five destinations.
+- Limit of five diagnostic settings reached. This will display the message of Limit reached against the resource. Each Azure resource can have a maximum of five diagnostic settings. For more information, see [diagnostic settings](../../azure-monitor/essentials/diagnostic-settings.md?tabs=portal) You can go ahead and remove the other destinations to make sure each resource is sending data to at max five destinations.
- Export of Metrics data isn't supported currently by the partner solutions under Azure Monitor diagnostic settings. - ### Single sign-on errors -- **Single sign-on configuration indicates lack of permissions**
- - Occurs when the user that is trying to configure single sign-on doesn't have Manage users permissions for the Dynatrace account. For a description of how to configure this permission, see [here](https://www.dynatrace.com/support/help/shortlink/azure-native-integration#setup).
-- **Unable to save single sign-on settings**
- - Error happens when there's another Enterprise app that is using the Dynatrace SAML identifier. To find which app is using it, select **Edit** on the Basic **SAML** configuration section.
- To resolve this issue, either disable the other app or use the other app as the Enterprise app to set up SAML SSO.
+- **Single sign-on configuration indicates lack of permissions**
+ - Occurs when the user that is trying to configure single sign-on doesn't have Manage users permissions for the Dynatrace account. For a description of how to configure this permission, see [here](https://www.dynatrace.com/support/help/shortlink/azure-native-integration#setup).
+- **Unable to save single sign-on settings**
+ - Error happens when there's another Enterprise app that is using the Dynatrace SAML identifier. To find which app is using it, select **Edit** on the Basic **SAML** configuration section. To resolve this issue, either disable the other app or use the other app as the Enterprise app to set up SAML SSO.
-- **App not showing in Single sign-on settings page** - First, search for application ID. If no result is shown, check the SAML settings of the app. The grid only shows apps with correct SAML settings.
+- **App not showing in Single sign-on settings page**
+ - First, search for application ID. If no result is shown, check the SAML settings of the app. The grid only shows apps with correct SAML settings.
### Metrics checkbox disabled - To collect metrics you must have owner permission on the subscription. If you are a contributor, refer to the contributor guide mentioned in [Configure metrics and logs](dynatrace-create.md#configure-metrics-and-logs).
+### Free trial errors
+
+- **Unable to create another free trial resource on Azure**
+ - During free trials, Dynatrace accounts can only have one environment. You can therefore create only one Dynatrace resource during the trial period.
+- **My Dynatrace free trial resource is deleted**
+ - With the free trial plan, your Dynatrace resource on Azure will get deleted after trial expiry. If you require more time, contact [sales@dynatrace.com](mailto:sales@dynatrace.com).
+ ## Next steps - Learn about [managing your instance](dynatrace-how-to-manage.md) of Dynatrace.
partner-solutions Manage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/partner-solutions/logzio/manage.md
To install the VM agent, use the following steps.
1. To verify that the Logz.io agent was installed, select the VM and go to the **Extensions** window. > [!NOTE]
-> After the the VM agent is installed, if the VM is stopped, the **Logs to Logz** column will show **Not Sending** for that VM.
+> After the VM agent is installed, if the VM is stopped, the **Logs to Logz** column will show **Not Sending** for that VM.
### Uninstall VM agent
payment-hsm Deployment Scenarios https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/payment-hsm/deployment-scenarios.md
Thales doesn't provide PayShield SDK to customers, which supports HA over a clus
> [!IMPORTANT] > - Ensure your Microsoft Cloud Solution Architect has reviewed your payment HSM deployment architecture design and readiness before production launch. > - Review the supported topologies and constraints listed in the [Solution design](solution-design.md).
-> - Network Security Groups and User Defined Routes are not not supported for payment HSM subnets.
+> - Network Security Groups and User Defined Routes are not supported for payment HSM subnets.
> - Virtual network peering does not support cross-region communication with payment HSM instances. A VM in one region cannot communicate with a payment HSM instance in another region without the use of ExpressRoute or a VPN gateway. > - Customers can allocate a maximum of two payment HSMs from each stamp in one region under same subscription. > - If customer does not have a High Availability setup in their production environment, the customer will not be able to receive S2 support from Microsoft side.
postgresql How To Auto Grow Storage Portal https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/postgresql/flexible-server/how-to-auto-grow-storage-portal.md
Last updated 06/24/2022
This article describes how you can configure an Azure Database for PostgreSQL server storage to grow without impacting the workload.
-When a server reaches the allocated storage limit, the server is marked as read-only. However, if you enable storage autogrow, the server storage increases to accommodate the growing data. For servers with less than 1 TiB of provisioned storage, the autogrow feature activates when storage consumption reaches 80%. For servers with 1 TB or more of storage, autogrow activates at 90% consumption.
+or servers with more than 1 TiB of provisioned storage, the storage autogrow mechanism activates when the available space falls to less than 10% of the total capacity or 64 GiB of free space, whichever of the two values is smaller. Conversely, for servers with storage under 1 TB, this threshold is adjusted to 20% of the available free space or 64 GiB, depending on which of these values is smaller.
+
+As an illustration, take a server with a storage capacity of 2 TiB ( greater than 1 TIB). In this case, the autogrow limit is set at 64 GiB. This choice is made because 64 GiB is the smaller value when compared to 10% of 2 TiB, which is roughly 204.8 GiB. In contrast, for a server with a storage size of 128 GiB (less than 1 TiB), the autogrow feature activates when there's only 25.8 GiB of space left. This activation is based on the 20% threshold of the total allocated storage (128 GiB), which is smaller than 64 GiB.
## Enable storage auto-grow for existing servers
postgresql Concepts Backup https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/postgresql/single-server/concepts-backup.md
There are two types of restore available:
- **Point-in-time restore** is available with either backup redundancy option and creates a new server in the same region as your original server. - **Geo-restore** is available only if you configured your server for geo-redundant storage and it allows you to restore your server to a different region.
-The estimated time of recovery depends on several factors including the database sizes, the transaction log size, the network bandwidth, and the total number of databases recovering in the same region at the same time. The recovery time varies depending on the the last data backup and the amount of recovery needs to be performed. It is usually less than 12 hours.
+The estimated time of recovery depends on several factors including the database sizes, the transaction log size, the network bandwidth, and the total number of databases recovering in the same region at the same time. The recovery time varies depending on the last data backup and the amount of recovery needs to be performed. It is usually less than 12 hours.
> [!NOTE] > If your source PostgreSQL server is encrypted with customer-managed keys, please see the [documentation](concepts-data-encryption-postgresql.md) for additional considerations.
postgresql Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/postgresql/single-server/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Database for PostgreSQL
private-5g-core Azure Private 5G Core Release Notes 2308 https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/private-5g-core/azure-private-5g-core-release-notes-2308.md
Previously updated : 09/21/2023 Last updated : 11/01/2023 # Azure Private 5G Core 2308 release notes The following release notes identify the new features, critical open issues, and resolved issues for the 2308 release of Azure Private 5G Core (AP5GC). The release notes are continuously updated, with critical issues requiring a workaround added as theyΓÇÖre discovered. Before deploying this new version, review the information contained in these release notes.
-This article applies to the AP5GC 2308 release (2308.0-4). This release is compatible with the Azure Stack Edge Pro 1 GPU and Azure Stack Edge Pro 2 running the ASE 2303 and ASE 2309 releases and is supported by the 2023-06-01 and 2022-11-01 [Microsoft.MobileNetwork](/rest/api/mobilenetwork) API versions.
+This article applies to the AP5GC 2308 release (2308.0-7). This release is compatible with the Azure Stack Edge Pro 1 GPU and Azure Stack Edge Pro 2 running the ASE 2303 and ASE 2309 releases and by the 2023-06-01 and 2022-11-01 [Microsoft.MobileNetwork](/rest/api/mobilenetwork) API versions.
For more details about compatibility, see [Packet core and Azure Stack Edge compatibility](azure-stack-edge-packet-core-compatibility.md).
When the UE MTU is set to any valid value (see API Spec), then the other MTUs ar
- Access MTU: UE MTU + 60 - Data MTU: UE MTU
-Rollbacks to Packet Core versions earlier than 2308 are not possible if the UE MTU field is changed following an upgrade.
+Rollbacks to Packet Core versions earlier than 2308 aren't possible if the UE MTU field is changed following an upgrade.
To change the UE MTU signaled by the packet core, see [Modify a packet core instance](modify-packet-core.md). ### MTU Interop setting
-In this release the MTU Interop setting is deprecated and can't be set for Packet Core versions 2308 and above.
+In this release, the MTU Interop setting is deprecated and can't be set for Packet Core versions 2308 and above.
-<!-- Removed as no issues fixed in the AP5GC2308 release>
+<!-- Issues fixed in the AP5GC2308 release-->
## Issues fixed in the AP5GC 2308 release The following table provides a summary of issues fixed in this release. |No. |Feature | Issue | |--|--|--|
- | 1 | | |
-<-->
+ | 1 | Packet Forwarding | If the packet forwarding component of the userplane crashes, it may not recover. If it does not, the system experiences an outage until manually recovered |
+
## Known issues in the AP5GC 2308 release |No. |Feature | Issue | Workaround/comments |
private-5g-core Delete Resources https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/private-5g-core/delete-resources.md
All data will be lost when deleting your deployment. Back up any information you
The private mobile network resources represent your private 5G core network. If you followed the recommendations in this documentation when creating your resources, you should have a single resource group containing all private mobile network resources. You must ensure that you do not delete any unrelated resources. > [!IMPORTANT]
-> Deleting this resource group will delete the resources for all sites in your deployment. If you only want to delete a single site, see [Delete sites using the Azure portal](delete-a-site.md). You can can then return to this procedure to delete the custom location, delete the AKS cluster and reset ASE if required.
+> Deleting this resource group will delete the resources for all sites in your deployment. If you only want to delete a single site, see [Delete sites using the Azure portal](delete-a-site.md). You can then return to this procedure to delete the custom location, delete the AKS cluster and reset ASE if required.
1. Sign in to the [Azure portal](https://portal.azure.com/). 1. Search for and select the resource group containing the private mobile network resources.
private-5g-core Private Mobile Network Design Requirements https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/private-5g-core/private-mobile-network-design-requirements.md
There are multiple ways to set up your network for use with AP5GC. The exact set
:::image type="content" source="media/private-mobile-network-design-requirements/layer-3-network-with-n6-nat.png" alt-text="Diagram of a layer 3 network with N6 Network Address Translation (N A T)." lightbox="media/private-mobile-network-design-requirements/layer-3-network-with-n6-nat.png"::: - Layer 3 network without Network Address Translation (NAT)
- This network topology is a similar solution, but UE IP address ranges must be configured as static routes in the data network router with the N6 NAT IP address as the next hop address. As with the the previous solution, this topology supports up to six data networks.
+ This network topology is a similar solution, but UE IP address ranges must be configured as static routes in the data network router with the N6 NAT IP address as the next hop address. As with the previous solution, this topology supports up to six data networks.
:::image type="content" source="media/private-mobile-network-design-requirements/layer-3-network-without-n6-nat.png" alt-text="Diagram of a layer 3 network without Network Address Translation (N A T)." lightbox="media/private-mobile-network-design-requirements/layer-3-network-without-n6-nat.png"::: - Flat layer 2 network
role-based-access-control Built In Roles https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/role-based-access-control/built-in-roles.md
This role grants admin access - provides write permissions on most objects withi
"assignableScopes": [ "/" ],
- "description": "This role grants admin access - provides write permissions on most objects within a a namespace, with the exception of ResourceQuota object and the namespace object itself. Applying this role at cluster scope will give access across all namespaces.",
+ "description": "This role grants admin access - provides write permissions on most objects within a namespace, with the exception of ResourceQuota object and the namespace object itself. Applying this role at cluster scope will give access across all namespaces.",
"id": "/providers/Microsoft.Authorization/roleDefinitions/434fb43a-c01c-447e-9f67-c3ad923cfaba", "name": "434fb43a-c01c-447e-9f67-c3ad923cfaba", "permissions": [
role-based-access-control Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/role-based-access-control/policy-reference.md
Title: Built-in policy definitions for Azure RBAC description: Lists Azure Policy built-in policy definitions for Azure RBAC. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
sap Integration Get Started https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sap/workloads/integration-get-started.md
For how to configure single sign-on, see the following Azure documentation and t
- [SAP Cloud for Customer](../../active-directory/saas-apps/sap-customer-cloud-tutorial.md) Also see the following SAP resources:-- [Azure Application Gateway Setup for for Public and Internal SAP URLs](https://blogs.sap.com/2020/12/10/sap-on-azure-single-sign-on-configuration-using-saml-and-azure-active-directory-for-public-and-internal-urls/)
+- [Azure Application Gateway Setup for Public and Internal SAP URLs](https://blogs.sap.com/2020/12/10/sap-on-azure-single-sign-on-configuration-using-saml-and-azure-active-directory-for-public-and-internal-urls/)
- [SAPGUI using Kerberos and Microsoft Entra Domain Services](https://blogs.sap.com/2018/08/03/your-sap-on-azure-part-8-single-sign-on-using-azure-ad-domain-services/) ### Azure Integration Services
sap Planning Guide Storage https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sap/workloads/planning-guide-storage.md
Other built-in functionality of ANF storage:
- [Application consistent Snapshot backup for SAP HANA and Oracle](../../azure-netapp-files/azacsnap-introduction.md) > [!IMPORTANT]
-> Specifically for database deployments you want to achieve low latencies for at least your redo logs. Especially for SAP HANA, SAP requires a latency of less than than 1 millisecond for HANA redo log writes of smaller sizes. To get to such latencies, see the possibilities below.
+> Specifically for database deployments you want to achieve low latencies for at least your redo logs. Especially for SAP HANA, SAP requires a latency of less than 1 millisecond for HANA redo log writes of smaller sizes. To get to such latencies, see the possibilities below.
> [!IMPORTANT] > Even for non-DBMS usage, you should use the preview functionality that allows you to create the NFS share in the same Azure Availability Zones as you placed your VM(s) that should mount the NFS shares into. This functionality is documented in the article [Manage availability zone volume placement for Azure NetApp Files](../../azure-netapp-files/manage-availability-zone-volume-placement.md). The motivation to have this type of Availability Zone alignment is the reduction of risk surface by having the NFS shares yet in another AvZone where you don't run VMs in.
sap Sap High Availability Installation Wsfc Shared Disk https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sap/workloads/sap-high-availability-installation-wsfc-shared-disk.md
For the outlined failover tests, we assume that SAP ASCS is active on node A.
4. Restart cluster node A by using Azure PowerShell. This initiates an automatic failover of the SAP \<SID\> cluster group from node A to node B. 5. Verification
- - After failover, verify that the the SAP \<SID\> cluster group is running on cluster node B.
+ - After failover, verify that the SAP \<SID\> cluster group is running on cluster node B.
![Figure 8: In Failover Cluster Manager, the SAP \<SID\> cluster group is running on cluster node B][sap-ha-guide-figure-5002]
search Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/search/policy-reference.md
Title: Built-in policy definitions for Azure Cognitive Search description: Lists Azure Policy built-in policy definitions for Azure Cognitive Search. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
security Antimalware https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/security/fundamentals/antimalware.md
Antimalware events are collected from the Windows event system logs to your Azur
![Metrics and diagnostics](./media/antimalware/sec-azantimal-fig8.PNG) ### Enable and configure Antimalware using PowerShell cmdlets for Azure Resource Manager VMs
-To enable and configure Microsoft Antimalware for Azure Resource Manager VMs using using PowerShell cmdlets:
+To enable and configure Microsoft Antimalware for Azure Resource Manager VMs using PowerShell cmdlets:
1. Set up your PowerShell environment using this [documentation](https://github.com/Azure/azure-powershell) on GitHub. 2. Use the [Set-AzureRmVMExtension](/powershell/module/azurerm.compute/set-azurermvmextension) cmdlet to enable and configure Microsoft Antimalware for your VM.
sentinel Deprecated Illusive Platform Via Legacy Agent https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sentinel/data-connectors/deprecated-illusive-platform-via-legacy-agent.md
The Illusive Platform Connector allows you to share Illusive's attack surface an
## Query samples
-**Number of Incidents in in the last 30 days in which Trigger Type is found**
+**Number of Incidents in the last 30 days in which Trigger Type is found**
```kusto union CommonSecurityLog | where (DeviceEventClassID == "illusive:login" or DeviceEventClassID == "illusive:access" or DeviceEventClassID == "illusive:suspicious")
sentinel Recommended Illusive Platform Via Ama https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sentinel/data-connectors/recommended-illusive-platform-via-ama.md
The Illusive Platform Connector allows you to share Illusive's attack surface an
## Query samples
-**Number of Incidents in in the last 30 days in which Trigger Type is found**
+**Number of Incidents in the last 30 days in which Trigger Type is found**
```kusto union CommonSecurityLog | where (DeviceEventClassID == "illusive:login" or DeviceEventClassID == "illusive:access" or DeviceEventClassID == "illusive:suspicious")
sentinel Normalization Develop Parsers https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sentinel/normalization-develop-parsers.md
If warnings listed by the ASIM testing tools are considered valid for a parser,
Exceptions: - Field: DnsQuery Warning: Invalid value
- Exception: May have values such as "1164-ms-7.1440-9fdc2aab.3b2bd806-978e-11ec-8bb3-aad815b5cd42" which are not valid domains names. Those are are related to TKEY RR requests.
+ Exception: May have values such as "1164-ms-7.1440-9fdc2aab.3b2bd806-978e-11ec-8bb3-aad815b5cd42" which are not valid domains names. Those are related to TKEY RR requests.
- Field: DnsQuery Warning: Empty value in mandatory field Exception: May be empty for requests for root servers and for requests for RR type DNSKEY
sentinel Sentinel Solutions Catalog https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/sentinel/sentinel-solutions-catalog.md
To get the full list of all solutions available in Microsoft Sentinel, see the [
## Domain solutions
-The following table lists the the domain-specific out-of-the-box (built-in) and on-demand solutions available for you to deploy in your workspace.
+The following table lists the domain-specific out-of-the-box (built-in) and on-demand solutions available for you to deploy in your workspace.
|Name |Includes |Categories |Supported by | |||||
service-bus-messaging Jms Developer Guide https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-bus-messaging/jms-developer-guide.md
ConnectionFactory factory = new ServiceBusJmsConnectionFactory(tokenCredential,
Create a [service principal](authenticate-application.md#register-your-application-with-an-azure-ad-tenant) on Azure, and use this identity to create a `TokenCredential`. ```java
-TokenCredential tokenCredential = new new ClientSecretCredentialBuilder()
+TokenCredential tokenCredential = new ClientSecretCredentialBuilder()
                .tenantId("")                 .clientId("")                 .clientSecret("")
service-bus-messaging Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-bus-messaging/policy-reference.md
Title: Built-in policy definitions for Azure Service Bus Messaging description: Lists Azure Policy built-in policy definitions for Azure Service Bus Messaging. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
service-bus-messaging Transport Layer Security Enforce Minimum Version https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-bus-messaging/transport-layer-security-enforce-minimum-version.md
Azure Service Bus supports choosing a specific TLS version for namespaces. Curre
Azure Service Bus namespaces permit clients to send and receive data with TLS 1.0 and above. To enforce stricter security measures, you can configure your Service Bus namespace to require that clients send and receive data with a newer version of TLS. If a Service Bus namespace requires a minimum version of TLS, then any requests made with an older version will fail. > [!IMPORTANT]
-> If you are using a service that connects to Azure Service Bus, make sure that that service is using the appropriate version of TLS to send requests to Azure Service Bus before you set the required minimum version for a Service Bus namespace.
+> If you are using a service that connects to Azure Service Bus, make sure that service is using the appropriate version of TLS to send requests to Azure Service Bus before you set the required minimum version for a Service Bus namespace.
## Permissions necessary to require a minimum version of TLS
service-fabric How To Managed Cluster Managed Disk https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/how-to-managed-cluster-managed-disk.md
Azure Service Fabric managed clusters use managed disks for all storage needs, i
](../virtual-machines/managed-disks-overview.md). >[!NOTE]
-> After node type deployment you cannot modify the managed disk type or size in place. Instead, you can easily deploy a new node type with with required configuration in your cluster and migrate your workloads.
+> After node type deployment you cannot modify the managed disk type or size in place. Instead, you can easily deploy a new node type with the required configuration in your cluster and migrate your workloads.
## Managed disk types
service-fabric Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Service Fabric
service-fabric Service Fabric Concepts Unit Testing https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/service-fabric-concepts-unit-testing.md
Unit tests should execute as much of the application code that can modify the st
When a request is made to add the an employee "John Smith" And the active secondary replica "222" is promoted to primary And a request is made to get all employees
- Then the request should should return the "John Smith" employee
+ Then the request should return the "John Smith" employee
``` This test asserts that the data being captured on one replica is available to a secondary replica when it is promoted to primary. Assuming that a reliable collection is the backing store for the employee data, Aa potential failure that could be caught with this test is if the application code did not execute `CommitAsync` on the transaction to save the new employee. In that case, the second request to get employees would not return employee added by the first request.
service-fabric Service Fabric Diagnostics Oms Syslog https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/service-fabric-diagnostics-oms-syslog.md
Each Syslog event has 4 components
* Message * Severity
-The SyslogConsumer writes all platform events using Facility `Local0`. You can update to any valid facility by changing the config config. The Identity used is `ServiceFabric`. The Message field contains the whole event serialized in JSON so that it can be queried and consumed by a variety of tools.
+The SyslogConsumer writes all platform events using Facility `Local0`. You can update to any valid facility by changing the config. The Identity used is `ServiceFabric`. The Message field contains the whole event serialized in JSON so that it can be queried and consumed by a variety of tools.
## Enable SyslogConsumer
service-fabric Service Fabric Get Started https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/service-fabric-get-started.md
For latest Runtime and SDK you can download from below:
| Package |Version| | | |
-|[Install Service Fabric Runtime for Windows](https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.10.0.1816.9590.exe) | 10.0.1816.9590 |
-|[Install Service Fabric SDK](https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabricSDK.7.0.1816.msi) | 7.0.1816 |
+|[Install Service Fabric Runtime for Windows](https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.10.0.1949.9590.exe) | 10.0.1949.9590 |
+|[Install Service Fabric SDK](https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabricSDK.7.0.1949.msi) | 7.0.1949 |
You can find direct links to the installers for previous releases on [Service Fabric Releases](https://github.com/microsoft/service-fabric/tree/master/release_notes)
service-fabric Service Fabric Versions https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/service-fabric/service-fabric-versions.md
If you want to find a list of all the available Service Fabric runtime versions
### Current versions | Service Fabric runtime |Can upgrade directly from|Can downgrade to*|Compatible SDK or NuGet package version|Supported .NET runtimes** |OS Version |End of support | | | | | | | | |
+| 10.1 RTO<br>10.1.1541.9590 | 9.1 CU6<br>9.1.1851.9590 | 9.0 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | Current version |
+| 10.0 CU1<br>10.0.1949.9590 | 9.0 CU10<br>9.0.1553.9590 | 9.0 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | Current version |
| 10.0 RTO<br>10.0.1816.9590 | 9.0 CU10<br>9.0.1553.9590 | 9.0 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | Current version |
+| 9.1 CU7<br>9.1.1993.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 |
| 9.1 CU6<br>9.1.1851.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU5<br>9.1.1833.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU4<br>9.1.1799.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 |
If you want to find a list of all the available Service Fabric runtime versions
| 9.1 CU2<br>9.1.1583.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 7, .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU1<br>9.1.1436.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 6.0 (GA), >= .NET Core 3.1, <br>All >= .NET Framework 4.5 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 | | 9.1 RTO<br>9.1.1390.9590 | 8.2 CU6<br>8.2.1686.9590 | 8.2 | Less than or equal to version 6.0 | .NET 6.0 (GA), >= .NET Core 3.1, <br>All >= .NET Framework 4.5 | [See supported OS version](#supported-windows-versions-and-support-end-date) | January 31, 2024 |
+| 9.0 CU12<br>9.0.1672.9590 | 8.0 CU3<br>8.0.536.9590 | 8.0 | Less than or equal to version 6.0 | .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | November 1, 2023 |
| 9.0 CU11<br>9.0.1569.9590 | 8.0 CU3<br>8.0.536.9590 | 8.0 | Less than or equal to version 6.0 | .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | November 1, 2023 | | 9.0 CU10<br>9.0.1553.9590 | 8.0 CU3<br>8.0.536.9590 | 8.0 | Less than or equal to version 6.0 | .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | November 1, 2023 | | 9.0 CU9<br>9.0.1526.9590 | 8.0 CU3<br>8.0.536.9590 | 8.0 | Less than or equal to version 6.0 | .NET 6, All, <br> >= .NET Framework 4.6.2 | [See supported OS version](#supported-windows-versions-and-support-end-date) | November 1, 2023 |
Support for Service Fabric on a specific OS ends when support for the OS version
### Current versions | Service Fabric runtime | Can upgrade directly from |Can downgrade to*|Compatible SDK or NuGet package version | Supported .NET runtimes** | OS version | End of support | | | | | | | | |
+| 10.1 RTO<br>10.1.1507.1 | 9.1 CU6<br>9.1.1642.1 | 9.0 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | Current version |
+| 10.0 CU1<br>10.0.1829.1 | 9.0 CU10<br>9.0.1489.1 | 9.0 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | Current version |
| 10.0 RTO<br>10.0.1728.1 | 9.0 CU10<br>9.0.1489.1 | 9.0 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | Current version |
+| 9.1 CU7<br>9.1.1740.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 |
| 9.1 CU6<br>9.1.1642.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU5<br>9.1.1625.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU4<br>9.1.1592.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 |
Support for Service Fabric on a specific OS ends when support for the OS version
| 9.1 CU2<br>9.1.1388.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | .NET 7, .NET 6, All | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 | | 9.1 CU1<br>9.1.1230.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | Less than or equal to version 6.0 | >= .NET Core 2.1 | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 | | 9.1 RTO<br>9.1.1206.1 | 8.2 CU6<br>8.2.1485.1 | 8.2 | Less than or equal to version 6.0 | >= .NET Core 2.1 | [See supported OS version](#supported-linux-versions-and-support-end-date) | January 31, 2024 |
+| 9.0 CU12<br>9.0.1554.1 | 8.0 CU3<br>8.0.527.1 | 8.2 CU 5.1<br>8.2.1483.1 | .NET 6 | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | November 1, 2023 |
| 9.0 CU11<br>9.0.1503.1 | 8.0 CU3<br>8.0.527.1 | 8.2 CU 5.1<br>8.2.1483.1 | .NET 6 | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | November 1, 2023 | | 9.0 CU10<br>9.0.1489.1 | 8.0 CU3<br>8.0.527.1 | 8.2 CU 5.1<br>8.2.1483.1 | .NET 6 | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | November 1, 2023 | | 9.0 CU9<br>9.0.1463.1 | 8.0 CU3<br>8.0.527.1 | 8.2 CU 5.1<br>8.2.1483.1 | .NET 6 | N/A | [See supported OS version](#supported-linux-versions-and-support-end-date) | November 1, 2023 |
The following table lists the version names of Service Fabric and their correspo
| Version name | Windows version number | Linux version number | | | | |
+| 10.1 RTO | 10.1.1541.9590 | 10.1.1507.1 |
+| 10.0 CU1 | 10.0.1949.9590 | 10.0.1829.1 |
| 10.0 RTO | 10.0.1816.9590 | 10.0.1728.1 |
+| 9.1 CU7 | 9.1.1993.9590 | 9.1.1740.1 |
| 9.1 CU6 | 9.1.1851.9590 | 9.1.1642.1 | | 9.1 CU5 | 9.1.1833.9590 | 9.1.1625.1 | | 9.1 CU4 | 9.1.1799.9590 | 9.1.1592.1 |
The following table lists the version names of Service Fabric and their correspo
| 9.1 CU2 | 9.1.1583.9590 | 9.1.1388.1 | | 9.1 CU1 | 9.1.1436.9590 | 9.1.1230.1 | | 9.1 RTO | 9.1.1390.9590 | 9.1.1206.1 |
+| 9.0 CU12 | 9.0.1672.9590 | 9.0.1554.1 |
| 9.0 CU11 | 9.0.1569.9590 | 9.0.1503.1 | | 9.0 CU10 | 9.0.1553.9590 | 9.0.1489.1 | | 9.0 CU9 | 9.0.1526.9590 | 9.0.1463.1 |
spring-apps How To Application Insights https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/how-to-application-insights.md
az spring app-insights update \
### Manage Application Insights buildpack bindings
-This section applies to the Enterprise plan only, and provides instructions that that supplement the previous section.
+This section applies to the Enterprise plan only, and provides instructions that supplement the previous section.
The Azure Spring Apps Enterprise plan uses buildpack bindings to integrate [Azure Application Insights](../azure-monitor/app/app-insights-overview.md) with the type `ApplicationInsights`. For more information, see [How to configure APM integration and CA certificates](how-to-enterprise-configure-apm-integration-and-ca-certificates.md).
spring-apps Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/policy-reference.md
Title: Built-in policy definitions for Azure Spring Apps description: Lists Azure Policy built-in policy definitions for Azure Spring Apps. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
spring-apps Quickstart Automate Deployments Github Actions Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-automate-deployments-github-actions-enterprise.md
Continue on to any of the following optional quickstarts:
- [Load application secrets using Key Vault](quickstart-key-vault-enterprise.md) - [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md) - [Set request rate limits](quickstart-set-request-rate-limits-enterprise.md)
+- [Integrate Azure Open AI](quickstart-fitness-store-azure-openai.md)
spring-apps Quickstart Deploy Apps Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-deploy-apps-enterprise.md
Now that you've successfully built and deployed your app, continue on to any of
- [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md) - [Set request rate limits](quickstart-set-request-rate-limits-enterprise.md) - [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
+- [Integrate Azure Open AI](quickstart-fitness-store-azure-openai.md)
spring-apps Quickstart Fitness Store Azure Openai https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-fitness-store-azure-openai.md
+
+ Title: "Quickstart - Integrate Azure OpenAI"
+
+description: Explains how to integrate Azure OpenAI on the Azure Spring Apps Enterprise plan.
++++ Last updated : 11/02/2023+++
+# Quickstart: Integrate Azure OpenAI
+
+> [!NOTE]
+> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
+
+**This article applies to:** ❌ Basic/Standard ✔️ Enterprise
+
+This quickstart shows you how to integrate Azure OpenAI with applications deployed on the Azure Spring Apps Enterprise plan.
+
+Azure OpenAI enables your applications to take advantage of large-scale, generative AI models with deep understandings of language and code to enable new reasoning and comprehension capabilities.
+
+The following video shows how Azure Spring Apps uses Azure OpenAI to build intelligent applications:
+
+<br>
+
+> [!VIDEO https://www.youtube.com/embed/wxgGoLohvsg]
+
+## Prerequisites
+
+- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
+- Access granted to Azure OpenAI. For more information, see [Request Access to Azure OpenAI Service](https://customervoice.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR7en2Ais5pxKtso_Pz4b1_xUOFA5Qk1UWDRBMjg0WFhPMkIzTzhKQ1dWNyQlQCN0PWcu).
+- Understand and fulfill the [Requirements](how-to-enterprise-marketplace-offer.md#requirements) section of [Enterprise plan in Azure Marketplace](how-to-enterprise-marketplace-offer.md).
+- [The Azure CLI version 2.45.0 or higher](/cli/azure/install-azure-cli).
+- [Git](https://git-scm.com/).
+- [jq](https://stedolan.github.io/jq/download/)
+- [!INCLUDE [install-enterprise-extension](includes/install-enterprise-extension.md)]
+- Complete the steps in [Build and deploy apps to Azure Spring Apps using the Enterprise plan](quickstart-deploy-apps-enterprise.md).
+
+## Provision Azure OpenAI
+
+To add AI to the application, create an Azure OpenAI account and deploy language models. The following steps describe how to provision an Azure OpenAI account and deploy language models using the Azure CLI:
+
+1. Use the following command to create an Azure OpenAI account:
+
+ ```azurecli
+ az cognitiveservices account create \
+ --resource-group <resource-group-name> \
+ --name <open-ai-service-name> \
+ --location <region> \
+ --kind OpenAI \
+ --sku s0 \
+ --custom-domain <open-ai-service-name>
+ ```
+
+1. Use the following commands to create the model deployments for `text-embedding-ada-002` and `gpt-35-turbo-16k` in your Azure OpenAI service instance:
+
+ ```azurecli
+ az cognitiveservices account deployment create \
+ --resource-group <resource-group-name> \
+ --name <open-ai-service-name> \
+ --deployment-name text-embedding-ada-002 \
+ --model-name text-embedding-ada-002 \
+ --model-version "2" \
+ --model-format OpenAI \
+ --sku-name "Standard" \
+ --sku-capacity 1
+
+ az cognitiveservices account deployment create \
+ --resource-group <resource-group-name> \
+ --name <open-ai-service-name> \
+ --deployment-name gpt-35-turbo-16k \
+ --model-name gpt-35-turbo-16k \
+ --model-version "0613" \
+ --model-format OpenAI \
+ --sku-name "Standard" \
+ --sku-capacity 1
+ ```
+
+### Deploy Assist Service to Azure Spring Apps
+
+Use the following steps to create, configure, and deploy the Assist Service application to Azure Spring Apps.
+
+1. Use the following command to create the new AI service, `assist-service`:
+
+ ```azurecli
+ az spring app create \
+ --resource-group <resource-group-name> \
+ --name assist-service \
+ --service <Azure-Spring-Apps-service-instance-name> \
+ --instance-count 1 \
+ --memory 1Gi
+ ```
+
+1. Use the following command to configure Spring Cloud Gateway with the Assist Service route:
+
+ ```azurecli
+ az spring gateway route-config create \
+ --resource-group <resource-group-name> \
+ --service <Azure-Spring-Apps-service-instance-name> \
+ --name assist-routes \
+ --app-name assist-service \
+ --routes-file azure-spring-apps-enterprise/resources/json/routes/assist-service.json
+ ```
+
+1. Use the following command to retrieve the REST API endpoint base URL for the Azure OpenAI service:
+
+ ```azurecli
+ export SPRING_AI_AZURE_OPENAI_ENDPOINT=$(az cognitiveservices account show \
+ --name <open-ai-service-name> \
+ --resource-group <resource-group-name> \
+ | jq -r .properties.endpoint)
+ ```
+
+1. Use the following command to retrieve the primary API key:
+
+ ```azurecli
+ export SPRING_AI_AZURE_OPENAI_APIKEY=$(az cognitiveservices account keys list \
+ --name <open-ai-service-name> \
+ --resource-group <resource-group-name> \
+ | jq -r .key1)
+ ```
+
+1. Use the following command to deploy the Assist Service application:
+
+ ```azurecli
+ az spring app deploy
+ --resource-group <resource-group-name> \
+ --name assist-service \
+ --service <Azure-Spring-Apps-service-instance-name> \
+ --source-path apps/acme-assist \
+ --build-env BP_JVM_VERSION=17 \
+ --env \
+ SPRING_AI_AZURE_OPENAI_ENDPOINT=${SPRING_AI_AZURE_OPENAI_ENDPOINT} \
+ SPRING_AI_AZURE_OPENAI_APIKEY=${SPRING_AI_AZURE_OPENAI_APIKEY} \
+ SPRING_AI_AZURE_OPENAI_MODEL=gpt-35-turbo-16k \
+ SPRING_AI_AZURE_OPENAI_EMBEDDINGMODEL=text-embedding-ada-002
+ ```
+
+1. Now, test the Fitness Store application in the browser. Select **ASK TO FITASSIST** to converse with the Assist Service application.
+
+ :::image type="content" source="media/quickstart-fitness-store-azure-openai/homepage.png" alt-text="Screenshot that shows the ASK TO FITASSIST button." lightbox="media/quickstart-fitness-store-azure-openai/homepage.png":::
+
+1. In **FitAssist**, enter *I need a bike for a commute to work* and observe the output that was generated by the Assist Service application:
+
+ :::image type="content" source="media/quickstart-fitness-store-azure-openai/fitassist-question.png" alt-text="Screenshot that shows the 'I need a bike for a commute to work' query and the response from the Fitness Store assistant." lightbox="media/quickstart-fitness-store-azure-openai/fitassist-question.png":::
+
+## Clean up resources
+
+If you plan to continue working with subsequent quickstarts and tutorials, you might want to leave these resources in place. When no longer needed, delete the resource group, which deletes the resources in the resource group. To delete the resource group by using Azure CLI, use the following commands:
+
+```azurecli
+echo "Enter the Resource Group name:" &&
+read resourceGroupName &&
+az group delete --name $resourceGroupName &&
+echo "Press [ENTER] to continue ..."
+```
+
+## Next steps
+
+Continue on to any of the following optional quickstarts:
+
+- [Configure single sign-on](quickstart-configure-single-sign-on-enterprise.md)
+- [Integrate Azure Database for PostgreSQL and Azure Cache for Redis](quickstart-integrate-azure-database-and-redis-enterprise.md)
+- [Load application secrets using Key Vault](quickstart-key-vault-enterprise.md)
+- [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md)
+- [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
spring-apps Quickstart Integrate Azure Database And Redis Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-integrate-azure-database-and-redis-enterprise.md
Continue on to any of the following optional quickstarts:
- [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md) - [Set request rate limits](quickstart-set-request-rate-limits-enterprise.md) - [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
+- [Integrate Azure OpenAI](quickstart-fitness-store-azure-openai.md)
spring-apps Quickstart Key Vault Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-key-vault-enterprise.md
Continue on to any of the following optional quickstarts:
- [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md) - [Set request rate limits](quickstart-set-request-rate-limits-enterprise.md) - [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
+- [Integrate Azure OpenAI](quickstart-fitness-store-azure-openai.md)
spring-apps Quickstart Monitor End To End Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-monitor-end-to-end-enterprise.md
Continue on to any of the following optional quickstarts:
- [Load application secrets using Key Vault](quickstart-key-vault-enterprise.md) - [Set request rate limits](quickstart-set-request-rate-limits-enterprise.md) - [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
+- [Integrate Azure OpenAI](quickstart-fitness-store-azure-openai.md)
spring-apps Quickstart Sample App Acme Fitness Store Introduction https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-sample-app-acme-fitness-store-introduction.md
This quickstart describes the [fitness store](https://github.com/Azure-Samples/a
The following diagram shows a common application architecture: This architecture shows an application composed of smaller applications with a gateway, multiple databases, security services, monitoring, and automation. This quickstart applies this architecture to a Fitness Store application. This application is composed of the following services split up by domain: -- Three Java Spring Boot applications:
+- Four Java Spring Boot applications:
- **Catalog Service** contains an API for fetching available products. - **Payment Service** validates and processes payments for users' orders. - **Identity Service** provides reference to the authenticated user.
+ - **Assist Service** provides AI functionality to the fitness store.
- One Python application: - **Cart Service** manages users' items that have been selected for purchase.
spring-apps Quickstart Set Request Rate Limits Enterprise https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/quickstart-set-request-rate-limits-enterprise.md
Continue on to any of the following optional quickstarts:
- [Load application secrets using Key Vault](quickstart-key-vault-enterprise.md) - [Monitor applications end-to-end](quickstart-monitor-end-to-end-enterprise.md) - [Automate deployments](quickstart-automate-deployments-github-actions-enterprise.md)
+- [Integrate Azure OpenAI](quickstart-fitness-store-azure-openai.md)
spring-apps Tutorial Alerts Action Groups https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/spring-apps/tutorial-alerts-action-groups.md
Title: "Tutorial: Monitor Azure Spring Apps resources using alerts and action groups"
-description: Learn how to to monitor Spring app resources using alerts and action groups in Azure Spring Apps.
+description: Learn how to monitor Spring app resources using alerts and action groups in Azure Spring Apps.
static-web-apps Add Api https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/static-web-apps/add-api.md
You create an Azure Functions project for your static web app's API. By default,
| Prompt | Value | | | | | Select a language | **JavaScript** |
+ | Select a programming model | **V3** |
| Provide a function name | **message** |
+ > [!TIP]
+ > You can learn more about the differences between programming models in the [Azure Functions developer guide](/articles/azure-functions/functions-reference-node.md)
+
An Azure Functions project is generated with an HTTP triggered function. Your app now has a project structure similar to the following example. ```Files
To run your frontend app and API together locally, Azure Static Web Apps provide
Ensure you have the necessary command line tools installed. ```bash
-npm install -g @azure/static-web-apps-cli
+npm install -D @azure/static-web-apps-cli
``` ### Build frontend app
storage Authorize Data Operations Powershell https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/authorize-data-operations-powershell.md
The Azure Storage extensions are supported for operations on blob data. Which op
For details about the permissions required for each Azure Storage operation on a container, see [Call storage operations with OAuth tokens](/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens). > [!IMPORTANT]
-> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users users who do not already possess the account keys must use Microsoft Entra credentials to access blob data. In PowerShell, include the `-UseConnectedAccount` parameter to create an **AzureStorageContext** object with your Microsoft Entra credentials.
+> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users who do not already possess the account keys must use Microsoft Entra credentials to access blob data. In PowerShell, include the `-UseConnectedAccount` parameter to create an **AzureStorageContext** object with your Microsoft Entra credentials.
<a name='call-powershell-commands-using-azure-ad-credentials'></a>
storage Sas Service Create Javascript https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/sas-service-create-javascript.md
Last updated 01/19/2023
ms.devlang: javascript-+ # Create a service SAS for a container or blob with JavaScript
storage Soft Delete Blob Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/soft-delete-blob-overview.md
The following table describes the expected behavior for delete and write operati
[!INCLUDE [Blob Storage feature support in Azure Storage accounts](../../../includes/azure-storage-feature-support.md)]
-Soft delete is not supported for blobs that are uploaded by using Data Lake Storage Gen2 APIs on Blob Storage accounts.
+Soft delete is not supported for blobs that are uploaded by using Data Lake Storage Gen2 APIs on Storage accounts with no hierarchical namespace.
## Pricing and billing
storage Storage Blob Account Delegation Sas Create Javascript https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/storage-blob-account-delegation-sas-create-javascript.md
Title: Create account SAS tokens - JavaScript
+ Title: Create an account SAS with JavaScript
description: Create and use account SAS tokens in a JavaScript application that works with Azure Blob Storage. This article helps you set up a project and authorizes access to an Azure Blob Storage endpoint.
Last updated 09/21/2023-+ # Create and use account SAS tokens with Azure Blob Storage and JavaScript
storage Storage Blob Container Properties Metadata Typescript https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/storage-blob-container-properties-metadata-typescript.md
Title: Manage container properties with TypeScript
+ Title: Use TypeScript to manage properties and metadata for a blob container
description: Learn how to set and retrieve system properties and store custom metadata on blob containers in your Azure Storage account using the JavaScript client library using TypeScript.
storage Storage Blob Create User Delegation Sas Javascript https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/storage-blob-create-user-delegation-sas-javascript.md
Title: Create user delegation SAS tokens - JavaScript
+ Title: Create a user delegation SAS with JavaScript
description: Create and use user delegation SAS tokens in a JavaScript application that works with Azure Blob Storage. This article helps you set up a project and authorizes access to an Azure Blob Storage endpoint.
storage Storage Blob Properties Metadata Typescript https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/storage-blob-properties-metadata-typescript.md
Title: Get blob properties and metadata with TypeScript
+ Title: Manage properties and metadata for a blob with TypeScript
description: Learn how to set and retrieve system properties and store custom metadata on blobs with TypeScript in your Azure Storage account using the JavaScript client library.
storage Storage Manage Find Blobs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/blobs/storage-manage-find-blobs.md
After the blob index updates, you can use the native query and discovery capabil
The [Find Blobs by Tags](/rest/api/storageservices/find-blobs-by-tags) operation enables you to get a filtered set of blobs whose index tags match a given query expression. `Find Blobs by Tags` supports filtering across all containers within your storage account or you can scope the filtering to just a single container. Since all the index tag keys and values are strings, relational operators use a lexicographic sorting. > [!IMPORTANT]
-> Finding data using blob index tags can be performed by the [Storage Blob Data Owner](../../role-based-access-control/built-in-roles.md#storage-blob-data-owner) and by anyone with a Shared Access Signature that has permission to to find blobs by tags (the `f` SAS permission).
+> Finding data using blob index tags can be performed by the [Storage Blob Data Owner](../../role-based-access-control/built-in-roles.md#storage-blob-data-owner) and by anyone with a Shared Access Signature that has permission to find blobs by tags (the `f` SAS permission).
> > In addition, RBAC users with the `Microsoft.Storage/storageAccounts/blobServices/containers/blobs/filter/action` permission can perform this operation.
storage Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/common/policy-reference.md
Title: Built-in policy definitions for Azure Storage description: Lists Azure Policy built-in policy definitions for Azure Storage. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
storage Transport Layer Security Configure Minimum Version https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/common/transport-layer-security-configure-minimum-version.md
StorageBlobLogs
When you are confident that traffic from clients using older versions of TLS is minimal, or that it's acceptable to fail requests made with an older version of TLS, then you can begin enforcement of a minimum TLS version on your storage account. Requiring that clients use a minimum version of TLS to make requests against a storage account is part of a strategy to minimize security risks to your data. > [!IMPORTANT]
-> If you are using a service that connects to Azure Storage, make sure that that service is using the appropriate version of TLS to send requests to Azure Storage before you set the required minimum version for a storage account.
+> If you are using a service that connects to Azure Storage, make sure that service is using the appropriate version of TLS to send requests to Azure Storage before you set the required minimum version for a storage account.
### Configure the minimum TLS version for a storage account
storage File Sync Networking Endpoints https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/file-sync/file-sync-networking-endpoints.md
When you create a private endpoint for an Azure resource, the following resource
- **A private DNS zone**: If you've never deployed a private endpoint for this virtual network before, a new private DNS zone will be deployed for your virtual network. A DNS A record will also be created for Azure resource in this DNS zone. If you've already deployed a private endpoint in this virtual network, a new A record for Azure resource will be added to the existing DNS zone. Deploying a DNS zone is optional, however highly recommended to simplify the DNS management required. > [!Note]
-> This article uses the DNS suffixes for the Azure Public regions, `core.windows.net` for storage accounts and `afs.azure.net` for Storage Sync Services. This commentary also applies to Azure Sovereign clouds such as the Azure US Government cloud - just substitute the the appropriate suffixes for your environment.
+> This article uses the DNS suffixes for the Azure Public regions, `core.windows.net` for storage accounts and `afs.azure.net` for Storage Sync Services. This commentary also applies to Azure Sovereign clouds such as the Azure US Government cloud - just substitute the appropriate suffixes for your environment.
### Create the storage account private endpoint # [Portal](#tab/azure-portal)
storage File Sync Release Notes https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/file-sync/file-sync-release-notes.md
Previously updated : 10/2/2023 Last updated : 11/3/2023
The following Azure File Sync agent versions are supported:
| Milestone | Agent version number | Release date | Status | |-|-|--|| | V16.0 Release - [KB5013877](https://support.microsoft.com/topic/ffdc8fe2-c653-43c8-8b47-0865267fd520)| 16.0.0.0 | January 30, 2023 | Supported |
-| V15.2 Release - [KB5013875](https://support.microsoft.com/topic/9159eee2-3d16-4523-ade4-1bac78469280)| 15.2.0.0 | November 21, 2022 | Supported - Agent version will expire on October 2, 2023 |
-| V15.1 Release - [KB5003883](https://support.microsoft.com/topic/45761295-d49a-431e-98ec-4fb3329b0544)| 15.1.0.0 | September 19, 2022 | Supported - Agent version will expire on October 2, 2023 |
-| V15 Release - [KB5003882](https://support.microsoft.com/topic/2f93053f-869b-4782-a832-e3c772a64a2d)| 15.0.0.0 | March 30, 2022 | Supported - Agent version will expire on October 2, 2023 |
-| V14.1 Release - [KB5001873](https://support.microsoft.com/topic/d06b8723-c4cf-4c64-b7ec-3f6635e044c5)| 14.1.0.0 | December 1, 2021 | Supported - Agent version will expire on August 1, 2023 |
-| V14 Release - [KB5001872](https://support.microsoft.com/topic/92290aa1-75de-400f-9442-499c44c92a81)| 14.0.0.0 | October 29, 2021 | Supported - Agent version will expire on August 1, 2023 |
+| V15.2 Release - [KB5013875](https://support.microsoft.com/topic/9159eee2-3d16-4523-ade4-1bac78469280)| 15.2.0.0 | November 21, 2022 | Supported - Agent version will expire on March 19, 2024 |
+| V15.1 Release - [KB5003883](https://support.microsoft.com/topic/45761295-d49a-431e-98ec-4fb3329b0544)| 15.1.0.0 | September 19, 2022 | Supported - Agent version will expire on March 19, 2024 |
+| V15 Release - [KB5003882](https://support.microsoft.com/topic/2f93053f-869b-4782-a832-e3c772a64a2d)| 15.0.0.0 | March 30, 2022 | Supported - Agent version will expire on March 19, 2024 |
+| V14.1 Release - [KB5001873](https://support.microsoft.com/topic/d06b8723-c4cf-4c64-b7ec-3f6635e044c5)| 14.1.0.0 | December 1, 2021 | Supported - Agent version will expire on January 23, 2024 |
+| V14 Release - [KB5001872](https://support.microsoft.com/topic/92290aa1-75de-400f-9442-499c44c92a81)| 14.0.0.0 | October 29, 2021 | Supported - Agent version will expire on January 23, 2024 |
## Unsupported versions The following Azure File Sync agent versions have expired and are no longer supported:
storage Storage Files Configure P2s Vpn Linux https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/files/storage-files-configure-p2s-vpn-linux.md
The Azure virtual network gateway is the service that your on-premises Linux mac
Remember to replace `<desired-vpn-name-here>` with the name you would like for these resources. > [!Note]
-> Deploying the Azure virtual network gateway can take up to 45 minutes. While this resource is being deployed, this bash script script will block for the deployment to be completed.
+> Deploying the Azure virtual network gateway can take up to 45 minutes. While this resource is being deployed, this bash script will block for the deployment to be completed.
> > P2S IKEv2/OpenVPN connections are not supported with the **Basic** SKU. This script uses the **VpnGw1** SKU for the virtual network gateway, accordingly.
storage Storage Files Identity Ad Ds Enable https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/files/storage-files-identity-ad-ds-enable.md
Set-ADAccountPassword -Identity <domain-object-identity> -Reset -NewPassword $Ne
### Debugging
-If needed, you can run the `Debug-AzStorageAccountAuth` cmdlet to conduct a set of basic checks on your AD configuration with the logged on AD user. This cmdlet is supported on AzFilesHybrid v0.1.2+ version and higher. For more information on the checks performed in this cmdlet, see [Unable to mount Azure file shares with AD credentials](/troubleshoot/azure/azure-storage/files-troubleshoot-smb-authentication#unable-to-mount-azure-file-shares-with-ad-credentials?toc=/azure/storage/files/toc.json).
+If needed, you can run the `Debug-AzStorageAccountAuth` cmdlet to conduct a set of basic checks on your AD configuration with the logged on AD user. This cmdlet is supported on AzFilesHybrid v0.1.2+ version and higher. This cmdlet is only applicable for AD DS authentication. It doesn't work for Microsoft Entra Domain Services or Microsoft Entra Kerberos enabled storage accounts. For more information on the checks performed in this cmdlet, see [Unable to mount Azure file shares with AD credentials](/troubleshoot/azure/azure-storage/files-troubleshoot-smb-authentication#unable-to-mount-azure-file-shares-with-ad-credentials?toc=/azure/storage/files/toc.json).
```PowerShell Debug-AzStorageAccountAuth -StorageAccountName $StorageAccountName -ResourceGroupName $ResourceGroupName -Verbose
storage Storage Files Networking Endpoints https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/files/storage-files-networking-endpoints.md
Creating a private endpoint for your storage account will result in the followin
- **A private DNS zone**: If you've never deployed a private endpoint for this virtual network before, a new private DNS zone will be deployed for your virtual network. A DNS A record will also be created for the storage account in this DNS zone. If you've already deployed a private endpoint in this virtual network, a new A record for the storage account will be added to the existing DNS zone. Deploying a DNS zone is optional, however highly recommended, and required if you are mounting your Azure file shares with an AD service principal or using the FileREST API. > [!Note]
-> This article uses the storage account DNS suffix for the Azure Public regions, `core.windows.net`. This commentary also applies to Azure Sovereign clouds such as the Azure US Government cloud and the Microsoft Azure operated by 21Vianet cloud - just substitute the the appropriate suffixes for your environment.
+> This article uses the storage account DNS suffix for the Azure Public regions, `core.windows.net`. This commentary also applies to Azure Sovereign clouds such as the Azure US Government cloud and the Microsoft Azure operated by 21Vianet cloud - just substitute the appropriate suffixes for your environment.
# [Portal](#tab/azure-portal) [!INCLUDE [storage-files-networking-endpoints-private-portal](../../../includes/storage-files-networking-endpoints-private-portal.md)]
storage Authorize Data Operations Cli https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/queues/authorize-data-operations-cli.md
Azure CLI commands for reading and writing queue data include the optional `--au
To use the `--auth-mode` parameter, make sure that you have installed Azure CLI v2.0.46 or later. Run `az --version` to check your installed version. > [!NOTE]
-> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users users who do not already possess the account keys must use Microsoft Entra credentials to access queue data.
+> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users who do not already possess the account keys must use Microsoft Entra credentials to access queue data.
> [!IMPORTANT] > If you omit the `--auth-mode` parameter or set it to `key`, then the Azure CLI attempts to use the account access key for authorization. In this case, Microsoft recommends that you provide the access key either on the command or in the `AZURE_STORAGE_KEY` environment variable. For more information about environment variables, see the section titled [Set environment variables for authorization parameters](#set-environment-variables-for-authorization-parameters).
storage Authorize Data Operations Powershell https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/queues/authorize-data-operations-powershell.md
The Azure Storage extensions are supported for operations on queue data. Which o
For details about the permissions required for each Azure Storage operation on a queue, see [Call storage operations with OAuth tokens](/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens). > [!IMPORTANT]
-> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users users who do not already possess the account keys must use Microsoft Entra credentials to access queue data. In PowerShell, include the `-UseConnectedAccount` parameter to create an **AzureStorageContext** object with your Microsoft Entra credentials.
+> When a storage account is locked with an Azure Resource Manager **ReadOnly** lock, the [List Keys](/rest/api/storagerp/storageaccounts/listkeys) operation is not permitted for that storage account. **List Keys** is a POST operation, and all POST operations are prevented when a **ReadOnly** lock is configured for the account. For this reason, when the account is locked with a **ReadOnly** lock, users who do not already possess the account keys must use Microsoft Entra credentials to access queue data. In PowerShell, include the `-UseConnectedAccount` parameter to create an **AzureStorageContext** object with your Microsoft Entra credentials.
<a name='call-powershell-commands-using-azure-ad-credentials'></a>
storage Nasuni Deployment Guide https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/solution-integration/validated-partners/primary-secondary-storage/nasuni-deployment-guide.md
# Nasuni Configuration Guide for Microsoft Azure
-Nasuni® enables organizations to store, protect, synchronize, and collaborate on unstructured file data across all locations. Built for the cloud and powered by UniFS, the world’s only global file system, the Nasuni File Data Platform couples the performance of local file servers with the infinite scale of the cloud to provide a global file-sharing platform at half the cost of traditional file infrastructures.
+Nasuni uses cost-effective Azure Blob object and an intelligent caching architecture to deliver high performance SMB and NFS file shares across multiple Azure regions and on-premises locations. With effortless scalability, up-to-the-minute recovery points, instant recoveries, real-time ransomware detection, zero-latency edge performance, remote/hybrid worker support, and more, Nasuni with Azure Blob is the enterprise-class solution for moving traditional file server and NAS workloads into the cloud.
How Nasuni works:-- Stores all files and metadata in private (on-premises) or public cloud object storage.-- Provides unlimited primary or archive file storage capacity.-- Intelligently caches just the active data on lightweight Nasuni Edge Appliances.-- Intelligently caches just the active data on lightweight Nasuni Edge Appliances.
+- Stores all files and metadata in Azure Blob Cool or Cold object storage using Nasuni’s cloud-native UniFS® global file system.
+- Caches copies the actively used file data from Azure Blob on lightweight Nasuni Edge Appliance virtual machines that can be deployed in any on-premises location or Azure region for high performance read/write access. Caching also minimizes Azure egress fees, since any cached files can be accessed repeatedly without having to be retrieved from Azure Blob.
+- Protects file data with snapshots taken as often as every minute and stored as an infinite, immutable versioned timeline in Azure Blob.
+- Synchronizes all Nasuni Edge caches from the gold copies of file data in Azure Blob to present a global file system and unified namespace across multiple locations.
+- Provides Global File Lock so that multiple authors can edit the same files in different locations without version conflict.
+- Detects ransomware in real time at each edge location, stops attacks with automated mitigation policies, and restores only infected files from the most recent healthy snapshot.
+- Provides VPN-less access to file shares for remote/hybrid workers and enables secure external file sharing with authorized third parties.
-Microsoft Azure is a cloud computing service created by Microsoft for building, testing, deploying, and managing applications and services through Microsoft-managed data centers. It provides software as a service (SaaS), platform as a service (PaaS) and infrastructure as a service (IaaS) and supports many different programming languages, tools, and frameworks, including both Microsoft-specific and third-party software and systems.
-
-Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn't adhere to a particular data model or definition, such as text or binary data.
+Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data and offers superior durability and scalability at the lowest cost of any Azure storage account. With the capabilities listed above, Nasuni makes Azure Blob the best target for enterprises that want to move traditional NAS and Windows file server workloads to the cloud using standard SMB (CIFS) and NFS protocols, without having to rewrite applications for object storage.
> [!TIP] > For Microsoft Azure configuration suggestions to prevent accidental or malicious deletion of data, see [Deletion Security](https://b.link/Nasuni_Deletion_Security)
Azure Blob storage is Microsoft's object storage solution for the cloud. Blob st
> Selecting the ΓÇ£Secure transfer requiredΓÇ¥ feature for an Azure Storage account does not affect the operation of the Nasuni Edge Appliance > [!TIP]
-> In the Nasuni model, customers provide their own cloud accounts for the storage of their data. Customers should leverage their cloud provider's role-based access and identity access management features as part of their overall security strategy. Such features can be used to limit or prohibit administrative access to the cloud account, based on customer policies
+> In the Nasuni model, customers provide their own cloud accounts for the storage of their data. Customers should leverage Azure's role-based access and identity access management features as part of their overall security strategy. Such features can be used to limit or prohibit administrative access to the cloud account, based on customer policies
### Introduction This document describes how to deploy a Nasuni environment in Microsoft Azure, using Azure Blob storage to store your file data.
storage Authorize Access Azure Active Directory https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/tables/authorize-access-azure-active-directory.md
When a security principal (a user, group, or application) attempts to access a t
The authentication step requires that an application request an OAuth 2.0 access token at runtime. If an application is running from within an Azure entity such as an Azure VM, a virtual machine scale set, or an Azure Functions app, it can use a [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) to access tables.
-The authorization step requires that one or more Azure roles be assigned to the security principal. Azure Storage provides Azure roles that encompass common sets of permissions for table data. The roles that are assigned to a security principal determine the permissions that that principal will have. To learn more about assigning Azure roles for table access, see [Assign an Azure role for access to table data](assign-azure-role-data-access.md).
+The authorization step requires that one or more Azure roles be assigned to the security principal. Azure Storage provides Azure roles that encompass common sets of permissions for table data. The roles that are assigned to a security principal determine the permissions that principal will have. To learn more about assigning Azure roles for table access, see [Assign an Azure role for access to table data](assign-azure-role-data-access.md).
[!INCLUDE [storage-auth-language-table](../../../includes/storage-auth-language-table.md)]
storage Table Storage Quickstart Portal https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/storage/tables/table-storage-quickstart-portal.md
To create a table in the Azure portal:
1. Navigate to your storage account in the Azure portal. 1. Select **Storage Browser** in the left-hand navigation panel.
-1. In the Storage Browser tree, select select **Tables**.
+1. In the Storage Browser tree, select **Tables**.
1. Select the **Add table** button to add a new table. 1. In the **Add table** dialog, provide a name for the new table.
stream-analytics Confluent Kafka Input https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/stream-analytics/confluent-kafka-input.md
+
+ Title: Stream data from confluent cloud Kafka with Azure Stream Analytics
+description: Learn about how to set up an Azure Stream Analytics job as a consumer from confluent cloud kafka
++++ Last updated : 11/03/2023++
+# Stream data from confluent cloud Kafka with Azure Stream Analytics
+
+This article describes how to connect your Azure Stream Analytics job directly to confluent cloud kafka as an input.
++
+## Prerequisites
+
+- You have a confluent cloud kafka cluster.
+- You have an API Key file for your kafka cluster that contains the API key to use as a username, API Secret to use as a password and the Bootstrap server address.
+- You have an Azure Stream Analytics job. You can create an Azure Stream Analytics job by following the documentation: [Quickstart: Create a Stream Analytics job by using the Azure portal](stream-analytics-quick-create-portal.md)
+- Your confluent cloud kafka cluster must be publicly accessible and not behind a firewall or secured in a virtual network.
+- The timestamp type of the topic of your confluent cloud kafka cluster should be **LogAppendTime**. The default for confluent cloud kafka topic is **CreateTime**.
+- You should have an existing key vault. You can create a key vault resource by following the documentation [Quickstart: Create a key vault using the Azure portal](../key-vault/general/quick-create-portal.md)
+
+## Configure Azure Stream Analytics to use managed identity
+
+Azure Stream Analytics requires you to configure managed identity to access key vault.
+You can configure your stream analytics job to use managed identity by navigating to the **Managed Identity** tab on the left side under **Configure**.
++
+1. Click on the **managed identity tab** under **configure**.
+2. Select on **Switch Identity** and select the identity to use with the job: system-assigned identity or user-assigned identity.
+3. For user-assigned identity, select the subscription where your user-assigned identity is located and select the name of your identity.
+4. Review and **save**.
++
+## Download certificate from LetsEncrypt
+
+Azure stream analytics is a librdkafka-based client, and to connect to confluent cloud, you need TLS certificates that confluent cloud uses for server authentication. Confluent cloud uses TLS certificates from LetΓÇÖs Encrypt, an open certificate authority (CA).
+
+Download the ISRG Root X1 certificate in **PEM** format on the site of [LetsEncrypt](https://letsencrypt.org/certificates/).
+++
+## Configure Key vault with Permissions
+
+Azure Stream Analytics integrates seamlessly with Azure Key vault to access stored secrets needed for authentication and encryption. Your Azure Stream Analytics job connects to your Azure Key vault using managed identity to ensure a secure connection and avoid the exfiltration of secrets. To use the certificate you downloaded, you must upload it to key vault first.
+
+To upload certificates, you must have "**Key Vault Administrator**" access to your Key vault. Follow the following to grant admin access:
+
+> [!NOTE]
+> You must have "**Owner**" permissions to grant other key vault permissions.
+
+1. In your key vault, select **Access control (IAM)**.
+
+1. Select **Add** > **Add role assignment** to open the **Add role assignment** page.
+
+1. Assign the role using the following configuration:
+
+ | Setting | Value |
+ | | |
+ | Role | Key Vault Administrator |
+ | Assign access to | User, group, or service principal |
+ | Members | \<Your account information or email> |
++
+## Upload certificate to Key vault as a secret via Azure CLI
+
+> [!IMPORTANT]
+> You must have "**Key Vault Administrator**" permissions access to your Key vault for this command to work properly
+> You must upload the certificate as a secret. You must use Azure CLI to upload certificates as secrets to your key vault.
+> Your Azure Stream Analytics job will fail when the certificate used for authentication expires. To resolve this, you must update/replace the certificate in your key vault and restart your Azure Stream Analytics job.
+
+Make sure you have Azure CLI configured and installed locally with PowerShell.
+You can visit this page to get guidance on setting up Azure CLI: [Get started with Azure CLI](https://learn.microsoft.com/cli/azure/get-started-with-azure-cli#how-to-sign-into-the-azure-cli)
+
+**Login to Azure CLI:**
+```PowerShell
+az login
+```
+
+**Connect to your subscription containing your key vault:**
+```PowerShell
+az account set --subscription <subscription name>
+```
+
+For example:
+```PowerShell
+az account set --subscription mymicrosoftsubscription
+```
+
+**The following command can upload the certificate as a secret to your key vault:**
+
+The `<your key vault>` is the name of the key vault you want to upload the certificate to. `<name of the secret>` is any name you want to give to your secret and how it shows up in the key vault. `<file path to certificate>` is the path to where the certificate your certificate is located. You can right-click and copy the path to the certificate.
+
+```PowerShell
+az keyvault secret set --vault-name <your key vault> --name <name of the secret> --file <file path to certificate>
+```
+
+For example:
+
+```PowerShell
+az keyvault secret set --vault-name mykeyvault --name confluentsecret --file C:\Users\Downloads\isrgrootx1.pem
+```
++
+## Grant the Stream Analytics job permissions to access the certificate in the key vault
+
+For your Azure Stream Analytics job to read the secret in your key vault, the job must have permission to access the key vault.
+Use the following steps to grant special permissions to your stream analytics job:
+
+1. In your key vault, select **Access control (IAM)**.
+
+1. Select **Add** > **Add role assignment** to open the **Add role assignment** page.
+
+1. Assign the role using the following configuration:
+
+ | Setting | Value |
+ | | |
+ | Role | Key vault secrets user |
+ | Managed identity | Stream Analytics job for System-assigned managed identity or User-assigned managed identity |
+ | Members | \<Name of your Stream Analytics job> or \<name of user-assigned identity> |
+
+
+
+## Configure kafka input in your stream analytics job
+
+> [!IMPORTANT]
+> To configure your Kafka cluster as an input, the timestamp type of the input topic should be **LogAppendTime**. The only timestamp type Azure Stream Analytics supports is **LogAppendTime**.
+> Azure Stream Analytics supports only numerical decimal format.
+
+1. In your stream analytics job, select **Inputs** under **Job Topology**
+
+1. Select **Add input** > **Kafka** to open the **Kafka New input** configuration blade.
+
+1. Use the following configuration:
+
+| Property name | Description |
+||-|
+| Input Alias | A friendly name used in queries to reference your input |
+| Bootstrap server addresses | A list of host/port pairs to establish the connection to your confluent cloud kafka cluster. Example: pkc-56d1g.eastus.azure.confluent.cloud:9092 |
+| Kafka topic | The name of your kafka topic in your confluent cloud kafka cluster.|
+| Security Protocol | Select **SASL_SSL** |
+| Event Serialization format | The serialization format (JSON, CSV, Avro, Parquet, Protobuf) of the incoming data stream. |
+
+> [!IMPORTANT]
+> Confluent Cloud supports authentication using API Keys, OAuth, or SAML single sign-on (SSO). Azure Stream Analytics does not support authentication using OAuth or SAML single sign-on (SSO).
+> You can connect to confluent cloud using an API Key that has topic-level access via the SASL_SSL security protocol.
+To authenticate to confluent cloud you will need to use SASL_SSL and configure your job to authenticate to confluent cloud using your API key.
+
+Use the following configuration:
+
+| Setting | Value |
+ | | |
+ | Username | confluent cloud API key |
+ | Password | confluent cloud API secret |
+ | Key vault name | name of Azure Key vault with uploaded certificate |
+ | Truststore certificates | name of the Key Vault Secret that holds the ISRG Root X1 certificate |
++++
+### Save configuration and test connection
+
+Save your configuration. Your Azure Stream Analytics job validates using the configuration provided.
+A successful connection shows in the portal if your stream analytics can connect to your kafka cluster.
+
+
+
+### Limitations
+
+* The certificate uploaded to key vault must be PEM format.
+* The minimum version of kafka must be version 0.10.
+* Azure Stream Analytics doesn't support authentication to confluent cloud using OAuth or SAML single sign-on (SSO). You must use API Key via the SASL_SSL protocol.
+* You must use Azure CLI to upload the certificate as a secret to key vault. You can't upload certificates with multiline secrets to key vault using the Azure portal.
++
+> [!NOTE]
+> For direct help with using the Azure Stream Analytics Kafka input, please reach out to [askasa@microsoft.com](mailto:askasa@microsoft.com).
+>
++
+## Next steps
+> [!div class="nextstepaction"]
+> [Quickstart: Create a Stream Analytics job by using the Azure portal](stream-analytics-quick-create-portal.md)
+
+<!--Link references-->
+[stream.analytics.developer.guide]: ../stream-analytics-developer-guide.md
+[stream.analytics.scale.jobs]: stream-analytics-scale-jobs.md
+[stream.analytics.introduction]: stream-analytics-introduction.md
+[stream.analytics.get.started]: stream-analytics-real-time-fraud-detection.md
+[stream.analytics.query.language.reference]: /stream-analytics-query/stream-analytics-query-language-reference
stream-analytics Confluent Kafka Output https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/stream-analytics/confluent-kafka-output.md
+
+ Title: Stream data from Azure Stream Analytics into confluent cloud kafka
+description: Learn about how to set up an Azure Stream Analytics job as a producer to confluent cloud kafka
++++ Last updated : 11/03/2023++
+# Stream data from Azure Stream Analytics into confluent cloud
+
+This article describes how to connect your Azure Stream Analytics job directly to confluent cloud kafka as an output.
++
+## Prerequisites
+
+- You have a confluent cloud kafka cluster.
+- You have an API Key file for your kafka cluster, which contains the API key to use as a username, API Secret to use as a password, and the Bootstrap server address.
+- You have an Azure Stream Analytics job. You can create an Azure Stream Analytics job by following the documentation: [Quickstart: Create a Stream Analytics job by using the Azure portal](stream-analytics-quick-create-portal.md)
+- Your confluent cloud kafka cluster must be publicly accessible and not behind a firewall or secured in a virtual network.
+- You should have an existing key vault. You can create a key vault resource by following the documentation [Quickstart: Create a key vault using the Azure portal](../key-vault/general/quick-create-portal.md)
++
+## Configure Azure Stream Analytics to use managed identity
+
+Azure Stream Analytics requires you to configure managed identity to access key vault.
+You can configure your ASA job to use managed identity by navigating to the **Managed Identity** tab on the left side under **Configure**.
++
+1. Click on the **managed identity tab** under **configure**.
+2. Select on **Switch Identity** and select the identity to use with the job: system-assigned identity or user-assigned identity.
+3. For user-assigned identity, select the subscription where your user-assigned identity is located and select the name of your identity.
+4. Review and **save**.
++
+## Download certificate from LetsEncrypt
+
+The stream analytics kafka output is a librdkafka-based client. For the output to connect to confluent cloud, you need TLS certificates that confluent cloud uses for server authentication.
+Confluent cloud uses TLS certificates from LetΓÇÖs Encrypt, an open certificate authority (CA).
+
+Download the ISRG Root X1 certificate in **PEM** format on the site of [LetsEncrypt](https://letsencrypt.org/certificates/).
+++
+## Configure Key vault with permissions
+
+Azure Stream Analytics integrates seamlessly with Azure Key vault to access stored secrets needed for authentication and encryption when using mTLS or SASL_SSL security protocols. Your Azure Stream Analytics job connects to your Azure Key vault using managed identity to ensure a secure connection and avoid the exfiltration of secrets. To use the certificate you downloaded, you must upload it to key vault first.
+
+To upload certificates, you must have "**Key Vault Administrator**" access to your Key vault. Follow the following to grant admin access:
+
+> [!NOTE]
+> You must have "**Owner**" permissions to grant other key vault permissions.
+
+1. In your keyvault, select **Access control (IAM)**.
+
+1. Select **Add** > **Add role assignment** to open the **Add role assignment** page.
+
+1. Assign the role using the following configuration:
+
+ | Setting | Value |
+ | | |
+ | Role | Key Vault Administrator |
+ | Assign access to | User, group, or service principal |
+ | Members | \<Your account information or email> |
++
+## Upload certificate to Key vault as a secret via Azure CLI
+
+> [!IMPORTANT]
+> You must have "**Key Vault Administrator**" permissions access to your Key vault for this command to work properly
+> You must upload the certificate as a secret. You must use Azure CLI to upload certificates as secrets to your key vault.
+> Your Azure Stream Analytics job will fail when the certificate used for authentication expires. To resolve this, you must update/replace the certificate in your key vault and restart your Azure Stream Analytics job.
+
+Make sure you have Azure CLI configured and installed locally with PowerShell.
+You can visit this page to get guidance on setting up Azure CLI: [Get started with Azure CLI](https://learn.microsoft.com/cli/azure/get-started-with-azure-cli#how-to-sign-into-the-azure-cli)
+
+**Login to Azure CLI:**
+```PowerShell
+az login
+```
+
+**Connect to your subscription containing your key vault:**
+```PowerShell
+az account set --subscription <subscription name>
+```
+
+For example:
+```PowerShell
+az account set --subscription mymicrosoftsubscription
+```
+
+**The following command can upload the certificate as a secret to your key vault:**
+
+The `<your key vault>` is the name of the key vault you want to upload the certificate to. `<name of the secret>` is any name you want to give to your secret and how it shows up in the key vault. `<file path to certificate>` is the path to the location of the downloaded certificate. You can right-click on the certificate and copy the path to the certificate.
+
+```PowerShell
+az keyvault secret set --vault-name <your key vault> --name <name of the secret> --file <file path to certificate>
+```
+
+For example:
+
+```PowerShell
+az keyvault secret set --vault-name mykeyvault --name confluentsecret --file C:\Users\Downloads\isrgrootx1.pem
+```
+
+## Grant the Stream Analytics job permissions to access the certificate in the key vault
+
+For your Azure Stream Analytics job to read the secret in your key vault, the job must have permission to access the key vault.
+Use the following steps to grant special permissions to your stream analytics job:
+
+1. In your key vault, select **Access control (IAM)**.
+
+1. Select **Add** > **Add role assignment** to open the **Add role assignment** page.
+
+1. Assign the role using the following configuration:
+
+ | Setting | Value |
+ | | |
+ | Role | Key vault secrets user |
+ | Managed identity | Stream Analytics job for System-assigned managed identity or User-assigned managed identity |
+ | Members | \<Name of your Stream Analytics job> or \<name of user-assigned identity> |
+
+
+## Configure kafka output in your stream analytics job
+
+1. In your stream analytics job, select **Outputs** under **Job Topology**
+
+1. Select **Add output** > **Kafka** to open the **Kafka New output** configuration blade.
+
+1. Use the following configuration:
+
+| Property name | Description |
+||-|
+| Output Alias | A friendly name used in queries to reference your input |
+| Bootstrap server addresses | A list of host/port pairs to establish the connection to your confluent cloud kafka cluster. Example: pkc-56d1g.eastus.azure.confluent.cloud:9092 |
+| Kafka topic | The name of your kafka topic in your confluent cloud kafka cluster.|
+| Security Protocol | Select **SASL_SSL** |
+| Event Serialization format | The serialization format (JSON, CSV, Avro, Parquet, Protobuf) of the incoming data stream. |
+| Partition key | Azure Stream Analytics assigns partitions using round partitioning. Keep blank if a key doesn't partition your input |
+| Kafka event compression type | The compression type used for outgoing data streams, such as Gzip, Snappy, Lz4, Zstd, or None. |
+
+> [!IMPORTANT]
+> Confluent Cloud supports authentication using API Keys, OAuth, or SAML single sign-on (SSO). Azure Stream Analytics does not support authentication using OAuth or SAML single sign-on (SSO).
+> You can connect to confluent cloud using an API Key that has topic-level access via the SASL_SSL security protocol.
+To authenticate to confluent cloud you will need to use SASL_SSL and configure your job to authenticate to confluent cloud using your API key .
+
+Use the following configuration:
+
+| Setting | Value |
+ | | |
+ | Username | confluent cloud API Key |
+ | Password | confluent cloud API secret |
+ | Key vault name | Name of Azure Key vault with Uploaded certificate |
+ | Truststore certificates | name of the key vault secret that holds the ISRG Root X1 certificate |
++++
+### Save configuration and test connection
+
+Save your configuration. Your Azure Stream Analytics job validates using the configuration provided.
+A successful test connection shows up in the portal if your stream analytics job can connect to your kafka cluster.
+
+
+
+### Limitations
+
+* The certificate you upload to key vault must be in PEM format.
+* The minimum version of kafka must be kafka version 0.10.
+* Azure Stream Analytics doesn't support authentication to confluent cloud using OAuth or SAML single sign-on (SSO). You must use API Key via the SASL_SSL protocol.
+* You must use Azure CLI to upload certificate as a secret to key vault. You can't upload certificates with multiline secrets to key vault using the Azure portal.
+
+> [!NOTE]
+> For direct help with using the Azure Stream Analytics Kafka output, please reach out to [askasa@microsoft.com](mailto:askasa@microsoft.com).
+>
++
+## Next steps
+> [!div class="nextstepaction"]
+> [Quickstart: Create a Stream Analytics job by using the Azure portal](stream-analytics-quick-create-portal.md)
+
+<!--Link references-->
+[stream.analytics.developer.guide]: ../stream-analytics-developer-guide.md
+[stream.analytics.scale.jobs]: stream-analytics-scale-jobs.md
+[stream.analytics.introduction]: stream-analytics-introduction.md
+[stream.analytics.get.started]: stream-analytics-real-time-fraud-detection.md
+[stream.analytics.query.language.reference]: /stream-analytics-query/stream-analytics-query-language-reference
stream-analytics Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/stream-analytics/policy-reference.md
Title: Built-in policy definitions for Azure Stream Analytics description: Lists Azure Policy built-in policy definitions for Azure Stream Analytics. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
synapse-analytics Proof Of Concept Playbook Data Explorer Pool https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/guidance/proof-of-concept-playbook-data-explorer-pool.md
Here are the typical subject areas that are evaluated with Data Explorer:
> Use the following frequently asked questions to help you plan your POC. > > - **How do I choose the caching period when creating my Data Explorer pool?**
-> To provide best query performance, ingested data is cached on the local SSD disk. This level of performance is not always required and less frequently queried data can often be stored on cheaper blob storage. Queries on data in blob storage run slower, but this acceptable in many scenarios. Knowing this can help you identify the number of compute nodes you need to hold your data in local SSD and continue to meet your query performance requirements. For example, if you you want to query *x* days worth of data (based on ingestion age) more frequently and retain data for *y* days and query it less frequently, in your cache retention policy, specify *x* as the value for hot cache retention and *y* as the value for the total retention. For more information, see [Cache policy](/azure/data-explorer/kusto/management/cachepolicy?context=/azure/synapse-analytics/context/context).
+> To provide best query performance, ingested data is cached on the local SSD disk. This level of performance is not always required and less frequently queried data can often be stored on cheaper blob storage. Queries on data in blob storage run slower, but this acceptable in many scenarios. Knowing this can help you identify the number of compute nodes you need to hold your data in local SSD and continue to meet your query performance requirements. For example, if you want to query *x* days worth of data (based on ingestion age) more frequently and retain data for *y* days and query it less frequently, in your cache retention policy, specify *x* as the value for hot cache retention and *y* as the value for the total retention. For more information, see [Cache policy](/azure/data-explorer/kusto/management/cachepolicy?context=/azure/synapse-analytics/context/context).
> - **How do I choose the retention period when creating my Data Explorer pool?** > The retention period is a combination of hot and cold cache data that is available for querying. You choose data retention based on how long you need to retain the data based on compliance or other regulatory requirements. You can use the hot window capability, to warm data stored in the cold cache, for faster queries for any auditing purpose. For more information, see [Query cold data with hot windows](/azure/data-explorer/hot-windows?context=/azure/synapse-analytics/context/context).
synapse-analytics Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/policy-reference.md
Title: Built-in policy definitions description: Lists Azure Policy built-in policy definitions for Azure Synapse Analytics. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
synapse-analytics Quickstart Serverless Sql Pool https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/quickstart-serverless-sql-pool.md
CREATE DATABASE mydbname
### Create data source
-To run queries using serverless SQL pool, create data source that serverless SQL pool can use use to access files in storage.
+To run queries using serverless SQL pool, create data source that serverless SQL pool can use to access files in storage.
Execute the following code snippet to create data source used in samples in this section: ```sql
synapse-analytics Apache Spark To Power Bi https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/spark/apache-spark-to-power-bi.md
To connect our serverless SQL pool to our Power BI workspace:
:::image type="content" source="../spark/media/apache-spark-power-bi/power-bi-desktop.png" alt-text="Power BI Desktop." border="true":::
-2. On the Power BI desktop Home tab, select **Publish** and **Save** changes. Enter a file name and save this report to the the *NycTaxiTutorial Workspace*.
+2. On the Power BI desktop Home tab, select **Publish** and **Save** changes. Enter a file name and save this report to the *NycTaxiTutorial Workspace*.
3. In addition, you can also create Power BI visualizations from within your Azure Synapse Analytics workspace. To do this, navigate to the **Develop** tab in your Azure Synapse workspace and open the Power BI tab. From here, you can select your report and continue building additional visualizations.
synapse-analytics Sql Data Warehouse How To Convert Resource Classes Workload Groups https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-how-to-convert-resource-classes-workload-groups.md
Workload groups provide a mechanism to isolate and contain system resources. Ad
## Understanding the existing resource class configuration
-Workload groups require a parameter called `REQUEST_MIN_RESOURCE_GRANT_PERCENT` that specifies the percentage of overall system resources allocated per request. Resource allocation is done for [resource classes](resource-classes-for-workload-management.md#what-are-resource-classes) by allocating concurrency slots. To determine the value to specify for `REQUEST_MIN_RESOURCE_GRANT_PERCENT`, use the [sys.dm_workload_management_workload_groups_stats](/sql/relational-databases/system-dynamic-management-views/sys-dm-workload-management-workload-group-stats-transact-sql?view=azure-sqldw-latest&preserve-view=true) DMV. For example, the below query query returns a value that can be used for the `REQUEST_MIN_RESOURCE_GRANT_PERCENT` parameter to create a workload group similar to staticrc40.
+Workload groups require a parameter called `REQUEST_MIN_RESOURCE_GRANT_PERCENT` that specifies the percentage of overall system resources allocated per request. Resource allocation is done for [resource classes](resource-classes-for-workload-management.md#what-are-resource-classes) by allocating concurrency slots. To determine the value to specify for `REQUEST_MIN_RESOURCE_GRANT_PERCENT`, use the [sys.dm_workload_management_workload_groups_stats](/sql/relational-databases/system-dynamic-management-views/sys-dm-workload-management-workload-group-stats-transact-sql?view=azure-sqldw-latest&preserve-view=true) DMV. For example, the below query returns a value that can be used for the `REQUEST_MIN_RESOURCE_GRANT_PERCENT` parameter to create a workload group similar to staticrc40.
```sql SELECT Request_min_resource_grant_percent = Effective_request_min_resource_grant_percent
synapse-analytics Sql Data Warehouse Manage Compute Overview https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-manage-compute-overview.md
Title: Manage compute resource for for dedicated SQL pool (formerly SQL DW)
+ Title: Manage compute resource for dedicated SQL pool (formerly SQL DW)
description: Learn about performance scale out capabilities for dedicated SQL pool (formerly SQL DW) in Azure Synapse Analytics. Scale out by adjusting DWUs, or lower costs by pausing the dedicated SQL pool (formerly SQL DW).
synapse-analytics Sql Data Warehouse Manage Monitor https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-manage-monitor.md
OPTION (LABEL = 'My Query')
; -- Find a query with the Label 'My Query' Use brackets when querying the label column, as it it a key word
+-- Use brackets when querying the label column, as it is a key word
SELECT * FROM sys.dm_pdw_exec_requests WHERE [label] = 'My Query';
synapse-analytics Sql Data Warehouse Overview Manage Security https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-overview-manage-security.md
Firewall rules are used by both the [logical SQL server](/azure/azure-sql/databa
As a best practice, you should restrict the IP address ranges allowed through your server-level firewall as much as possible. To access your dedicated SQL pool (formerly SQL DW) from your local computer, ensure the firewall on your network and local computer allows outgoing communication on TCP port 1433.
-Dedicated SQL pool (formerly SQL DW) uses server-level IP firewall rules. It doesn't support database-level IP firewall rules. For more information, see see [Azure SQL Database firewall rules](/azure/azure-sql/database/firewall-configure?toc=/azure/synapse-analytics/sql-data-warehouse/toc.json&bc=/azure/synapse-analytics/sql-data-warehouse/breadcrumb/toc.json)
+Dedicated SQL pool (formerly SQL DW) uses server-level IP firewall rules. It doesn't support database-level IP firewall rules. For more information, see [Azure SQL Database firewall rules](/azure/azure-sql/database/firewall-configure?toc=/azure/synapse-analytics/sql-data-warehouse/toc.json&bc=/azure/synapse-analytics/sql-data-warehouse/breadcrumb/toc.json)
Connections to your dedicated SQL pool (formerly SQL DW) are encrypted by default. Modifying connection settings to disable encryption are ignored.
time-series-insights Concepts Access Policies https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/time-series-insights/concepts-access-policies.md
Follow these steps to grant guest access to an Azure Time Series Insights enviro
Time Series Insights Data Access Policies are backed by Microsoft Entra ID, which are tied to an Azure Tenant where the Subscription lives in.
-The Microsoft Entra Objects that you grant Data Access Policies to and the the Time Series Insights Environment itself should live under the same Tenant. If not, these objects will not have access to the Environment.
+The Microsoft Entra Objects that you grant Data Access Policies to and the Time Series Insights Environment itself should live under the same Tenant. If not, these objects will not have access to the Environment.
If you plan to move the Subscription the Environment lives in to a different Tenant, you must ensure that the Data Access Policies are updated to reflect the Microsoft Entra Objects under the new Tenant.
time-series-insights How To Private Links https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/time-series-insights/how-to-private-links.md
In this section, you'll enable Private Link with a private endpoint for an Azure
1. Select **+ Private endpoint** to open the **Create a private endpoint** setup.
- :::image type="content" source="media/private-links/add-private-endpoint.png" alt-text="Screenshot of the Azure portal showing the the Networking (preview) page for an Azure Time Series Insights Gen2 environment. The Private endpoint connections tab is highlighted, and the + Private endpoint button is also highlighted." lightbox="media/private-links/add-private-endpoint.png":::
+ :::image type="content" source="media/private-links/add-private-endpoint.png" alt-text="Screenshot of the Azure portal showing the Networking (preview) page for an Azure Time Series Insights Gen2 environment. The Private endpoint connections tab is highlighted, and the + Private endpoint button is also highlighted." lightbox="media/private-links/add-private-endpoint.png":::
1. In the **Basics** tab, enter or select the **Subscription** and **Resource group** of your project, and a **Name** and **Region** for your endpoint. The region needs to be the same as the region for the VNet you're using.
virtual-desktop App Attach https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-desktop/app-attach.md
To stage packages at boot with PowerShell version 5.1 or earlier, run this comma
Now that you've prepared your machine to stage MSIX app attach packages, you'll need to mount your disk image. This process will vary depending on whether you're using the *VHD(X)* or *CimFs* format for your disk image. >[!NOTE]
->Make sure to record the the *Device Id* for each application in the command output. You'll need this information to follow directions later in this article.
+>Make sure to record the *Device Id* for each application in the command output. You'll need this information to follow directions later in this article.
### [CimFS](#tab/cimfs)
virtual-desktop Azure Stack Hci https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-desktop/azure-stack-hci.md
This article describes how to set up Azure Virtual Desktop for Azure Stack HCI (
With Azure Virtual Desktop for Azure Stack HCI (preview), you can use Azure Virtual Desktop session hosts in your on-premises Azure Stack HCI infrastructure that are part of a [pooled host pool](terminology.md#host-pools) in Azure. To learn more, see [Azure Virtual Desktop for Azure Stack HCI (preview)](azure-stack-hci-overview.md).
-You deploy an Azure Virtual Desktop environment with session hosts on Azure Stack HCI by using the Arc VM Management Resource Bridge to create virtual machines from an existing image, which are then then added to a new host pool.
+You deploy an Azure Virtual Desktop environment with session hosts on Azure Stack HCI by using the Arc VM Management Resource Bridge to create virtual machines from an existing image, which are then added to a new host pool.
## Prerequisites
virtual-desktop Fslogix Profile Container Configure Azure Files Active Directory https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-desktop/fslogix-profile-container-configure-azure-files-active-directory.md
To use Active Directory accounts for the share permissions of your file share, y
``` > [!IMPORTANT]
- > This module requires requires the [PowerShell Gallery](/powershell/gallery/overview) and [Azure PowerShell](/powershell/azure/what-is-azure-powershell). You may be prompted to install these if they are not already installed or they need updating. If you are prompted for these, install them, then close all instances of PowerShell. Re-open an elevated PowerShell prompt and import the `AzFilesHybrid` module again before continuing.
+ > This module requires the [PowerShell Gallery](/powershell/gallery/overview) and [Azure PowerShell](/powershell/azure/what-is-azure-powershell). You may be prompted to install these if they are not already installed or they need updating. If you are prompted for these, install them, then close all instances of PowerShell. Re-open an elevated PowerShell prompt and import the `AzFilesHybrid` module again before continuing.
1. Sign in to Azure by running the command below. You will need to use an account that has one of the following role-based access control (RBAC) roles:
virtual-desktop Private Link Setup https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-desktop/private-link-setup.md
In order to use Private Link with Azure Virtual Desktop, you need the following
## Enable the feature
-To use Private Link with Azure Virtual Desktop, you need to re-register the *Microsoft.DesktopVirtualization* resource provider on each each subscription you want to use Private Link with Azure Virtual Desktop.
+To use Private Link with Azure Virtual Desktop, you need to re-register the *Microsoft.DesktopVirtualization* resource provider on each subscription you want to use Private Link with Azure Virtual Desktop.
> [!IMPORTANT] > For Azure US Gov and Azure operated by 21Vianet, you also need to register the feature for each subscription.
To check the connection state of each private endpoint, select the relevant tab
To test that your users can connect to their remote resources:
-1. Use the Remote Desktop client and make sure you can [subscribe to and and refresh workspaces](users/remote-desktop-clients-overview.md).
+1. Use the Remote Desktop client and make sure you can [subscribe to and refresh workspaces](users/remote-desktop-clients-overview.md).
1. Finally, make sure your users can connect to a remote session.
virtual-machine-scale-sets Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machine-scale-sets/policy-reference.md
Previously updated : 10/23/2023 Last updated : 11/03/2023 # Azure Policy built-in definitions for Azure Virtual Machine Scale Sets
virtual-machines Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machines/policy-reference.md
Title: Built-in policy definitions for Azure Virtual Machines description: Lists Azure Policy built-in policy definitions for Azure Virtual Machines. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
virtual-machines Prepay Dedicated Hosts Reserved Instances https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machines/prepay-dedicated-hosts-reserved-instances.md
- # Save costs with Azure Dedicated Host reservations **Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets
include software licensing costs. See the [Overview of Azure Dedicated Hosts for
## Determine the right dedicated host SKU before you buy
-Before you buy a reservation, you should determine which dedicated host you need. A SKU is defined for a dedicated host representing the VM series and
-type. 
+Before you buy a reservation, you should determine which dedicated host you need. A SKU is defined for a dedicated host representing the VM series and type. 
Start by going over the supported sizes for [Windows virtual machine](./sizes.md) or [Linux](./sizes.md) to identify the VM series. Next, check whether it is supported on Azure Dedicated Hosts. [Azure Dedicated Hosts pricing](https://aka.ms/ADHPricing) page has the complete list of dedicated hosts SKUs, their CPU information, and various pricing options (including reserved instances).
-You may find several SKUs supporting your selected VM series (with different Types). Identify the best SKU by comparing the capacity of the host (number of vCPUs). Note that you will be able to apply your reservation to multiple dedicated hosts SKUs supporting the same VM series (for example DSv3_Type1 and DSv3_Type2) but not across different VM series (like DSv3 and ESv3).
--
+You may find several SKUs supporting your selected VM series (with different Types). Identify the best SKU by comparing the capacity of the host (number of vCPUs). Note that you will be able to apply your reservation to multiple dedicated hosts SKUs supporting the same VM series (for example DSv3_Type1 and DSv3_Type2) but not across different VM series (like DSv3 and ESv3). Over the lifetime of the reservation, you may need to switch between different dedicated host SKUs that support the same VM size, depending on the hardware usage fluctuations and lifecycle.
## Purchase restriction considerations
For more information about how reservation discounts appear in usage data, see 
You can make the following types of changes to a reservation after purchase: - Update reservation scope--- Instance size flexibility (if applicable)- - Ownership You can also split a reservation into smaller chunks and merge already split reservations. None of the changes cause a new commercial transaction or change the end date of the reservation.
To learn more about Azure Reservations, see the following articles:
- [Windows software costs not included with reservations](../cost-management-billing/reservations/reserved-instance-windows-software-costs.md) - [Azure Reservations in Partner Center Cloud Solution Provider (CSP) program](/partner-center/azure-reservations)++
virtual-machines Vm Generalized Image Version https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machines/vm-generalized-image-version.md
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{rg}/
### [Portal](#tab/portal4) > [!NOTE]
-> **Known issue**: In the Azure portal, if you you select a region, select an image, then change the region, you'll get an error message: "You can only create VM in the replication regions of this image" even when the image is replicated to that region. To get rid of the error, select a different region, then switch back to the region you want. If the image is available, it should clear the error message.
+> **Known issue**: In the Azure portal, if you select a region, select an image, then change the region, you'll get an error message: "You can only create VM in the replication regions of this image" even when the image is replicated to that region. To get rid of the error, select a different region, then switch back to the region you want. If the image is available, it should clear the error message.
> > You can also use the Azure CLI to check what images are shared with you. For example, you can use `az sig list-shared --location westus` to see what images are shared with you in the West US region.
virtual-machines Image Builder Virtual Desktop https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machines/windows/image-builder-virtual-desktop.md
Get-AzResourceProvider -ProviderNamespace Microsoft.Storage
Get-AzResourceProvider -ProviderNamespace Microsoft.Compute Get-AzResourceProvider -ProviderNamespace Microsoft.KeyVault
-# If they don't show as 'Registered', run the the following commented-out code
+# If they don't show as 'Registered', run the following commented-out code
## Register-AzResourceProvider -ProviderNamespace Microsoft.VirtualMachineImages ## Register-AzResourceProvider -ProviderNamespace Microsoft.Storage
virtual-machines Proximity Placement Groups Portal https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-machines/windows/proximity-placement-groups-portal.md
A proximity placement group is a logical grouping used to make sure that Azure c
## Add VMs in an availability set to a proximity placement group
-If the VM is part of the Availability set, you need to add the availability set into the the placement group, before adding the VMs.
+If the VM is part of the Availability set, you need to add the availability set into the placement group, before adding the VMs.
1. In the [portal](https://portal.azure.com) search for *Availability sets* and select your availability set from the results. 1. Stop\deallocate each VM in the availability set by selecting the VM, then selecting **Stop** on the page for the VM, and then select **OK** to stop the VM.
virtual-network-manager How To Configure Event Logs https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-network-manager/how-to-configure-event-logs.md
In this task, you access the event logs for your Azure Virtual Network Manager i
1. When completed reviewing the logs, close the window and select **ok** to discard changes. > [!NOTE]
- > When you close the **Query editor** window, you will be be returned to the **Azure Home** page. If you need to return to the **Logs** page, browse to your virtual network manager instance, and select **Logs** under the **Monitoring** in the left pane.
+ > When you close the **Query editor** window, you will be returned to the **Azure Home** page. If you need to return to the **Logs** page, browse to your virtual network manager instance, and select **Logs** under the **Monitoring** in the left pane.
1. If you choose **Load to editor**, the **Query editor** window displays the query. Choose **Run** to display the event logs and you can expand each log to view the details.
virtual-network Policy Reference https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-network/policy-reference.md
Title: Built-in policy definitions for Azure Virtual Network description: Lists Azure Policy built-in policy definitions for Azure Virtual Network. These built-in policy definitions provide common approaches to managing your Azure resources. Previously updated : 10/23/2023 Last updated : 11/03/2023
virtual-network Troubleshoot Outbound Smtp Connectivity https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-network/troubleshoot-outbound-smtp-connectivity.md
Outbound email messages that are sent directly to external domains (such as outlook.com and gmail.com) from a virtual machine (VM) are made available only to certain subscription types in Microsoft Azure. > [!IMPORTANT]
-> For the following examples, the process applies mainly to Virtual Machines & VM Scale Sets resources (`Microsoft.Compute/virtualMachines` & `Microsoft.Compute/virtualMachineScaleSets`). It's possible to use port 25 for outbound communication on [Azure App Service](https://azure.microsoft.com/services/app-service) and [Azure Functions](https://azure.microsoft.com/services/functions) through the [virtual network integration feature](/azure/app-service/overview-vnet-integration#application-routing) or when using [App Service Environment v3](../app-service/environment/networking.md#network-routing). However, the the following subscription limitations described still apply. Sending email on Port 25 is unsupported for all other Azure Platform-as-a-Service (PaaS) resources.
+> For the following examples, the process applies mainly to Virtual Machines & VM Scale Sets resources (`Microsoft.Compute/virtualMachines` & `Microsoft.Compute/virtualMachineScaleSets`). It's possible to use port 25 for outbound communication on [Azure App Service](https://azure.microsoft.com/services/app-service) and [Azure Functions](https://azure.microsoft.com/services/functions) through the [virtual network integration feature](/azure/app-service/overview-vnet-integration#application-routing) or when using [App Service Environment v3](../app-service/environment/networking.md#network-routing). However, the following subscription limitations described still apply. Sending email on Port 25 is unsupported for all other Azure Platform-as-a-Service (PaaS) resources.
## Recommended method of sending email
virtual-wan Customer Controlled Gateway Maintenance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-wan/customer-controlled-gateway-maintenance.md
+
+ Title: 'Configure customer-controlled maintenance for your Virtual WAN VPN gateway'
+
+description: Learn how to configure customer-controlled maintenance for your Virtual WAN gateways using the Azure portal, or PowerShell.
+++ Last updated : 11/01/2023++
+# Configure customer-controlled gateway maintenance for Virtual WAN (Preview)
+
+This article helps you configure customer-controlled maintenance windows for Virtual WAN VPN gateways and Virtual WAN ExpressRoute gateways. Learn how to schedule customer-controlled maintenance for your gateways using the Azure portal or PowerShell.
++
+For more information on limitations and frequently asked questions related to customer-controlled maintenance, see the [Virtual WAN FAQ](virtual-wan-faq.md).
++
+## Azure portal steps
++
+ Example:
+
+ :::image type="content" source="./media/customer-controlled-gateway-maintenance/select-resources.png" alt-text="Screenshot showing the select resources page." lightbox="./media/customer-controlled-gateway-maintenance/select-resources.png":::
++
+## Azure PowerShell steps
+
+6. Create the maintenance configuration assignment using the [New-AzConfigurationAssignment](/powershell/module/az.maintenance/new-azconfigurationassignment) cmdlet. The maintenance policy is applied to the resource within 24 hours.
+
+ ```azurepowershell-interactive
+ New-AzConfigurationAssignment -ResourceGroupName <rgName> -ProviderName "Microsoft.Network" -ResourceType "<your resource's resource type per ARM. For example, expressRouteGateways or vpnSites>" -ResourceName "<your resource's name>" -ConfigurationAssignmentName "<assignment name>" -ResourceId $serviceResource.Id -MaintenanceConfigurationId $config.Id -Location "<arm location of resource>"
+ ```
+
+### To remove a configuration assignment
++
+## Next steps
+
+For more information, see the [Virtual WAN FAQ](virtual-wan-faq.md).
virtual-wan Virtual Wan Faq https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/virtual-wan/virtual-wan-faq.md
Scale Unit | Gateway Instances | Supported Concurrent Connections | Aggregate Th
|180|18|90000| 90 Gbps| |200|20|100000| 100 Gbps|
-For example, let's say the user chooses 1 scale unit. Each scale unit would imply an active-active gateway deployed and each of the instances (in this case 2) would support up to 500 connections. Since you can get 500 connections * 2 per gateway, it doesn't mean that you plan for 1000 instead of the 500 for this scale unit. Instances may need to be serviced during which connectivity for the extra 500 may be interrupted if you surpass the recommended connection count.
+For example, let's say the user chooses 1 scale unit. Each scale unit would imply an active-active gateway deployed and each of the instances (in this case 2) would support up to 500 connections. Since you can get 500 connections * 2 per gateway, it doesn't mean that you plan for 1000 instead of the 500 for this scale unit. Instances might need to be serviced during which connectivity for the extra 500 might be interrupted if you surpass the recommended connection count.
-For gateways with scale units greater than 20, additional highly-available pairs of gateway instances are deployed to provide additional capacity for connecting users. Each pair of instances supports up to 10,000 additional users. For example, if you deploy a Gateway with 100 scale units, 5 gateway pairs (10 total instances) are deployed, and up to 50,000 (10,000 users x 5 gateway pairs) concurrent users can connect.
+For gateways with scale units greater than 20, additional highly available pairs of gateway instances are deployed to provide additional capacity for connecting users. Each pair of instances supports up to 10,000 additional users. For example, if you deploy a Gateway with 100 scale units, 5 gateway pairs (10 total instances) are deployed, and up to 50,000 (10,000 users x 5 gateway pairs) concurrent users can connect.
Also, be sure to plan for downtime in case you decide to scale up or down on the scale unit, or change the point-to-site configuration on the VPN gateway.
A virtual network gateway VPN is limited to 30 tunnels. For connections, you sho
### <a name="packets"></a>What is the recommended algorithm and Packets per second per site-to-site instance in Virtual WAN hub? How many tunnels is support per instance? What is the max throughput supported in a single tunnel?
-Virtual WAN supports 2 active site-to-site VPN gateway instances in a virtual hub. This means there are 2 active-active set of VPN gateway instances in a virtual hub. During maintenance operations, each instance is upgraded one by one due to which a user may experience brief decrease in aggregate throughput of a VPN gateway.
+Virtual WAN supports 2 active site-to-site VPN gateway instances in a virtual hub. This means there are 2 active-active set of VPN gateway instances in a virtual hub. During maintenance operations, each instance is upgraded one by one due to which a user might experience brief decrease in aggregate throughput of a VPN gateway.
While Virtual WAN VPN supports many algorithms, our recommendation is GCMAES256 for both IPSEC Encryption and Integrity for optimal performance. AES256 and SHA256 are considered less performant and therefore performance degradation such as latency and packet drops can be expected for similar algorithm types.
All virtual WAN APIs are OpenAPI. You can go over the documentation [Virtual WAN
### How is Virtual WAN supporting SD-WAN devices?
-Virtual WAN partners automate IPsec connectivity to Azure VPN end points. If the Virtual WAN partner is an SD-WAN provider, then it's implied that the SD-WAN controller manages automation and IPsec connectivity to Azure VPN end points. If the SD-WAN device requires its own end point instead of Azure VPN for any proprietary SD-WAN functionality, you can deploy the SD-WAN end point in an Azure VNet and coexist with Azure Virtual WAN.
+Virtual WAN partners automate IPsec connectivity to Azure VPN end points. If the Virtual WAN partner is an SD-WAN provider, then it's implied that the SD-WAN controller manages automation and IPsec connectivity to Azure VPN end points. If the SD-WAN device requires its own end point instead of Azure VPN for any proprietary SD-WAN functionality, you can deploy the SD-WAN end point in an Azure virtual network and coexist with Azure Virtual WAN.
-Virtual WAN supports [BGP Peering](create-bgp-peering-hub-portal.md) and also has the ability to [deploy NVA's into a virtual WAN hub](how-to-nva-hub.md).
+Virtual WAN supports [BGP Peering](create-bgp-peering-hub-portal.md) and also has the ability to [deploy NVAs into a virtual WAN hub](how-to-nva-hub.md).
### How many VPN devices can connect to a single hub?
A connection from a branch or VPN device into Azure Virtual WAN is a VPN connect
### What happens if the on-premises VPN device only has 1 tunnel to an Azure Virtual WAN VPN gateway?
-An Azure Virtual WAN connection is composed of 2 tunnels. A Virtual WAN VPN gateway is deployed in a virtual hub in active-active mode, which implies that there are separate tunnels from on-premises devices terminating on separate instances. This is the recommendation for all users. However, if the user chooses to only have 1 tunnel to one of the Virtual WAN VPN gateway instances, if for any reason (maintenance, patches etc.) the gateway instance is taken offline, the tunnel will be moved to the secondary active instance and the user may experience a reconnect. BGP sessions won't move across instances.
+An Azure Virtual WAN connection is composed of 2 tunnels. A Virtual WAN VPN gateway is deployed in a virtual hub in active-active mode, which implies that there are separate tunnels from on-premises devices terminating on separate instances. This is the recommendation for all users. However, if the user chooses to only have 1 tunnel to one of the Virtual WAN VPN gateway instances, if for any reason (maintenance, patches etc.) the gateway instance is taken offline, the tunnel will be moved to the secondary active instance and the user might experience a reconnect. BGP sessions won't move across instances.
### What happens during a gateway reset in a Virtual WAN VPN gateway?
Yes. Traffic flow, when commencing, is from the on-premises device to the closes
Yes, Virtual WAN has new Resource Manager resources. For more information, see the [Overview](virtual-wan-about.md).
-### Can I deploy and use my favorite network virtual appliance (in an NVA VNet) with Azure Virtual WAN?
+### Can I deploy and use my favorite network virtual appliance (in an NVA virtual network) with Azure Virtual WAN?
-Yes, you can connect your favorite network virtual appliance (NVA) VNet to the Azure Virtual WAN.
+Yes, you can connect your favorite network virtual appliance (NVA) virtual network to the Azure Virtual WAN.
### Can I create a Network Virtual Appliance inside the virtual hub?
-A Network Virtual Appliance (NVA) can be deployed inside a virtual hub. For steps, see [About NVA's in a Virtual WAN hub](about-nva-hub.md).
+A Network Virtual Appliance (NVA) can be deployed inside a virtual hub. For steps, see [About NVAs in a Virtual WAN hub](about-nva-hub.md).
### Can a spoke VNet have a virtual network gateway?
Yes. Branch-to-branch traffic traverses through Azure Virtual WAN.
### Does Virtual WAN require ExpressRoute from each site?
-No. Virtual WAN doesn't require ExpressRoute from each site. Your sites may be connected to a provider network using an ExpressRoute circuit. For sites that are connected using ExpressRoute to a virtual hub and IPsec VPN into the same hub, virtual hub provides transit connectivity between the VPN and ExpressRoute user.
+No. Virtual WAN doesn't require ExpressRoute from each site. Your sites might be connected to a provider network using an ExpressRoute circuit. For sites that are connected using ExpressRoute to a virtual hub and IPsec VPN into the same hub, virtual hub provides transit connectivity between the VPN and ExpressRoute user.
### Is there a network throughput or connection limit when using Azure Virtual WAN?
Yes. This option is currently available via PowerShell only. The Virtual WAN por
### What is the recommended hub address space during hub creation?
-The recommended Virtual WAN hub address space is /23. Virtual WAN hub assigns subnets to various gateways (ExpressRoute, site-to-site VPN, point-to-site VPN, Azure Firewall, Virtual hub Router). For scenarios where NVAs are deployed inside a virtual hub, a /28 is typically carved out for the NVA instances. However if the user were to provision multiple NVAs, a /27 subnet may be assigned. Therefore, keeping a future architecture in mind, while Virtual WAN hubs are deployed with a minimum size of /24, the recommended hub address space at creation time for user to input is /23.
+The recommended Virtual WAN hub address space is /23. Virtual WAN hub assigns subnets to various gateways (ExpressRoute, site-to-site VPN, point-to-site VPN, Azure Firewall, Virtual hub Router). For scenarios where NVAs are deployed inside a virtual hub, a /28 is typically carved out for the NVA instances. However if the user were to provision multiple NVAs, a /27 subnet might be assigned. Therefore, keeping a future architecture in mind, while Virtual WAN hubs are deployed with a minimum size of /24, the recommended hub address space at creation time for user to input is /23.
### Is there support for IPv6 in Virtual WAN?
No. Virtual WAN does not support ASN changes for VPN gateways.
### <a name="update-router"></a>Why am I seeing a message and button called "Update router to latest software version" in portal?
-Azure-wide Cloud Services-based infrastructure is deprecating. As a result, the Virtual WAN team has been working on upgrading virtual routers from their current Cloud Services infrastructure to Virtual Machine Scale Sets based deployments. **All newly created Virtual Hubs will automatically be deployed on the latest Virtual Machine Scale Sets based infrastructure.** If you navigate to your Virtual WAN hub resource and see this message and button, then you can upgrade your router to the latest version by clicking on the button. If you would like to take advantage of new Virtual WAN features, such as [BGP peering with the hub](create-bgp-peering-hub-portal.md), you'll have to update your virtual hub router via Azure portal. If the button isn't visible, please open a support case.
+Azure-wide Cloud Services-based infrastructure is deprecating. As a result, the Virtual WAN team has been working on upgrading virtual routers from their current Cloud Services infrastructure to Virtual Machine Scale Sets based deployments. **All newly created Virtual Hubs will automatically be deployed on the latest Virtual Machine Scale Sets based infrastructure.** If you navigate to your Virtual WAN hub resource and see this message and button, then you can upgrade your router to the latest version by clicking on the button. If you would like to take advantage of new Virtual WAN features, such as [BGP peering with the hub](create-bgp-peering-hub-portal.md), you'll have to update your virtual hub router via Azure portal. If the button isn't visible, open a support case.
YouΓÇÖll only be able to update your virtual hub router if all the resources (gateways/route tables/VNet connections) in your hub are in a succeeded state. Make sure all your spoke virtual networks are in active/enabled subscriptions and that your spoke virtual networks aren't deleted. Additionally, as this operation requires deployment of new virtual machine scale sets based virtual hub routers, youΓÇÖll face an expected downtime of 1-2 minutes for VNet-to-VNet traffic through the same hub and 5-7 minutes for all other traffic flows through the hub. Within a single Virtual WAN resource, hubs should be updated one at a time instead of updating multiple at the same time. When the Router Version says ΓÇ£LatestΓÇ¥, then the hub is done updating. There will be no routing behavior changes after this update.
There are several things to note with the virtual hub router upgrade:
* If you have already configured BGP peering between your Virtual WAN hub and an NVA in a spoke VNet, then you'll have to [delete and then recreate the BGP peer](create-bgp-peering-hub-portal.md). Since the virtual hub router's IP addresses change after the upgrade, you'll also have to reconfigure your NVA to peer with the virtual hub router's new IP addresses. These IP addresses are represented as the "virtualRouterIps" field in the Virtual Hub's Resource JSON.
-* If you have a network virtual appliance (NVA) in the virtual hub, you will have to work with your NVA partner to obtain instructions on how to upgrade your Virtual WAN hub.
+* If you have a network virtual appliance (NVA) in the virtual hub, you'll have to work with your NVA partner to obtain instructions on how to upgrade your Virtual WAN hub.
If the update fails for any reason, your hub will be auto recovered to the old version to ensure there's still a working setup. Additional things to note:
-* The user will need to have an **owner** or **contributor** role to see an accurate status of the hub router version. If a user is assigned a **reader** role to the Virtual WAN resource and subscription, then Azure portal will display to that user that the hub router needs to be upgraded to the latest version, even if the hub is already on the latest version.
+* The user will need to have an **owner** or **contributor** role to see an accurate status of the hub router version. If a user is assigned a **reader** role to the Virtual WAN resource and subscription, the Azure portal displays to that user that the hub router needs to be upgraded to the latest version, even if the hub is already on the latest version.
* If you change your spoke virtual network's subscription status from disabled to enabled and then upgrade the virtual hub, you'll need to update your virtual network connection after the virtual hub upgrade (Ex: you can configure the virtual network connection to propagate to a dummy label).
Virtual WAN is a networking-as-a-service platform that has a 99.95% SLA. However
The SLA for each component is calculated individually. For example, if ExpressRoute has a 10 minute downtime, the availability of ExpressRoute would be calculated as (Maximum Available Minutes - downtime) / Maximum Available Minutes * 100. ### Can you change the VNet address space in a spoke VNet connected to the hub?
-Yes, this can be done automatically with no update or reset required on the peering connection. You can find more information on how to change the VNet address space [here](../virtual-network/manage-virtual-network.md).
+Yes, this can be done automatically with no update or reset required on the peering connection. You can find more information on how to change the VNet address space [here](../virtual-network/manage-virtual-network.md).
+ ## Next steps
-* For more information about Virtual WAN, see [About Virtual WAN](virtual-wan-about.md).
+For more information about Virtual WAN, see [About Virtual WAN](virtual-wan-about.md).
vpn-gateway Customer Controlled Gateway Maintenance https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/vpn-gateway/customer-controlled-gateway-maintenance.md
+
+ Title: 'Configure customer-controlled maintenance for your virtual network gateway'
+
+description: Learn how to configure customer-controlled maintenance for your VPN Gateway virtual network gateways using the Azure portal, or PowerShell.
+++ Last updated : 11/01/2023++
+# Configure customer-controlled gateway maintenance for VPN Gateway (Preview)
+
+This article helps you configure customer-controlled maintenance windows for your VPN Gateway virtual network gateways. Learn how to schedule customer-controlled maintenance for your gateways using the Azure portal or PowerShell.
++
+For more information on limitations and frequently asked questions related to customer-controlled maintenance, see the [VPN Gateway FAQ](vpn-gateway-vpn-faq.md#customer-controlled).
++
+## Azure portal steps
++
+ Example:
+
+ :::image type="content" source="./media/customer-controlled-gateway-maintenance/select-resources.png" alt-text="Screenshot showing the select resources page." lightbox="./media/customer-controlled-gateway-maintenance/select-resources.png":::
++
+## Azure PowerShell steps
+
+6. Create the maintenance configuration assignment using the [New-AzConfigurationAssignment](/powershell/module/az.maintenance/new-azconfigurationassignment) cmdlet. The maintenance policy is applied to the resource within 24 hours.
+
+ ```azurepowershell-interactive
+ New-AzConfigurationAssignment -ResourceGroupName <rgName> -ProviderName "Microsoft.Network" -ResourceType "<your resource's resource type per ARM. For example, virtualNetworkGateways>" -ResourceName "<your resource's name>" -ConfigurationAssignmentName "<assignment name>" -ResourceId $serviceResource.Id -MaintenanceConfigurationId $config.Id -Location "<arm location of resource>"
+ ```
+
+### To remove a configuration assignment
++
+## Next steps
+
+For more information, see the [VPN Gateway FAQ](vpn-gateway-vpn-faq.md#customer-controlled).
vpn-gateway Nat Howto https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/vpn-gateway/nat-howto.md
NAT defines the mechanisms to translate one IP address to another in an IP packe
For more information about NAT support for Azure VPN Gateway, see [About NAT and Azure VPN Gateway](nat-overview.md). > [!IMPORTANT]
-> * NAT is supported on the the following SKUs: VpnGw2~5, VpnGw2AZ~5AZ.
+> * NAT is supported on the following SKUs: VpnGw2~5, VpnGw2AZ~5AZ.
## Getting started
vpn-gateway Vpn Gateway Troubleshoot Site To Site Disconnected Intermittently https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/vpn-gateway/vpn-gateway-troubleshoot-site-to-site-disconnected-intermittently.md
Make sure that the on-premises VPN device is set to have **one VPN tunnel per su
### Step 5: Check for Security Association Limitations
-The virtual network gateway has limit of 200 subnet Security Association pairs. If the number of Azure virtual network subnets multiplied times by the number of local subnets is greater than 200, you might see sporadic subnets disconnecting.
+The virtual network gateway has limit of 100 subnet Security Association pairs. If the number of Azure virtual network subnets multiplied times by the number of local subnets is greater than 100, you might see sporadic subnets disconnecting.
### Step 6: Check on-premises VPN device external interface address
vpn-gateway Vpn Gateway Vpn Faq https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/vpn-gateway/vpn-gateway-vpn-faq.md
description: Learn about frequently asked questions for VPN Gateway cross-premis
Previously updated : 10/18/2023 Last updated : 10/24/2023
No.
A VPN gateway is a type of virtual network gateway. A VPN gateway sends encrypted traffic between your virtual network and your on-premises location across a public connection. You can also use a VPN gateway to send traffic between virtual networks. When you create a VPN gateway, you use the -GatewayType value 'Vpn'. For more information, see [About VPN Gateway configuration settings](vpn-gateway-about-vpn-gateway-settings.md).
-### Can I create new virtual network gateways in the classic deployment model?
-
-No. The classic deployment model is a legacy deployment model. You can't create new classic virtual network gateways. Existing classic virtual network gateways are supported until August 31, 2024. To migrate to the Resource Manager deployment model, see [VPN Gateway classic to Resource Manager migration](vpn-gateway-classic-resource-manager-migration.md).
- ### Why can't I specify policy-based and route-based VPN types? As of Oct 1, 2023, you no longer need to specify VPN type. All new VPN gateways will automatically be created as route-based gateways. If you already have a policy-based gateway, you don't need to upgrade your gateway to route-based.
No. Only the traffic that has a destination IP that is contained in the virtual
[!INCLUDE [Troubleshoot VM connection](../../includes/vpn-gateway-connect-vm-troubleshoot-include.md)]
+## <a name="customer-controlled"></a>Customer-controlled gateway maintenance
++
+### How do I find out more about customer-controlled gateway maintenance?
+
+For more information, see the [VPN Gateway customer-controlled gateway maintenance](customer-controlled-gateway-maintenance.md) article.
+ ## Next steps * For more information about VPN Gateway, see [About VPN Gateway](vpn-gateway-about-vpngateways.md).
web-application-firewall Application Gateway Crs Rulegroups Rules https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/web-application-firewall/ag/application-gateway-crs-rulegroups-rules.md
The version number of the DRS increments when new attack signatures are added to
The Microsoft Threat Intelligence Collection rules are written in partnership with the Microsoft Threat Intelligence team to provide increased coverage, patches for specific vulnerabilities, and better false positive reduction. > [!NOTE]
-> We suggest you to disable some of the rules while you get started with 2.1 on Application Gateway WAF. Details of the rules are as below.
+> Please follow the below guidance to tune WAF while you get started with 2.1 on Application Gateway WAF. Details of the rules are as below.
|Rule ID |Rule Group|Description |Details| |||||
-|942110 |SQLI|SQL Injection Attack: Common Injection Testing Detected |Replaced by MSTIC rule 99031001 |
-|942150 |SQLI|SQL Injection Attack|Replaced by MSTIC rule 99031003 |
-|942260 |SQLI|Detects basic SQL authentication bypass attempts 2/3 |Replaced by MSTIC rule 99031004 |
-|942430 |SQLI|Restricted SQL Character Anomaly Detection (args): # of special characters exceeded (12)|Too many false positives.|
-|942440 |SQLI|SQL Comment Sequence Detected|Replaced by MSTIC rule 99031002 |
+|942110 |SQLI|SQL Injection Attack: Common Injection Testing Detected |Disable, Replaced by MSTIC rule 99031001 |
+|942150 |SQLI|SQL Injection Attack|Disable, Replaced by MSTIC rule 99031003 |
+|942260 |SQLI|Detects basic SQL authentication bypass attempts 2/3 |Disable, Replaced by MSTIC rule 99031004 |
+|942430 |SQLI|Restricted SQL Character Anomaly Detection (args): # of special characters exceeded (12)|Disable, Too many false positives.|
+|942440 |SQLI|SQL Comment Sequence Detected|Disable, Replaced by MSTIC rule 99031002 |
|99005006|MS-ThreatIntel-WebShells|Spring4Shell Interaction Attempt|Keep the rule enabled to prevent against SpringShell vulnerability| |99001014|MS-ThreatIntel-CVEs|Attempted Spring Cloud routing-expression injection [CVE-2022-22963](https://www.cve.org/CVERecord?id=CVE-2022-22963)|Keep the rule enabled to prevent against SpringShell vulnerability| |99001015|MS-ThreatIntel-WebShells|Attempted Spring Framework unsafe class object exploitation [CVE-2022-22965](https://www.cve.org/CVERecord?id=CVE-2022-22965)|Keep the rule enabled to prevent against SpringShell vulnerability|
The following rule groups and rules are available when using Web Application Fir
|941370|JavaScript global variable found| |941380|AngularJS client side template injection detected|
->[!NOTE]
-> This article contains references to a term that Microsoft no longer uses. When the term is removed from the software, weΓÇÖll remove it from this article.
- ### <a name="drs942-21"></a> SQLI - SQL Injection |RuleId|Description| |||
web-application-firewall Rate Limiting Configure https://github.com/MicrosoftDocs/azure-docs/commits/main/articles/web-application-firewall/ag/rate-limiting-configure.md
# Create rate limiting custom rules for Application Gateway WAF v2
-Rate limiting enables you to detect and block abnormally high levels of traffic destined for your application. Rate Limiting works by counting all traffic that that matches the configured Rate Limit rule and performing the configured action for traffic matching that rule which exceeds the configured threshold. For more information, see [Rate limiting overview](rate-limiting-overview.md).
+Rate limiting enables you to detect and block abnormally high levels of traffic destined for your application. Rate Limiting works by counting all traffic that matches the configured Rate Limit rule and performing the configured action for traffic matching that rule which exceeds the configured threshold. For more information, see [Rate limiting overview](rate-limiting-overview.md).
## Configure Rate Limit Custom Rules