|
1 | 1 | ---
|
2 | 2 | title: Configure Deployment Credentials
|
3 |
| -description: Learn what types of deployment credentials are in Azure App Service and how to configure and use them. |
| 3 | +description: Learn about the types of deployment credentials for deploying local apps to Azure App Service and how to configure and use them. |
4 | 4 | author: cephalin
|
5 | 5 | ms.author: cephalin
|
6 | 6 | ms.reviewer: byvinyal
|
7 | 7 | ms.topic: how-to
|
8 |
| -ms.date: 01/26/2024 |
| 8 | +ms.date: 06/27/2025 |
9 | 9 |
|
10 | 10 | ---
|
11 | 11 |
|
12 | 12 | # Configure deployment credentials for Azure App Service
|
13 |
| -To secure app deployment from a local computer, [Azure App Service](./overview.md) supports two types of credentials for [local Git deployment](deploy-local-git.md) and [FTP/FTPS deployment](deploy-ftp.md). These credentials are different from your Azure subscription credentials. |
14 | 13 |
|
15 |
| -[!INCLUDE [app-service-deploy-credentials](../../includes/app-service-deploy-credentials.md)] |
| 14 | +You can deploy local apps to [Azure App Service](overview.md) by using [local Git deployment](deploy-local-git.md) or [FTP/S deployment](deploy-ftp.md). App Service supports two types of credentials for secure local app deployment, *user-scope* and *app-scope* credentials. These credentials are different from your Azure subscription credentials. |
16 | 15 |
|
17 |
| -> [!NOTE] |
18 |
| -> When [basic authentication is disabled](configure-basic-auth-disable.md), you can't view or configure deployment credentials in **Deployment Center**. |
| 16 | +- **User-scope credentials** provide a user with one set of deployment credentials for their entire Azure account. A user who is granted app access via role-based access control (RBAC) or coadministrator permissions can use their user-level credentials until access is revoked. |
19 | 17 |
|
20 |
| -## <a name="userscope"></a>Configure user-scope credentials |
| 18 | + You can use your user-scope credentials to deploy any app to App Service via local Git or FTP/S in any subscription that your Azure account has permission to access. Don't share these credentials with other Azure users. |
21 | 19 |
|
22 |
| -# [Azure CLI](#tab/cli) |
| 20 | +- **App-scope credentials** provide one set of credentials per app, which can be used to deploy that app only. The app-scope credentials for each app are generated automatically during app creation and can't be configured manually, but they can be reset anytime. |
| 21 | + |
| 22 | + A user must have at least **Contributor** level permissions on an app, including the built-in **Website Contributor** role, to be granted access to app-level credentials via RBAC. **Reader** role can't publish and can't access these credentials. |
| 23 | + |
| 24 | +>[!IMPORTANT] |
| 25 | +>Basic authentication must be enabled to publish via local Git or FTP/S. Basic authentication is less secure than other authentication methods and is disabled by default for new apps. When [basic authentication is disabled](configure-basic-auth-disable.md), you can't view or set deployment credentials in the app's **Deployment Center**. |
| 26 | +> |
| 27 | +>To enable or disable basic authentication, go to the app's **Configuration** page in the Azure portal. |
| 28 | +
|
| 29 | +<a name="userscope"></a> |
| 30 | +## Set user-scope credentials |
| 31 | + |
| 32 | +You can configure user-scope credentials by using Azure CLI or the Azure portal. For FTP/S deployment, you need both a user name and password. For local Git deployment, you only need a user name. User names must be unique within Azure. |
23 | 33 |
|
24 |
| -Run the [`az webapp deployment user set`](/cli/azure/webapp/deployment/user#az-webapp-deployment-user-set) command. Replace `<username>` and `<password>` with a deployment user's username and password. |
| 34 | +# [Azure CLI](#tab/cli) |
25 | 35 |
|
26 |
| -- The username must be unique within Azure, and for local Git pushes, must not contain the @ symbol. |
27 |
| -- The password must be at least eight characters long, with two of the following three elements: letters, numbers, and symbols. |
| 36 | +To create user-scope credentials, run the [`az webapp deployment user set`](/cli/azure/webapp/deployment/user#az-webapp-deployment-user-set) command, replacing `<username>` and `<password>` with values you select. |
28 | 37 |
|
29 | 38 | ```azurecli-interactive
|
30 | 39 | az webapp deployment user set --user-name <username> --password <password>
|
31 | 40 | ```
|
| 41 | +- For FTP/S, the password must be at least eight characters and contain capital letters, lowercase letters, numbers, and symbols. The JSON output shows the password as `null`. |
| 42 | +- For local Git, you only need to provide a user name. The user name can't contain the `@` character. |
32 | 43 |
|
33 |
| -The JSON output shows the password as `null`. |
| 44 | +- The user name must follow the format `<app-name>\<user-name>`. Since user-scope credentials are linked to the user and not to the app, the username must be in this format to direct the sign-in action to the FTP/S endpoint for the app. |
34 | 45 |
|
35 | 46 | # [Azure PowerShell](#tab/powershell)
|
36 | 47 |
|
37 |
| -You can't configure the user-scope credentials by using Azure PowerShell. Use a different method, or consider [using application-scope credentials](#appscope). |
| 48 | +You can't create user-scope credentials by using Azure PowerShell. Use Azure CLI or the Azure portal to create the credentials instead. To deploy to FTP/S or local Git, you can use app-scope credentials. |
38 | 49 |
|
39 | 50 | # [Azure portal](#tab/portal)
|
40 | 51 |
|
41 |
| -You can configure your user-scope credentials in any app's [resource page](../azure-resource-manager/management/manage-resources-portal.md#manage-resources). Regardless of which app you use to configure these credentials, the credentials apply to all apps for all subscriptions in your Azure account. |
42 |
| - |
43 |
| - You must have at least one app in the [Azure portal](https://portal.azure.com) before you can access the deployment credentials page. To configure your user-scope credentials: |
| 52 | +You must have at least one app to use for setting user-scope deployment credentials in the [Azure portal](https://portal.azure.com). You can set the credentials in any app that has **SCM Basic Auth** and **FTP Basic Auth** enabled. The credentials then apply to all apps for all subscriptions in your Azure account that have **SCM Basic Auth** and **FTP Basic Auth** enabled. |
44 | 53 |
|
45 |
| -1. From the left menu of your app, select > **Deployment Center** > **FTPS credentials** or **Local Git/FTPS credentials**. |
| 54 | +To configure deployment credentials: |
46 | 55 |
|
47 |
| -2. Scroll down to **User scope**, configure the **Username** and **Password**, and then select **Save**. |
| 56 | +1. Select **Deployment Center** under **Deployment** in the left navigation menu of an app. |
| 57 | +1. If **Local Git** is configured as the build source, select the **Local Git/FTPS credentials** tab. Otherwise, select the **FTPS credentials** tab. |
| 58 | +1. In the **User-scope** section, add a **Username**. For local Git deployments, the user name can't contain the `@` character. |
| 59 | +1. For FTP/S deployments, add and confirm a **Password**. The password must be at least eight characters and contain contain capital letters, lowercase letters, numbers, and symbols. |
| 60 | +1. Select **Save**. |
48 | 61 |
|
49 |
| -After you set your deployment credentials, you can find the Git deployment username in your app's **Overview** page. |
| 62 | +After you set the credentials, you can see your deployment user name on your app's **Overview** page. If local Git deployment is configured, the label is **Git/deployment username**. Otherwise, the label is **FTP/deployment username**. The page doesn't show the password. |
50 | 63 |
|
51 | 64 | 
|
52 | 65 |
|
53 |
| -If Git deployment is configured, the page shows **Git/deployment username**. Otherwise, it shows **FTP/deployment username**. |
| 66 | +----- |
54 | 67 |
|
55 |
| -> [!NOTE] |
56 |
| -> Azure doesn't show your user-scope deployment password. If you forget the password, you can follow the steps in this section to reset your credentials. |
| 68 | +### Deploy to FTP/S with user-scope credentials |
57 | 69 |
|
58 |
| ------ |
| 70 | +To authenticate to an FTP/S endpoint by using user-scope credentials, you must prepend the user name with the app name in the format `<app-name>\<user-name>`. Since user-scope credentials are linked to the user and not to the app, the username must be in this format to direct the sign-in action to the correct FTP/S endpoint for the app. |
59 | 71 |
|
60 |
| -## Use user-scope credentials with FTP/FTPS |
| 72 | +<a name="appscope"></a> |
| 73 | +## Get application-scope credentials |
61 | 74 |
|
62 |
| -To authenticate to an FTP/FTPS endpoint by using user-scope credentials, your username must follow this format: |
63 |
| -`<app-name>\<user-name>` |
| 75 | +The application-scope credentials are automatically created. The FTP/S app-scope user name always follows the format `app-name\$app-name`. The local Git user name follows the format `$app-name`. |
64 | 76 |
|
65 |
| -Since user-scope credentials are linked to the user and not to a specific resource, the username must be in this format to direct the sign-in action to the right app endpoint. |
| 77 | +>[!NOTE] |
| 78 | +>When you use `git remote add` in shells that use the dollar sign for variable interpolation, such as Bash, you must escape any dollar signs in the username or password by using `\$`, to avoid authentication errors. |
66 | 79 |
|
67 |
| -## <a name="appscope"></a>Get application-scope credentials |
| 80 | +You can get your app-scope credentials by using Azure CLI, Azure PowerShell, or the Azure portal. |
68 | 81 |
|
69 | 82 | # [Azure CLI](#tab/cli)
|
70 | 83 |
|
71 | 84 | Get the application-scope credentials by using the [`az webapp deployment list-publishing-profiles`](/cli/azure/webapp/deployment#az-webapp-deployment-list-publishing-profiles) command. For example:
|
72 | 85 |
|
73 | 86 | ```azurecli-interactive
|
74 |
| -az webapp deployment list-publishing-profiles --resource-group <group-name> --name <app-name> |
| 87 | +az webapp deployment list-publishing-profiles --resource-group myResourceGroup --name myApp |
75 | 88 | ```
|
76 | 89 |
|
77 |
| -For [local Git deployment](deploy-local-git.md), you can also use the [`az webapp deployment list-publishing-credentials`](/cli/azure/webapp/deployment#az-webapp-deployment-list-publishing-credentials) command. When you use this command, you get a Git remote URI for your app that has the application-scope credentials already embedded. For example: |
| 90 | +For [local Git deployment](deploy-local-git.md), you can also use the [`az webapp deployment list-publishing-credentials`](/cli/azure/webapp/deployment#az-webapp-deployment-list-publishing-credentials) command. The following example returns a Git remote URI that has the application-scope credentials for the app already embedded. |
78 | 91 |
|
79 | 92 | ```azurecli-interactive
|
80 |
| -az webapp deployment list-publishing-credentials --resource-group <group-name> --name <app-name> --query scmUri |
| 93 | +az webapp deployment list-publishing-credentials --resource-group myResourceGroup --name myApp --query scmUri |
81 | 94 | ```
|
82 | 95 |
|
83 |
| -> [!NOTE] |
84 |
| -> The returned Git remote URI doesn't contain `/<app-name>.git` at the end. When you add the remote URI, make sure to append `/<app-name>.git` to avoid an error 22 with `git-http-push`. Additionally, when using `git remote add ... ` via shells that use the dollar sign for variable interpolation (such as bash), escape any dollar signs `\$` in the username or password. Failure to escape this character can result in authentication errors. |
| 96 | +The returned Git remote URI doesn't have `/<app-name>.git` at the end. When you add a remote, append `/<app-name>.git` to the URI to avoid an error `22` with `git-http-push`. |
85 | 97 |
|
86 | 98 | # [Azure PowerShell](#tab/powershell)
|
87 | 99 |
|
88 | 100 | Get the application-scope credentials by using the [`Get-AzWebAppPublishingProfile`](/powershell/module/az.websites/get-azwebapppublishingprofile) command. For example:
|
89 | 101 |
|
90 | 102 | ```azurepowershell-interactive
|
91 |
| -Get-AzWebAppPublishingProfile -ResourceGroupName <group-name> -Name <app-name> |
| 103 | +Get-AzWebAppPublishingProfile -ResourceGroupName myResourceGroup -Name myApp |
92 | 104 | ```
|
93 | 105 |
|
94 | 106 | # [Azure portal](#tab/portal)
|
95 | 107 |
|
96 |
| -1. From the left menu of your app, select **Deployment Center** > **FTPS credentials** or **Local Git/FTPS credentials**. |
| 108 | +To get the application-scope credentials: |
97 | 109 |
|
98 |
| -2. In the **Application scope** section, select the **Copy** link to copy the username or password. |
| 110 | +1. In the Azure portal, select **Deployment Center** under **Deployment** in the left navigation menu of your app. |
| 111 | +1. On the **Deployment Center** page, select the **FTPS credentials** or **Local Git/FTPS credentials** tab. |
| 112 | +1. In the **Application-scope** section, view the **FTPS username**, the **Local Git username**, and the **Password**. Select the copy icons to copy the values. |
99 | 113 |
|
100 | 114 | -----
|
101 | 115 |
|
102 | 116 | ## Reset application-scope credentials
|
103 | 117 |
|
| 118 | +You can use Azure CLI, Azure PowerShell, or the Azure portal to reset your application-scope deployment credentials and get a new password. The app-scope user names remain at their autogenerated values. |
| 119 | + |
| 120 | +In Azure CLI and the Azure portal, you can also reset your user-scope credentials by creating new ones. This action affects all the apps in your account that use the user-scope credentials. |
| 121 | + |
| 122 | +When you reset your deployment credentials, any external integrations and automation stop working and must be reconfigured with the new values. |
| 123 | + |
104 | 124 | # [Azure CLI](#tab/cli)
|
105 | 125 |
|
106 |
| -Reset the application-scope credentials by using the [`az resource invoke-action`](/cli/azure/resource#az-resource-invoke-action) command: |
| 126 | +Reset the application-scope password by using the [`az resource invoke-action`](/cli/azure/resource#az-resource-invoke-action) command. |
107 | 127 |
|
108 | 128 | ```azurecli-interactive
|
109 | 129 | az resource invoke-action --action newpassword --resource-group <group-name> --name <app-name> --resource-type Microsoft.Web/sites
|
110 | 130 | ```
|
111 | 131 |
|
| 132 | +Reset the user-scope credentials by rerunning the [`az webapp deployment user set`](/cli/azure/webapp/deployment/user#az-webapp-deployment-user-set) command, supplying new user name and password values. |
| 133 | + |
| 134 | +```azurecli-interactive |
| 135 | +az webapp deployment user set --user-name <new-username> --password <new-password> |
| 136 | +``` |
| 137 | + |
112 | 138 | # [Azure PowerShell](#tab/powershell)
|
113 | 139 |
|
114 |
| -Reset the application-scope credentials by using the [`Invoke-AzResourceAction`](/powershell/module/az.resources/invoke-azresourceaction) command: |
| 140 | +Reset the application-scope password by using the [`Invoke-AzResourceAction`](/powershell/module/az.resources/invoke-azresourceaction) command: |
115 | 141 |
|
116 | 142 | ```azurepowershell-interactive
|
117 | 143 | Invoke-AzResourceAction -ResourceGroupName <group-name> -ResourceType Microsoft.Web/sites -ResourceName <app-name> -Action newpassword
|
118 | 144 | ```
|
119 | 145 |
|
120 | 146 | # [Azure portal](#tab/portal)
|
121 | 147 |
|
122 |
| -1. From the left menu of your app, select **Deployment Center** > **FTPS credentials** or **Local Git/FTPS credentials**. |
123 |
| - |
124 |
| -2. In the **Application scope** section, select **Reset**. |
| 148 | +1. From the left navigation menu of your app, select **Deployment Center** > **FTPS credentials** or **Local Git/FTPS credentials**. |
| 149 | +1. To reset your app-scope credentials and get a new password, select **Reset** at the bottom of the **Application-scope** section. |
| 150 | +1. To reset your user-scope credentials, select **Reset** at the bottom of the **User-scope** section. This action deletes both user name and password, and disables user-scope credentials. To reenable, enter a new username and password, and select **Save**. This action takes effect across all the apps in your account that use the user-scope credentials. |
125 | 151 |
|
126 | 152 | -----
|
127 | 153 |
|
128 |
| -## Disable basic authentication |
129 |
| - |
130 |
| -See [Disable basic authentication in App Service deployment](configure-basic-auth-disable.md). |
131 |
| - |
132 | 154 | ## Related content
|
133 | 155 |
|
134 |
| -Find out how to use these credentials to deploy your app from a [local Git](deploy-local-git.md) or by using [FTP/FTPS](deploy-ftp.md). |
| 156 | +- [Disable basic authentication in Azure App Service deployments](configure-basic-auth-disable.md) |
| 157 | +- [Deploy to Azure App Service by using local Git](deploy-local-git.md) |
| 158 | +- [Deploy your app to Azure App Service using FTP/S](deploy-ftp.md). |
0 commit comments