Skip to content

Commit 07eb5e8

Browse files
authored
Merge pull request #267779 from MicrosoftDocs/main
3/1 11:00 AM IST Publish
2 parents 3cb33dc + 0b17803 commit 07eb5e8

File tree

54 files changed

+2048
-930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2048
-930
lines changed

.openpublishing.publish.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,7 @@
12221222
".openpublishing.redirection.machine-configuration.json",
12231223
".openpublishing.redirection.marketplace.json",
12241224
".openpublishing.redirection.openshift.json",
1225+
".openpublishing.redirection.purview.json",
12251226
".openpublishing.redirection.security-benchmark.json",
12261227
".openpublishing.redirection.sentinel.json",
12271228
".openpublishing.redirection.spring-cloud.json",
@@ -1283,7 +1284,6 @@
12831284
"articles/operator-nexus/.openpublishing.redirection.operator-nexus.json",
12841285
"articles/peering-service/.openpublishing.redirection.peering-service.json",
12851286
"articles/postgresql/.openpublishing.redirection.postgresql.json",
1286-
"articles/purview/.openpublishing.redirection.purview.json",
12871287
"articles/route-server/.openpublishing.redirection.route-server.json",
12881288
"articles/sap/.openpublishing.redirection.sap.json",
12891289
"articles/security/.openpublishing.redirection.security.json",

.openpublishing.redirection.azure-kubernetes-service.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,6 @@
461461
"source_path_from_root": "/articles/aks/command-invoke.md",
462462
"redirect_url": "/azure/aks/access-private-cluster",
463463
"redirect_document_id": false
464-
},
465-
{
466-
"source_path_from_root": "/articles/aks/ai-toolchain-operator.md",
467-
"redirect_url": "https://azure.microsoft.com/updates/preview-ai-toolchain-operator-addon-for-aks/",
468-
"redirect_document_id": false
469464
}
470465
]
471466
}

articles/ai-services/immersive-reader/how-to-store-user-preferences.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This functionality can be used as an alternate means to storing user preferences
2626
2727
## Enable storing user preferences
2828

