Skip to content

Commit 604f0eb

Browse files
authored
Update README.md
1 parent e9a9c1e commit 604f0eb

1 file changed

Lines changed: 11 additions & 26 deletions

File tree

README.md

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ For any credentials like Azure Service Principal, Publish Profile etc add them a
8686
The above example uses user-level credentials i.e., Azure Service Principal for deployment.
8787

8888
Follow the steps to configure the secret:
89-
* Define a new secret under your repository settings, Add secret menu
90-
* Store the output of the below [az cli](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest) command as the value of secret variable, for example 'AZURE_CREDENTIALS'
89+
* Define a new secret variable under your repository **Settings** -> **Secrets** -> **New secret**. Provide a secret variable **Name**, for example 'AZURE_CREDENTIALS'.
90+
* Run the below [az cli](https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest) command and Store the output as the **Value** of the secret variable
91+
* Below *az ad* command scopes the service principal to a specific resource group *{resource-group}* within a specific Azure subscription *{subscription-id}*
9192
```bash
9293

9394
az ad sp create-for-rbac --name "myApp" --role contributor \
@@ -107,33 +108,17 @@ Follow the steps to configure the secret:
107108
}
108109

109110
```
110-
* Now in the workflow file in your branch: `.github/workflows/workflow.yml` replace the secret in Azure login action with your secret (Refer to the example above)
111-
111+
* You can also further scope down the Azure Credentials to a specific Azure resource, for example - a Web App by specifying the path to the specic resource in the *--scopes* attribute. Below script is for scoping the credentials to a web app of name *{app-name}*
112+
```bash
113+
az ad sp create-for-rbac --name "myApp" --role contributor \
114+
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Web/sites/{app-name} \
115+
--sdk-auth
112116

113-
# Azure Login metadata file
117+
# Replace {subscription-id}, {resource-group}, and {app-name} with the names of your subscription, resource group, and Azure Web App.
118+
```
119+
* Now in the workflow file in your branch: `.github/workflows/workflow.yml` replace the secret in Azure login action with your secret (Refer to the example above)
114120

115-
```yaml
116121

117-
# action.yml
118-
119-
# Login to Azure subscription
120-
name: 'Azure Login'
121-
description: 'Authenticate to Azure and run your Az CLI or Az PowerShell based Actions or scripts. github.com/Azure/Actions'
122-
inputs:
123-
creds:
124-
description: 'Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS'
125-
required: true
126-
enable-AzPSSession:
127-
description: 'Set this value to true to enable Azure PowerShell Login in addition to Az CLI login'
128-
required: false
129-
default: false
130-
branding:
131-
icon: 'login.svg'
132-
color: 'blue'
133-
runs:
134-
using: 'node12'
135-
main: 'lib/main.js'
136-
```
137122

138123
# Contributing
139124

0 commit comments

Comments
 (0)