Skip to content

Commit efc82a4

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into 2009248
2 parents 61c63eb + 2cb5a74 commit efc82a4

File tree

18 files changed

+318
-169
lines changed

18 files changed

+318
-169
lines changed
21.9 KB
Loading

articles/aks/ingress-basic.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ kubectl get services --namespace ingress-basic -o wide -w ingress-nginx-controll
298298
When the Kubernetes load balancer service is created for the NGINX ingress controller, an IP address is assigned under *EXTERNAL-IP*, as shown in the following example output:
299299

300300
```
301-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
302301
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
303302
ingress-nginx-controller LoadBalancer 10.0.65.205 EXTERNAL-IP 80:30957/TCP,443:32414/TCP 1m app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
304303
```

articles/aks/supported-kubernetes-versions.md

Lines changed: 64 additions & 55 deletions
Large diffs are not rendered by default.

articles/azure-video-indexer/logic-apps-connector-arm-accounts.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ The following image shows the first flow:
176176
|Video URL|Select **Web Url** from the dynamic content of **Create SAS URI by path** action.|
177177
| Body| Can be left as default.|
178178
179-
![Screenshot of the upload and index action.](./media/logic-apps-connector-arm-accounts/upload-and-index.png)
179+
> [!div class="mx-imgBorder"]
180+
> :::image type="content" source="./media/logic-apps-connector-arm-accounts/upload-and-index-expression.png" alt-text="Screenshot of the upload and index action." lightbox="./media/logic-apps-connector-arm-accounts/upload-and-index-expression.png":::
180181
181182
Select **Save**.
182183

766 Bytes
Loading

articles/batch/create-pool-extensions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The following extensions can currently be installed when creating a Batch pool:
2929
- [Azure Diagnostics extension for Windows VMs](../virtual-machines/windows/extensions-diagnostics.md)
3030
- [HPC GPU driver extension for Windows on AMD](../virtual-machines/extensions/hpccompute-amd-gpu-windows.md)
3131
- [HPC GPU driver extension for Windows on NVIDIA](../virtual-machines/extensions/hpccompute-gpu-windows.md)
32+
- [HPC GPU driver extension for Linux on NVIDIA](../virtual-machines/extensions/hpccompute-gpu-linux.md)
3233
- [Microsoft Antimalware extension for Windows](../virtual-machines/extensions/iaas-antimalware-windows.md)
3334

3435
You can request support for additional publishers and/or extension types by opening a support request.

articles/cognitive-services/Speech-Service/includes/release-notes/release-notes-sdk.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ ms.date: 11/01/2022
66
ms.author: eur
77
---
88

9+
### Speech SDK 1.24.2: November 2022 release
10+
11+
#### New features
12+
- No new features, just an embedded engine fix to support new model files.
13+
14+
#### Bug fixes
15+
16+
- **All programing languages**
17+
- Fixed an issue with encryption of embedded speech recognition models.
18+
- **JavaScript SDK**
19+
- not included in this release
20+
21+
- **Java**
22+
- none
23+
- **Python**
24+
- none
25+
926
### Speech SDK 1.24.1: November 2022 release
1027

1128
#### New features

