Skip to content

Commit 1b02089

Browse files
committed
Test ACL Permission Workflow
1 parent 2257d09 commit 1b02089

File tree

2 files changed

+139
-0
lines changed

2 files changed

+139
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Set ACL Permissions Template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
default: "dev"
10+
description: "Specifies the environment of the deployment."
11+
storage_account_name:
12+
required: true
13+
type: string
14+
description: "Specifies the name of the storage account."
15+
storage_container_name:
16+
required: true
17+
type: string
18+
description: "Specifies the name of the storage account container name."
19+
storage_container_path:
20+
required: true
21+
type: string
22+
description: "Specifies the path within the storage account container."
23+
user_object_id:
24+
required: true
25+
type: string
26+
description: "Specifies the object id of the identity that should be granted access."
27+
acl_permissions:
28+
required: true
29+
type: string
30+
description: "Specifies the acl permissions to be granted to the identity (e.g. 'rwx')."
31+
secrets:
32+
TENANT_ID:
33+
required: true
34+
description: "Specifies the tenant id of the deployment."
35+
SUBSCRIPTION_ID:
36+
required: true
37+
description: "Specifies the subscription id of the deployment."
38+
CLIENT_ID:
39+
required: true
40+
description: "Specifies the client id."
41+
CLIENT_SECRET:
42+
required: true
43+
description: "Specifies the client secret."
44+
45+
jobs:
46+
exec:
47+
name: Run Az CLI Command
48+
runs-on: [self-hosted, linux, adp]
49+
continue-on-error: false
50+
environment: "${{ inputs.environment }}"
51+
52+
steps:
53+
# Login to Azure
54+
- name: Azure Login
55+
id: azure_login
56+
uses: azure/login@v1
57+
with:
58+
creds: '{"clientId":"${{ secrets.CLIENT_ID }}","clientSecret":"${{ secrets.CLIENT_SECRET }}","subscriptionId":"${{ secrets.SUBSCRIPTION_ID }}","tenantId":"${{ secrets.TENANT_ID }}"}'
59+
60+
# Grant Access - ACL
61+
- name: Grant Access - ACL
62+
id: access_acl
63+
run: |
64+
echo "Set Azure Context"
65+
az account set -s "${{ secrets.SUBSCRIPTION_ID }}"
66+
67+
echo "Set ACL"
68+
az storage fs access set \
69+
--acl "user:$USER_OBJECT_ID:$ACL_PERMISSIONS" \
70+
--path $STORAGE_CONTAINER_PATH \
71+
--file-system $STORAGE_CONTAINER_NAME \
72+
--account-name $STORAGE_ACCOUNT_NAME \
73+
--auth-mode login
74+
env:
75+
USER_OBJECT_ID: ${{ inputs.user_object_id }}
76+
ACL_PERMISSIONS: ${{ inputs.acl_permissions }}
77+
STORAGE_ACCOUNT_NAME: ${{ inputs.storage_account_name }}
78+
STORAGE_CONTAINER_NAME: ${{ inputs.storage_container_name }}
79+
STORAGE_CONTAINER_PATH: ${{ inputs.storage_container_path }}
80+
81+
# Log out from Azure
82+
- name: Log out from Azure
83+
id: azure_logout
84+
run: |
85+
az logout
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Set ACL Permissions
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
# workflow_dispatch:
7+
# inputs:
8+
# environment:
9+
# required: true
10+
# description: 'Read environment for which the Terraform state shall be unlocked.'
11+
# type: choice
12+
# options:
13+
# - dev
14+
# - tst
15+
# - prp
16+
# - prd
17+
# default: core_dev
18+
# storage_account_name:
19+
# required: true
20+
# type: string
21+
# description: "Specifies the name of the storage account."
22+
# storage_container_name:
23+
# required: true
24+
# type: string
25+
# description: "Specifies the name of the storage account container name."
26+
# storage_container_path:
27+
# required: true
28+
# type: string
29+
# description: "Specifies the path within the storage account container."
30+
# user_object_id:
31+
# required: true
32+
# type: string
33+
# description: "Specifies the object id of the identity that should be granted access."
34+
# acl_permissions:
35+
# required: true
36+
# type: string
37+
# description: "Specifies the acl permissions to be granted to the identity (e.g. 'rwx')."
38+
39+
jobs:
40+
set_acl:
41+
uses: ./.github/workflows/_setAclPermissions.yml
42+
name: "Set ACL Permissions"
43+
with:
44+
environment: "dev" # "${{ inputs.environment }}"
45+
storage_account_name: "mabussadls001" # "${{ inputs.storage_account_name }}"
46+
storage_container_name: "testsetacl" # "${{ inputs.storage_container_name }}"
47+
storage_container_path: "/" # "${{ inputs.storage_container_path }}"
48+
user_object_id: "c1b9add1-e5cb-47c7-aa95-be63e1d5fd11" # "${{ inputs.user_object_id }}"
49+
acl_permissions: "rwx" # "${{ inputs.acl_permissions }}"
50+
secrets:
51+
TENANT_ID: ${{ secrets.TENANT_ID }}
52+
SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
53+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
54+
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}

0 commit comments

Comments
 (0)