|
| 1 | +--- |
| 2 | +title: Disable local (access key) authentication with Azure SignalR Service |
| 3 | +description: This article provides information about how to disable access key authentication and use only Azure AD authentication with Azure SignalR Service. |
| 4 | +author: terencefan |
| 5 | + |
| 6 | +ms.author: tefa |
| 7 | +ms.date: 03/31/2023 |
| 8 | +ms.service: signalr |
| 9 | +ms.topic: conceptual |
| 10 | +--- |
| 11 | + |
| 12 | +# Disable local (access key) authentication with Azure SignalR Service |
| 13 | + |
| 14 | +There are two ways to authenticate to Azure SignalR Service resources: Azure Active Directory (Azure AD) and Access Key. Azure AD provides superior security and ease of use over access key. With Azure AD, there’s no need to store the tokens in your code and risk potential security vulnerabilities. We recommend that you use Azure AD with your Azure SignalR Service resources when possible. |
| 15 | + |
| 16 | +> [!IMPORTANT] |
| 17 | +> Disabling local authentication can have following influences. |
| 18 | +> - The current set of access keys will be permanently deleted. |
| 19 | +> - Tokens signed with current set of access keys will become unavailable. |
| 20 | +
|
| 21 | +## Use Azure portal |
| 22 | + |
| 23 | +In this section, you will learn how to use the Azure portal to disable local authentication. |
| 24 | + |
| 25 | +1. Navigate to your SignalR Service resource in the [Azure portal](https://portal.azure.com). |
| 26 | + |
| 27 | +2. in the **Settings** section of the menu sidebar, select **Keys** tab. |
| 28 | + |
| 29 | +3. Select **Disabled** for local authentication. |
| 30 | + |
| 31 | +4. Click **Save** button. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +## Use Azure Resource Manager template |
| 36 | + |
| 37 | +You can disable local authentication by setting `disableLocalAuth` property to true as shown in the following Azure Resource Manager template. |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", |
| 42 | + "contentVersion": "1.0.0.0", |
| 43 | + "parameters": { |
| 44 | + "resource_name": { |
| 45 | + "defaultValue": "test-for-disable-aad", |
| 46 | + "type": "String" |
| 47 | + } |
| 48 | + }, |
| 49 | + "variables": {}, |
| 50 | + "resources": [ |
| 51 | + { |
| 52 | + "type": "Microsoft.SignalRService/SignalR", |
| 53 | + "apiVersion": "2022-08-01-preview", |
| 54 | + "name": "[parameters('resource_name')]", |
| 55 | + "location": "eastus", |
| 56 | + "sku": { |
| 57 | + "name": "Premium_P1", |
| 58 | + "tier": "Premium", |
| 59 | + "size": "P1", |
| 60 | + "capacity": 1 |
| 61 | + }, |
| 62 | + "kind": "SignalR", |
| 63 | + "properties": { |
| 64 | + "tls": { |
| 65 | + "clientCertEnabled": false |
| 66 | + }, |
| 67 | + "features": [ |
| 68 | + { |
| 69 | + "flag": "ServiceMode", |
| 70 | + "value": "Default", |
| 71 | + "properties": {} |
| 72 | + }, |
| 73 | + { |
| 74 | + "flag": "EnableConnectivityLogs", |
| 75 | + "value": "True", |
| 76 | + "properties": {} |
| 77 | + } |
| 78 | + ], |
| 79 | + "cors": { |
| 80 | + "allowedOrigins": [ |
| 81 | + "*" |
| 82 | + ] |
| 83 | + }, |
| 84 | + "serverless": { |
| 85 | + "connectionTimeoutInSeconds": 30 |
| 86 | + }, |
| 87 | + "upstream": {}, |
| 88 | + "networkACLs": { |
| 89 | + "defaultAction": "Deny", |
| 90 | + "publicNetwork": { |
| 91 | + "allow": [ |
| 92 | + "ServerConnection", |
| 93 | + "ClientConnection", |
| 94 | + "RESTAPI", |
| 95 | + "Trace" |
| 96 | + ] |
| 97 | + }, |
| 98 | + "privateEndpoints": [] |
| 99 | + }, |
| 100 | + "publicNetworkAccess": "Enabled", |
| 101 | + "disableLocalAuth": true, |
| 102 | + "disableAadAuth": false |
| 103 | + } |
| 104 | + } |
| 105 | + ] |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +## Use Azure Policy |
| 110 | + |
| 111 | +You can assign the [Azure SignalR Service should have local authentication methods disabled](https://ms.portal.azure.com/#view/Microsoft_Azure_Policy/PolicyDetailBlade/definitionId/%2Fproviders%2FMicrosoft.Authorization%2FpolicyDefinitions%2Ff70eecba-335d-4bbc-81d5-5b17b03d498f) Azure policy to an Azure subscription or a resource group to enforce disabling of local authentication for all SignalR resources in the subscription or the resource group. |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +## Next steps |
| 116 | + |
| 117 | +See the following docs to learn about authentication methods. |
| 118 | + |
| 119 | +- [Overview of Azure AD for SignalR](signalr-concept-authorize-azure-active-directory.md) |
| 120 | +- [Authenticate with Azure applications](./signalr-howto-authorize-application.md) |
| 121 | +- [Authenticate with managed identities](./signalr-howto-authorize-managed-identity.md) |
0 commit comments