articles/communication-services/quickstarts/chat/includes/chat-android.md

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,25 @@ To import the library into your project using the [Maven](https://maven.apache.o
7777
</dependency>
7878
```
7979

80+
### Set up Azure Function
81+
Please check out [Azure Function integration](../../../tutorials/integrate-azure-function.md) for details. We highly recommend integrating with Azure Function to avoid hard-coding application parameters.
82+
83+
### Set up application constants:
84+
Create a class `ApplicationConstants` which stores all application constants:
85+
```java
86+
public class ApplicationConstants {
87+
public static final String SDK_VERSION = "<your_version>";
88+
public final static String SDK_NAME = "azure-communication-com.azure.android.communication.chat";
89+
public final static String APPLICATION_ID = "Chat_Test_App";
90+
public final static String TAG = "[Chat Test App]";
91+
public static CommunicationTokenCredential COMMUNICATION_TOKEN_CREDENTIAL;
92+
}
93+
```
8094

8195
### Set up the placeholders
8296

83-
Open and edit the file `MainActivity.java`. In this Quickstart, we'll add our code to `MainActivity`, and view the output in the console. This quickstart does not address building a UI. At the top of file, import the `Communication common`, `Communication chat`, and other system libraries:
97+
Open and edit the file `MainActivity.java`. In this quick-start, we'll add our code to `MainActivity`, and view the output in the console. This quick-start does not address building a UI. At the top of the file, import the `Azure Communication Common`, `Azure
98+
Communication Chat`, and other system libraries:
8499

85100
```
86101
import com.azure.android.communication.chat.*;
@@ -100,16 +115,6 @@ import java.util.List;
100115
Copy the following code into class `MainActivity` in file `MainActivity.java`:
101116

102117
```java
103-
private String endpoint = "<replace with your resource endpoint>'";
104-
private String firstUserId = "<first_user_id>";
105-
private String secondUserId = "<second_user_id>";
106-
private String firstUserAccessToken = "<first_user_access_token>";
107-
private String threadId = "<thread_id>";
108-
private String chatMessageId = "<chat_message_id>";
109-
private final String sdkVersion = "<chat_sdk_version>";
110-
private static final String APPLICATION_ID = "Chat Quickstart App";
111-
private static final String SDK_NAME = "azure-communication-com.azure.android.communication.chat";
112-
private static final String TAG = "Chat Quickstart App";
113118
private ChatAsyncClient chatAsyncClient;
114119

115120
private void log(String msg) {
@@ -123,6 +128,8 @@ Copy the following code into class `MainActivity` in file `MainActivity.java`:
123128
try {
124129
AndroidThreeTen.init(this);
125130

131+
// Initialize application parameters if one of the conditions in '### Initialize Application Parameters' are met.
132+
126133
// <CREATE A CHAT CLIENT>
127134

128135
// <CREATE A CHAT THREAD>
@@ -150,13 +157,33 @@ Copy the following code into class `MainActivity` in file `MainActivity.java`:
150157
}
151158
```
152159

153-
1. Replace `<resource>` with your Communication Services resource.
154-
2. Replace `<first_user_id>` and `<second_user_id>` with valid Communication Services user IDs that were generated as part of prerequisite steps.
155-
3. Replace `<first_user_access_token>` with the Communication Services access token for `<first_user_id>` that was generated as part of prerequisite steps.
156-
4. Replace `<chat_sdk_version>` with the version of Azure Communication Chat SDK.
160+
### Initialize Application Parameters
161+
> [!NOTE]
162+
> Initializing `ApplicationConstants` needs to be added to `MainActivity.java` if EITHER of the following conditions is met: 1. The push notification feature is NOT enabled. 2. The version for the Azure Communication Chat library for Android is < '2.0.0'. Otherwise, please refer to step 11 in [Android push notifications](../../../tutorials/chat-android-push-notification.md). Please refer to the sample APP of the SDK version that you are consuming for reference.
157163
158-
In following steps, we'll replace the placeholders with sample code using the Azure Communication Services Chat library.
164+
`ACS_ENDPOINT`, `FIRST_USER_ID` and `FIRST_USER_ACCESS_TOKEN` are returned from calling Azure Function. Please check out [Azure Function integration](../../../tutorials/integrate-azure-function.md) for details. We use the response from calling Azure Function to initialize the list of parameters:
165+
* `ACS_ENDPOINT`: the endpoint of your Communication Services resource.
166+
* `FIRST_USER_ID` and `SECOND_USER_ID`: valid Communication Services user IDs generated by your Communication Services resource.
167+
* `FIRST_USER_ACCESS_TOKEN`: the communication Services access token for `<FIRST_USER_ID>`.
159168

169+
Code block for initialing application parameters by calling Azure Function:
170+
```java
171+
try {
172+
UserTokenClient userTokenClient = new UserTokenClient(AZURE_FUNCTION_URL);
173+
//First user context
174+
userTokenClient.getNewUserContext();
175+
ACS_ENDPOINT = userTokenClient.getACSEndpoint();
176+
FIRST_USER_ID = userTokenClient.getUserId();
177+
FIRST_USER_ACCESS_TOKEN = userTokenClient.getUserToken();
178+
COMMUNICATION_TOKEN_CREDENTIAL = new CommunicationTokenCredential(FIRST_USER_ACCESS_TOKEN);
179+
//Second user context
180+
userTokenClient.getNewUserContext();
181+
SECOND_USER_ID = userTokenClient.getUserId();
182+
} catch (Throwable throwable) {
183+
//Your handling code
184+
logger.logThrowableAsError(throwable);
185+
}
186+
```
160187

161188
### Create a chat client
162189

articles/communication-services/tutorials/chat-android-push-notification.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,32 @@ Push notifications let clients be notified for incoming messages and other opera
195195
11. Add a custom `WorkManager` initializer by creating a class implementing `Configuration.Provider`:
196196

197197
```java
198-
public class MyAppConfiguration extends Application implements Configuration.Provider {
199-
Consumer<Throwable> exceptionHandler = new Consumer<Throwable>() {
198+
public class MyAppConfiguration extends Application implements Configuration.Provider {
199+
Consumer<Throwable> exceptionHandler = new Consumer<Throwable>() {
200+
@Override
201+
public void accept(Throwable throwable) {
202+
Log.i("YOUR_TAG", "Registration failed for push notifications!" + throwable.getMessage());
203+
}
204+
};
205+
200206
@Override
201-
public void accept(Throwable throwable) {
202-
Log.i("YOUR_TAG", "Registration failed for push notifications!" + throwable.getMessage());
207+
public void onCreate() {
208+
super.onCreate();
209+
// Initialize application parameters here
210+
WorkManager.initialize(getApplicationContext(), getWorkManagerConfiguration());
211+
}
212+
213+
@NonNull
214+
@Override
215+
public Configuration getWorkManagerConfiguration() {
216+
return new Configuration.Builder().
217+
setWorkerFactory(new RegistrationRenewalWorkerFactory(COMMUNICATION_TOKEN_CREDENTIAL, exceptionHandler)).build();
203218
}
204-
};
205-
@Override
206-
public void onCreate() {
207-
super.onCreate();
208-
WorkManager.initialize(getApplicationContext(), getWorkManagerConfiguration());
209-
}
210-
@NonNull
211-
@Override
212-
public Configuration getWorkManagerConfiguration() {
213-
return new Configuration.Builder().
214-
setWorkerFactory(new RegistrationRenewalWorkerFactory(COMMUNICATION_TOKEN_CREDENTIAL, exceptionHandler)).build();
215219
}
216-
}
217220
```
221+
**Explanation to code above:** The default initializer of `WorkManager` has been disabled in step 9. This step implements `Configuration.Provider` to provide a customized 'WorkFactory', which is responsible to create `WorkerManager` during runtime.
222+
223+
If the app is integrated with Azure Function, initialization of application parameters should be added in method 'onCreate()'. Method 'getWorkManagerConfiguration()' is called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created, so that application parameters could be initialized before being used. More details can be found in the sample chat app.
218224

219225
12. Add the `android:name=.MyAppConfiguration` field, which uses the class name from step 11, into `AndroidManifest.xml`:
220226

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Enable Azure Function in chat app
3+
titleSuffix: An Azure Communication Services tutorial
4+
description: Learn how to enable Azure Function
5+
author: jiminwen
6+
services: azure-communication-services
7+
ms.author: jiminwen
8+
ms.date: 11/03/2022
9+
ms.topic: tutorial
10+
ms.service: azure-communication-services
11+
---
12+
13+
# Integrate Azure Function
14+
## Introduction
15+
This tutorial provides detailed guidance on how to set up an Azure Function to receive user-related information. Setting up an Azure Function is highly recommended. It helps to avoid hard-coding application parameters in the Contoso app (such as user ID and user token). This information is highly confidential. More importantly, we refresh user tokens periodically on the backend. Hard-coding the user ID and token combination requires editing the value after every refresh.
16+
17+
## Prerequisites
18+
19+
Before you get started, make sure to:
20+
21+
- Create an Azure account with an active subscription. For details, see [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
22+
- Install Visual Studio Code.
23+
24+
## Setting up functions
25+
1. Install the Azure Function extension in Visual Studio Code. You can install it from Visual Studio Code's plugin browser or by following [this link](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
26+
2. Set up a local Azure Function app by following [this link](../../azure-functions/functions-develop-vs-code.md?tabs=csharp#create-an-azure-functions-project). We need to create a local function using the HTTP trigger template in JavaScript.
27+
3. Install Azure Communication Services libraries. We'll use the Identity library to generate User Access Tokens. Run the npm install command in your local Azure Function app directory, to install the Azure Communication Services Identity SDK for JavaScript.
28+
29+
```
30+
npm install @azure/communication-identity --save
31+
```
32+
4. Modify the `index.js` file so it looks like the code below:
33+
```JavaScript
34+
const { CommunicationIdentityClient } = require('@azure/communication-identity');
35+
const connectionString = '<your_connection_string>'
36+
const acsEndpoint = "<your_ACS_endpoint>"
37+
38+
module.exports = async function (context, req) {
39+
let tokenClient = new CommunicationIdentityClient(connectionString);
40+
41+
const userIDHolder = await tokenClient.createUser();
42+
const userId = userIDHolder.communicationUserId
43+
44+
const userToken = await (await tokenClient.getToken(userIDHolder, ["chat"])).token;
45+
46+
context.res = {
47+
body: {
48+
acsEndpoint,
49+
userId,
50+
userToken
51+
}
52+
};
53+
}
54+
```
55+
**Explanation to code above**: The first line import the interface for the `CommunicationIdentityClient`. The connection string in the second line can be found in your ACS resource in the Azure portal. The `ACSEndpoint` is the URL of the ACS resource that was created.
56+
57+
5. Open the local Azure Function folder in Visual Studio Code. Open the `index.js` and run the local Azure Function. A local Azure Function endpoint will be created and printed in the terminal. The printed message looks similar to:
58+
59+
```
60+
Functions:
61+
HttpTrigger1: [GET,POST] http://localhost:7071/api/HttpTrigger1
62+
```
63+
64+
Open the link in a browser. The result will be similar to this example:
65+
```
66+
{
67+
"acsEndpoint": "<Azure Function endpoint>",
68+
"userId": "8:acs:a636364c-c565-435d-9818-95247f8a1471_00000014-f43f-b90f-9f3b-8e3a0d00c5d9",
69+
"userToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwNiIsIng1dCI6Im9QMWFxQnlfR3hZU3pSaXhuQ25zdE5PU2p2cyIsInR5cCI6IkpXVCJ9.eyJza3lwZWlkIjoiYWNzOmE2MzYzNjRjLWM1NjUtNDM1ZC05ODE4LTk1MjQ3ZjhhMTQ3MV8wMDAwMDAxNC1mNDNmLWI5MGYtOWYzYi04ZTNhMGQwMGM1ZDkiLCJzY3AiOjE3OTIsImNzaSI6IjE2Njc4NjI3NjIiLCJleHAiOjE2Njc5NDkxNjIsImFjc1Njb3BlIjoiY2hhdCIsInJlc291cmNlSWQiOiJhNjM2MzY0Yy1jNTY1LTQzNWQtOTgxOC05NTI0N2Y4YTE0NzEiLCJyZXNvdXJjZUxvY2F0aW9uIjoidW5pdGVkc3RhdGVzIiwiaWF0IjoxNjY3ODYyNzYyfQ.t-WpaUUmLJaD0V2vgn3M5EKdJUQ_JnR2jnBUZq3J0zMADTnFss6TNHMIQ-Zvsumwy14T1rpw-1FMjR-zz2icxo_mcTEM6hG77gHzEgMR4ClGuE1uRN7O4-326ql5MDixczFeIvIG8s9kAeJQl8N9YjulvRkGS_JZaqMs2T8Mu7qzdIOiXxxlmcl0HeplxLaW59ICF_M4VPgUYFb4PWMRqLXWjKyQ_WhiaDC3FvhpE_Bdb5U1eQXDw793V1_CRyx9jMuOB8Ao7DzqLBQEhgNN3A9jfEvIE3gdwafpBWlQEdw-Uuf2p1_xzvr0Akf3ziWUsVXb9pxNlQQCc19ztl3MIQ"
70+
}
71+
```
72+
73+
6. Deploy the local function to the cloud. More details can be found in [this documentation](../../azure-functions/functions-develop-vs-code.md).
74+
75+
7. **Test the deployed Azure Function.** First, find your Azure Function in the Azure portal. Then, use the "Get Function URL" button to get the Azure Function endpoint. The result you see should be similar to what was shown in step 5. The Azure Function endpoint will be used in the app for initializing application parameters.
76+
77+
8. Implement `UserTokenClient`, which is used to call the target Azure Function resource and obtain the ACS endpoint, user ID and user token from the returned JSON object. Refer to the sample app for usage.
78+
79+
## Troubleshooting guide
80+
1. If the Azure Function extension failed to deploy the local function to the Azure cloud, it's likely due to the version of Visual Studio Code and the Azure Function extension being used having a bug. This version combination has been tested to work: Visual Studio Code version `1.68.1` and Azure Function extension version `1.2.1`.
81+
2. The place to initialize application constants is tricky but important. Double check the [chat Android quick-start](https://learn.microsoft.com/azure/communication-services/quickstarts/chat/get-started). More specifically, the highlight note in the section "Set up application constants", and compare with the sample app of the version you are consuming.
82+
83+
## (Optional) secure the Azure Function endpoint
84+
For demonstration purposes, this sample uses a publicly accessible endpoint by default to fetch an Azure Communication Services token. For production scenarios, one option is to use your own secured endpoint to provision your own tokens.
85+
86+
With extra configuration, this sample supports connecting to an Azure Active Directory (Azure AD) protected endpoint so that user log is required for the app to fetch an Azure Communication Services token. The user will be required to sign in with Microsoft account to access the app. This setup increases the security level while users are required to log in. Decide whether to enable it based on the use cases.
87+
88+
Note that we currently don't support Azure AD in sample code. Follow the links below to enable it in your app and Azure Function:
89+
90+
[Register your app under Azure Active Directory (using Android platform settings)](../../active-directory/develop/tutorial-v2-android.md).
91+
92+
[Configure your App Service or Azure Functions app to use Azure AD log in](../../app-service/configure-authentication-provider-aad.md).

0 commit comments

Comments
 (0)