You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
az role assignment create --assignee <principal-id> --role "Reader" --scope <scope>
89
+
```
90
+
The scope of the role assignement will define if ARI will be able to find resources. It is adviseable to use the subscription/management group that contains everything you want to document.
91
+
92
+
3. Create Federated Credentials
93
+
To log in with the created user-assigned identity, we need to create a federated credential, to be able to use OIDC to connect.
# Issuer will differ if you use GitHub Enterprise server.
102
+
```
103
+
You can also follow the the Microsoft Learn documentation: [MS Learn/Configure a federated identity credential on a user-assigned managed identity](https://learn.microsoft.com/en-gb/entra/workload-id/workload-identity-federation-create-trust-user-assigned-managed-identity?pivots=identity-wif-mi-methods-azp#github-actions-deploying-azure-resources)
104
+
105
+
106
+
4. (Optional) Retrieve identity parameters
107
+
If you forgot to save the output of the user-assigned identity, you can retrieve the necessary fields using the following commands:
108
+
109
+
```bash
110
+
az identity show --name <identity-name> --resource-group <resource-group>
111
+
```
112
+
113
+
5. Set GitHub Secrets
114
+
You can either set GitHub secrets using the online interface, or using GitHub CLI.
115
+
116
+
- If you want to set it using the online graphical interface:
117
+
- In your GitHub repository, go to Settings → Secrets and variables → Actions
118
+
119
+
120
+
- If you want to set it using GitHub CLI:
121
+
- Make sure that you have GitHub CLI installed
122
+
- Create repository secrets using the following template:
123
+
124
+
gh secret set <secret-name> -b <secret-value> -R <owner>/<repo-name>
125
+
126
+
- Set the required secrets:
127
+
-`AZURE_CLIENT_ID`: The client ID from the JSON
128
+
-`AZURE_TENANT_ID`: The tenant ID from the JSON
129
+
-`AZURE_SUBSCRIPTION_ID`: The subscription ID from the JSON
130
+
131
+
## GitHub Action Workflow Template For Service Principal
132
+
133
+
Create a file named `.github/workflows/azure-inventory.yml` in your repository with the following content:
134
+
135
+
```yaml
136
+
name: Azure Resource Inventory
137
+
138
+
on:
139
+
schedule:
140
+
# Run weekly on Monday at 8:00 AM UTC
141
+
- cron: '0 8 * * 1'
142
+
# Allow manual trigger
143
+
workflow_dispatch:
144
+
inputs:
145
+
subscriptionId:
146
+
description: 'Specific subscription ID (optional)'
0 commit comments