29-
The Immersive Reader SDK [launchAsync](./reference.md#launchasync) `options` parameter contains the `-onPreferencesChanged` callback. This function is called anytime the user changes their preferences. The `value` parameter contains a string, which represents the user's current preferences. This string is then stored, for that user, by the host application.
29+
The Immersive Reader SDK [launchAsync](reference.md#function-launchasync) `options` parameter contains the `-onPreferencesChanged` callback. This function will be called anytime the user changes their preferences. The `value` parameter contains a string, which represents the user's current preferences. This string is then stored, for that user, by the host application.
3030

3131
```typescript
3232
const options = {

articles/ai-services/immersive-reader/reference.md

Lines changed: 104 additions & 168 deletions
Large diffs are not rendered by default.

articles/ai-services/immersive-reader/security-how-to-update-role-assignment.md

Lines changed: 39 additions & 45 deletions
Large diffs are not rendered by default.

articles/ai-services/immersive-reader/toc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@
3636
href: how-to-cache-token.md
3737
- name: Store user preferences
3838
href: how-to-store-user-preferences.md
39+
- name: Create an iOS app that reads from photos
40+
href: tutorial-ios-picture-immersive-reader.md
3941
- name: Enterprise readiness
4042
items:
4143
- name: Set up Virtual Networks
4244
href: ../../ai-services/cognitive-services-virtual-networks.md?context=/azure/ai-services/immersive-reader/context/context
4345
- name: Use Microsoft Entra authentication
4446
href: ../../ai-services/authentication.md?context=/azure/ai-services/immersive-reader/context/context
45-
- name: Security Advisory
47+
- name: Security advisory
4648
items:
47-
- name: Update Role Assignment for Microsoft Entra authentication
49+
- name: Update Microsoft Entra role assignment
4850
href: security-how-to-update-role-assignment.md
4951
- name: Reference
5052
items:

articles/ai-services/immersive-reader/tutorial-ios-picture-immersive-reader.md

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "Tutorial: Create an iOS app that takes a photo and launches it in the Immersive Reader (Swift)"
33
titleSuffix: Azure AI services
4-
description: In this tutorial, you will build an iOS app from scratch and add the Picture to Immersive Reader functionality.
4+
description: Learn how to build an iOS app from scratch and add the Picture to Immersive Reader functionality.
55
#services: cognitive-services
6-
author: rwallerms
6+
author: sharmas
77

88
ms.service: azure-ai-immersive-reader
99
ms.topic: tutorial
10-
ms.date: 01/14/2020
11-
ms.author: rwaller
10+
ms.date: 02/28/2024
11+
ms.author: sharmas
1212
#Customer intent: As a developer, I want to integrate two Azure AI services, the Immersive Reader and the Read API into my iOS application so that I can view any text from a photo in the Immersive Reader.
1313
---
1414

@@ -18,31 +18,30 @@ The [Immersive Reader](https://www.onenote.com/learningtools) is an inclusively
1818

1919
The [Azure AI Vision Read API](../../ai-services/computer-vision/overview-ocr.md) detects text content in an image using Microsoft's latest recognition models and converts the identified text into a machine-readable character stream.
2020

21-
In this tutorial, you will build an iOS app from scratch and integrate the Read API, and the Immersive Reader by using the Immersive Reader SDK. A full working sample of this tutorial is available [here](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/ios).
22-
23-
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/cognitive-services/) before you begin.
21+
In this tutorial, you build an iOS app from scratch and integrate the Read API and the Immersive Reader by using the Immersive Reader SDK. A full working sample of this tutorial is available [on GitHub](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/ios).
2422

2523
## Prerequisites
2624

27-
* [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12)
28-
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](./how-to-create-immersive-reader.md) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference.
29-
* Usage of this sample requires an Azure subscription to the Azure AI Vision service. [Create an Azure AI Vision resource in the Azure portal](https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision).
25+
* An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/ai-services/).
26+
* MacOS and [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12).
27+
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](how-to-create-immersive-reader.md) to get set up.
28+
* A subscription to the Azure AI Vision service. Create an [Azure AI Vision resource in the Azure portal](https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision).
3029

3130
## Create an Xcode project
3231

3332
Create a new project in Xcode.
3433

35-
![New Project](./media/ios/xcode-create-project.png)
34+
:::image type="content" source="media/ios/xcode-create-project.png" alt-text="Screenshot of the Create a new Xcode project screen.":::
3635

3736
Choose **Single View App**.
3837

39-
![New Single View App](./media/ios/xcode-single-view-app.png)
38+
:::image type="content" source="media/ios/xcode-single-view-app.png" alt-text="Screenshot of the template gallery to select a single view app.":::
4039

4140
## Get the SDK CocoaPod
4241

4342
The easiest way to use the Immersive Reader SDK is via CocoaPods. To install via Cocoapods:
4443

45-
1. [Install CocoaPods](http://guides.cocoapods.org/using/getting-started.html) - Follow the getting started guide to install Cocoapods.
44+
1. Follow the [guide to install Cocoapods](http://guides.cocoapods.org/using/getting-started.html).
4645

4746
2. Create a Podfile by running `pod init` in your Xcode project's root directory.
4847

@@ -68,20 +67,20 @@ The easiest way to use the Immersive Reader SDK is via CocoaPods. To install via
6867

6968
## Acquire a Microsoft Entra authentication token
7069

71-
You need some values from the Microsoft Entra authentication configuration prerequisite step above for this part. Refer back to the text file you saved of that session.
70+
You need some values from the Microsoft Entra authentication configuration step in the prerequisites section. Refer back to the text file you saved from that session.
7271

7372
````text
7473
TenantId => Azure subscription TenantId
75-
ClientId => Azure AD ApplicationId
76-
ClientSecret => Azure AD Application Service Principal password
74+
ClientId => Microsoft Entra ApplicationId
75+
ClientSecret => Microsoft Entra Application Service Principal password
7776
Subdomain => Immersive Reader resource subdomain (resource 'Name' if the resource was created in the Azure portal, or 'CustomSubDomain' option if the resource was created with Azure CLI PowerShell. Check the Azure portal for the subdomain on the Endpoint in the resource Overview page, for example, 'https://[SUBDOMAIN].cognitiveservices.azure.com/')
7877
````
7978

80-
In the main project folder, which contains the ViewController.swift file, create a Swift class file called Constants.swift. Replace the class with the following code, adding in your values where applicable. Keep this file as a local file that only exists on your machine and be sure not to commit this file into source control, as it contains secrets that should not be made public. It is recommended that you do not keep secrets in your app. Instead, we recommend using a backend service to obtain the token, where the secrets can be kept outside of the app and off of the device. The backend API endpoint should be secured behind some form of authentication (for example, [OAuth](https://oauth.net/2/)) to prevent unauthorized users from obtaining tokens to use against your Immersive Reader service and billing; that work is beyond the scope of this tutorial.
79+
In the main project folder, which contains the *ViewController.swift* file, create a Swift class file called `Constants.swift`. Replace the class with the following code, adding in your values where applicable. Keep this file as a local file that only exists on your machine and be sure not to commit this file into source control because it contains secrets that shouldn't be made public. We recommended that you don't keep secrets in your app. Instead, use a backend service to obtain the token, where the secrets can be kept outside of the app and off of the device. The backend API endpoint should be secured behind some form of authentication (for example, [OAuth](https://oauth.net/2/)) to prevent unauthorized users from obtaining tokens to use against your Immersive Reader service and billing; that work is beyond the scope of this tutorial.
8180

8281
## Set up the app to run without a storyboard
8382

84-
Open AppDelegate.swift and replace the file with the following code.
83+
Open *AppDelegate.swift* and replace the file with the following code.
8584

8685
```swift
8786
import UIKit
@@ -135,7 +134,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
135134

136135
## Add functionality for taking and uploading photos
137136

138-
Rename ViewController.swift to PictureLaunchViewController.swift and replace the file with the following code.
137+
Rename *ViewController.swift* to *PictureLaunchViewController.swift* and replace the file with the following code.
139138

140139
```swift
141140
import UIKit
@@ -369,13 +368,13 @@ class PictureLaunchViewController: UIViewController, UINavigationControllerDeleg
369368
})
370369
}
371370

372-
/// Retrieves the token for the Immersive Reader using Azure Active Directory authentication
371+
/// Retrieves the token for the Immersive Reader using Microsoft Entra authentication
373372
///
374373
/// - Parameters:
375-
/// -onSuccess: A closure that gets called when the token is successfully recieved using Azure Active Directory authentication.
376-
/// -theToken: The token for the Immersive Reader recieved using Azure Active Directory authentication.
377-
/// -onFailure: A closure that gets called when the token fails to be obtained from the Azure Active Directory Authentication.
378-
/// -theError: The error that occurred when the token fails to be obtained from the Azure Active Directory Authentication.
374+
/// -onSuccess: A closure that gets called when the token is successfully received using Microsoft Entra authentication.
375+
/// -theToken: The token for the Immersive Reader received using Microsoft Entra authentication.
376+
/// -onFailure: A closure that gets called when the token fails to be obtained from the Microsoft Entra authentication.
377+
/// -theError: The error that occurred when the token fails to be obtained from the Microsoft Entra authentication.
379378
func getToken(onSuccess: @escaping (_ theToken: String) -> Void, onFailure: @escaping ( _ theError: String) -> Void) {
380379

381380
let tokenForm = "grant_type=client_credentials&resource=https://cognitiveservices.azure.com/&client_id=" + Constants.clientId + "&client_secret=" + Constants.clientSecret
@@ -553,19 +552,22 @@ class PictureLaunchViewController: UIViewController, UINavigationControllerDeleg
553552
## Build and run the app
554553

555554
Set the archive scheme in Xcode by selecting a simulator or device target.
556-
![Archive scheme](./media/ios/xcode-archive-scheme.png)<br/>
557-
![Select Target](./media/ios/xcode-select-target.png)
558555

559-
In Xcode, press Ctrl + R or select the play button to run the project and the app should launch on the specified simulator or device.
556+
:::image type="content" source="media/ios/xcode-archive-scheme.png" alt-text="Screenshot of the archive stream.":::
557+
558+
:::image type="content" source="media/ios/xcode-select-target.png" alt-text="Screenshot of the simulator selection target.":::
559+
560+
In Xcode, press **Ctrl+R** or select the play button to run the project. The app should launch on the specified simulator or device.
560561

561562
In your app, you should see:
562563

563-
![Sample app](./media/ios/picture-to-immersive-reader-ipad-app.png)
564+
:::image type="content" source="media/ios/picture-to-immersive-reader-ipad-app.png" alt-text="Screenshot of the sample app with text to be read.":::
564565

565-
Inside the app, take or upload a photo of text by pressing the 'Take Photo' button or 'Choose Photo from Library' button and the Immersive Reader will then launch displaying the text from the photo.
566+
Take or upload a photo of text by pressing the **Take Photo** button or **Choose Photo from Library** button. The Immersive Reader then launches and displays the text from the photo.
566567

567-
![Immersive Reader](./media/ios/picture-to-immersive-reader-ipad.png)
568+
:::image type="content" source="media/ios/picture-to-immersive-reader-ipad.png" alt-text="Screenshot of the Immersive Reader app.":::
568569

569-
## Next steps
570+
## Next step
570571

571-
* Explore the [Immersive Reader SDK Reference](./reference.md)
572+
> [!div class="nextstepaction"]
573+
> [Explore the Immersive Reader SDK reference](reference.md)

articles/ai-services/openai/api-version-deprecation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: cognitive-services
55
manager: nitinme
66
ms.service: azure-ai-openai
77
ms.topic: conceptual
8-
ms.date: 02/13/2024
8+
ms.date: 02/29/2024
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
recommendations: false
@@ -37,9 +37,10 @@ This version contains support for all the latest Azure OpenAI features including
3737
On April 2, 2024 the following API preview releases will be retired and will stop accepting API requests:
3838

3939
- 2023-03-15-preview
40-
- 2023-06-01-preview
4140
- 2023-07-01-preview
4241
- 2023-08-01-preview
42+
- 2023-09-01-preview
43+
- 2023-12-01-preview
4344

4445
To avoid service disruptions, you must update to use the latest preview version before the retirement date.
4546

articles/ai-services/openai/how-to/managed-identity.md

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ titleSuffix: Azure OpenAI
44
description: Provides guidance on how to set managed identity with Microsoft Entra ID
55
ms.service: azure-ai-openai
66
ms.topic: how-to
7-
ms.date: 06/24/2022
8-
author: ChrisHMSFT
9-
ms.author: chrhoder
7+
ms.date: 02/29/2024
8+
author: mrbullwinkle
9+
ms.author: mbullwin
1010
recommendations: false
1111
ms.custom: devx-track-azurecli
1212
---
@@ -15,7 +15,7 @@ ms.custom: devx-track-azurecli
1515

1616
More complex security scenarios require Azure role-based access control (Azure RBAC). This document covers how to authenticate to your OpenAI resource using Microsoft Entra ID.
1717

18-
In the following sections, you'll use the Azure CLI to assign roles, and obtain a bearer token to call the OpenAI resource. If you get stuck, links are provided in each section with all available options for each command in Azure Cloud Shell/Azure CLI.
18+
In the following sections, you'll use the Azure CLI to sign in, and obtain a bearer token to call the OpenAI resource. If you get stuck, links are provided in each section with all available options for each command in Azure Cloud Shell/Azure CLI.
1919

2020
## Prerequisites
2121

@@ -27,52 +27,71 @@ In the following sections, you'll use the Azure CLI to assign roles, and obtain
2727
../../cognitive-services-custom-subdomains.md)
2828

2929
- Azure CLI - [Installation Guide](/cli/azure/install-azure-cli)
30-
- The following Python libraries: os, requests, json
30+
- The following Python libraries: os, requests, json, openai, azure-identity
31+
32+
## Assign yourself to the Cognitive Services User role
33+
34+
Assign yourself the [Cognitive Services User](role-based-access-control.md#cognitive-services-contributor) role to allow you to use your account to make Azure OpenAI API calls rather than having to use key-based auth. After you make this change it can take up to 5 minutes before the change takes effect.
3135

3236
## Sign into the Azure CLI
3337

34-
To sign-in to the Azure CLI, run the following command and complete the sign-in. You may need to do it again if your session has been idle for too long.
38+
To sign-in to the Azure CLI, run the following command and complete the sign-in. You might need to do it again if your session has been idle for too long.
3539

3640
```azurecli
3741
az login
3842
```
3943

40-
## Assign yourself to the Cognitive Services User role
41-
42-
Assigning yourself to the "Cognitive Services User" role will allow you to use your account for access to the specific Azure AI services resource.
43-
44-
1. Get your user information
45-
46-
```azurecli
47-
export user=$(az account show --query "user.name" -o tsv)
48-
```
44+
## Chat Completions
45+
46+
```python
47+
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
48+
from openai import AzureOpenAI
49+
50+
token_provider = get_bearer_token_provider(
51+
DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"
52+
)
53+
54+
client = AzureOpenAI(
55+
api_version="2024-02-15-preview",
56+
azure_endpoint="https://{your-custom-endpoint}.openai.azure.com/",
57+
azure_ad_token_provider=token_provider
58+
)
59+
60+
response = client.chat.completions.create(
61+
model="gpt-35-turbo-0125", # model = "deployment_name".
62+
messages=[
63+
{"role": "system", "content": "You are a helpful assistant."},
64+
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
65+
{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},
66+
{"role": "user", "content": "Do other Azure AI services support this too?"}
67+
]
68+
)
69+
70+
print(response.choices[0].message.content)
71+
```
4972

50-
2. Assign yourself to “Cognitive Services User” role.
73+
## Querying Azure OpenAI with the control plane API
5174

52-
```azurecli
53-
export resourceId=$(az group show -g $RG --query "id" -o tsv)
54-
az role assignment create --role "Cognitive Services User" --assignee $user --scope $resourceId
55-
```
75+
```python
76+
import requests
77+
import json
78+
from azure.identity import DefaultAzureCredential
5679

57-
> [!NOTE]
58-
> Role assignment change will take ~5 mins to become effective.
80+
region = "eastus"
81+
token_credential = DefaultAzureCredential()
82+
subscriptionId = "{YOUR-SUBSCRIPTION-ID}"
5983

60-
3. Acquire a Microsoft Entra access token. Access tokens expire in one hour. you'll then need to acquire another one.
6184

62-
```azurecli
63-
export accessToken=$(az account get-access-token --resource https://cognitiveservices.azure.com --query "accessToken" -o tsv)
64-
```
85+
token = token_credential.get_token('https://management.azure.com/.default')
86+
headers = {'Authorization': 'Bearer ' + token.token}
6587

66-
4. Make an API call
88+
url = f"https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{region}/models?api-version=2023-05-01"
6789

68-
Use the access token to authorize your API call by setting the `Authorization` header value.
90+
response = requests.get(url, headers=headers)
6991

92+
data = json.loads(response.text)
7093

71-
```bash
72-
curl ${endpoint%/}/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2023-05-15 \
73-
-H "Content-Type: application/json" \
74-
-H "Authorization: Bearer $accessToken" \
75-
-d '{ "prompt": "Once upon a time" }'
94+
print(json.dumps(data, indent=4))
7695
```
7796

7897
## Authorize access to managed identities

0 commit comments

Comments
 (0)