Skip to content

Test ACL Permission Workflow #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/_setAclPermissions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Set ACL Permissions Template

on:
workflow_call:
inputs:
environment:
required: true
type: string
default: "dev"
description: "Specifies the environment of the deployment."
storage_account_name:
required: true
type: string
description: "Specifies the name of the storage account."
storage_container_name:
required: true
type: string
description: "Specifies the name of the storage account container name."
storage_container_path:
required: true
type: string
description: "Specifies the path within the storage account container."
user_object_id:
required: true
type: string
description: "Specifies the object id of the identity that should be granted access."
acl_permissions:
required: true
type: string
description: "Specifies the acl permissions to be granted to the identity (e.g. 'rwx')."
secrets:
TENANT_ID:
required: true
description: "Specifies the tenant id of the deployment."
SUBSCRIPTION_ID:
required: true
description: "Specifies the subscription id of the deployment."
CLIENT_ID:
required: true
description: "Specifies the client id."
CLIENT_SECRET:
required: true
description: "Specifies the client secret."

jobs:
exec:
name: Run Az CLI Command
runs-on: ubuntu-latest # [self-hosted, linux, adp]
continue-on-error: false
environment: "${{ inputs.environment }}"

steps:
# Login to Azure
- name: Azure Login
id: azure_login
uses: azure/login@v1
with:
creds: '{"clientId":"${{ secrets.CLIENT_ID }}","clientSecret":"${{ secrets.CLIENT_SECRET }}","subscriptionId":"${{ secrets.SUBSCRIPTION_ID }}","tenantId":"${{ secrets.TENANT_ID }}"}'

# Grant Access - ACL
- name: Grant Access - ACL
id: access_acl
run: |
echo "Set Azure Context"
az account set -s "${{ secrets.SUBSCRIPTION_ID }}"

echo "Set ACL"
az storage fs access set \
--acl "user::rwx,group::r-x,other::---,mask::rwx,user:$USER_OBJECT_ID:$ACL_PERMISSIONS" \
--path $STORAGE_CONTAINER_PATH \
--file-system $STORAGE_CONTAINER_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--auth-mode login
env:
USER_OBJECT_ID: ${{ inputs.user_object_id }}
ACL_PERMISSIONS: ${{ inputs.acl_permissions }}
STORAGE_ACCOUNT_NAME: ${{ inputs.storage_account_name }}
STORAGE_CONTAINER_NAME: ${{ inputs.storage_container_name }}
STORAGE_CONTAINER_PATH: ${{ inputs.storage_container_path }}

# Log out from Azure
- name: Log out from Azure
id: azure_logout
run: |
az logout
54 changes: 54 additions & 0 deletions .github/workflows/setAclPermissions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Set ACL Permissions
on:
pull_request:
branches:
- main
# workflow_dispatch:
# inputs:
# environment:
# required: true
# description: 'Read environment for which the Terraform state shall be unlocked.'
# type: choice
# options:
# - dev
# - tst
# - prp
# - prd
# default: core_dev
# storage_account_name:
# required: true
# type: string
# description: "Specifies the name of the storage account."
# storage_container_name:
# required: true
# type: string
# description: "Specifies the name of the storage account container name."
# storage_container_path:
# required: true
# type: string
# description: "Specifies the path within the storage account container."
# user_object_id:
# required: true
# type: string
# description: "Specifies the object id of the identity that should be granted access."
# acl_permissions:
# required: true
# type: string
# description: "Specifies the acl permissions to be granted to the identity (e.g. 'rwx')."

jobs:
set_acl:
uses: ./.github/workflows/_setAclPermissions.yml
name: "Set ACL Permissions"
with:
environment: "dev" # "${{ inputs.environment }}"
storage_account_name: "mabussadls001" # "${{ inputs.storage_account_name }}"
storage_container_name: "testsetacl" # "${{ inputs.storage_container_name }}"
storage_container_path: "/" # "${{ inputs.storage_container_path }}"
user_object_id: "c1b9add1-e5cb-47c7-aa95-be63e1d5fd11" # "${{ inputs.user_object_id }}"
acl_permissions: "rwx" # "${{ inputs.acl_permissions }}"
secrets:
TENANT_ID: ${{ secrets.TENANT_ID }}
SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
Loading