Skip to content

Commit 1c37c1c

Browse files
chkp-natanelmchkp-noamcohchkp-eddiekchkp-avivm
authored
Adding Readme.md file for Azure onboarding script (#503)
Co-authored-by: noamcoh <noamcoh@checkpoint.com> Co-authored-by: eddiek <eddiek@checkpoint.com> Co-authored-by: Aviv Meydan <avivm@checkpoint.com>
1 parent 00c0df4 commit 1c37c1c

2 files changed

Lines changed: 100 additions & 1 deletion

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# cgns_onboarding_azure.sh
2+
3+
4+
This script automates onboarding of Azure accounts for the CloudGuard Network Security (CGNS) SaaS application.
5+
6+
## Prerequisites
7+
8+
- Sufficient Azure permissions (Owner permission over the selected subscription or management group for assigning ARM access role and Global Administrator role for creating new Azure application).
9+
10+
## Overview
11+
12+
This script supports onboarding at both the subscription or management group level supporting two modes:
13+
14+
- **Customer-managed (single-tenant):** You create and own a dedicated Azure application and service principal within your tenant.
15+
- **CloudGuard-managed (multi-tenant):** You use a pre-existing CloudGuard-managed Azure application. CloudGuard owns and manages the app registration, while you only assign its service principal to your Azure resources.
16+
17+
18+
For customer-managed (single-tenant) onboarding, the script performs the following steps:
19+
- **Azure Application Registration:** Creates a dedicated Azure application for the customer’s tenant.
20+
- **Service Principal Creation:** Registers a service principal for the newly created application, enabling programmatic access to Azure resources.
21+
- **Role Assignment:** Assigns the necessary Azure roles (such as `Reader` or `Contributor`) to the service principal at the subscription or management group level to ensure CGNS can operate as required.
22+
- **Resource Cleanup (optional, using `--clean` flag):** Removes the application, service principal, and associated role assignments to fully clean up the integration if requested.
23+
24+
For CloudGuard-managed (multi-tenant) onboarding, the script performs the following steps:
25+
- **Service Principal Assignment:** Assigns a service principal for the pre-existing CloudGuard-managed Azure application to the customer’s subscription or management group.
26+
- **Role Assignment:** Ensures the service principal has the required permissions by assigning appropriate roles.
27+
- **Resource Cleanup (optional, using `--clean` flag):** Removes the service principal assignment and revokes permissions when offboarding.
28+
29+
## Features
30+
31+
### Script Support
32+
33+
- Onboarding at both Subscription and Management Group scopes.
34+
- Single-tenant (customer-managed) and multi-tenant (CloudGuard-managed) app registrations.
35+
- Dry-run and quiet modes.
36+
37+
### Script Actions
38+
39+
- Assigns required Azure roles (`Reader`, `Contributor`, `User Access Administrator`).
40+
- Validates user permissions before making changes.
41+
- Optional clean up (delete) of created resources.
42+
43+
## Usage
44+
45+
```sh
46+
./cgns_onboarding_azure.sh [OPTIONS]
47+
```
48+
49+
### Options
50+
51+
- `--scope` **[required]**: Specifies the onboarding scope. Can be either `subscription` or `management-group`.
52+
- `--subscription_id` **[required for subscription scope]**: Azure Subscription ID.
53+
- `--management_group_id` **[required for management-group scope]**: Azure Management Group ID.
54+
- `--onboarding_mode` **[required]**: Onboarding mode for CloudGuard_CGNS. Can be either `read-only`assigns 'Reader' role or `manage` assigns 'Contributor' and 'User Access Administrator'.
55+
- `--multi_tenant_app_id` **[required for CloudGuard-managed (multi-tenant) mode]**: CloudGuard_CGNS Azure application ID (for CloudGuard-managed application).
56+
- `--single_tenant_app_mode` **[required for customer-managed (single-tenant) mode]**: Use customer-managed Azure application registration.
57+
- `--app_name` **[required with --single_tenant_app_mode]**: Name for the Azure AD application.
58+
- `--dry_run` **[optional]**: Run in dry-run mode (no changes will be made).
59+
- `--clean` **[optional]**: Delete all resources created by the script.
60+
- `--quiet` **[optional]**: Suppress user interaction prompts.
61+
- `--help`: Show usage information.
62+
63+
### Example
64+
65+
Onboard a subscription with a new customer-managed application:
66+
67+
```sh
68+
./cgns_onboarding_azure.sh \
69+
--scope subscription \
70+
--subscription_id <SUBSCRIPTION_ID> \
71+
--onboarding_mode manage \
72+
--single_tenant_app_mode true \
73+
--app_name "CloudGuardApp"
74+
```
75+
76+
Onboard using an existing multi-tenant application:
77+
78+
```sh
79+
./cgns_onboarding_azure.sh \
80+
--scope management-group \
81+
--management_group_id <MG_ID> \
82+
--onboarding_mode read-only \
83+
--multi_tenant_app_id <APP_ID>
84+
```
85+
86+
Clean up resources:
87+
88+
```sh
89+
./cgns_onboarding_azure.sh --scope subscription --subscription_id <SUBSCRIPTION_ID> --onboarding_mode "read-only" --single_tenant_app_mode true --clean
90+
```
91+
92+
93+
94+
## Notes
95+
96+
- The script will prompt for confirmation unless `--quiet` is specified.
97+
- Use `--dry_run` to preview actions without making changes.
98+
- Output includes sensitive credentials; handle with care.

cloudguard-network-application/cgns_onboarding_azure.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ usage() {
2626
echo " --onboarding_mode [required] Specifies the onboard mode for CloudGuard_CGNS. Can be either 'read-only' or 'manage' [default: 'read-only']"
2727
echo " --multi_tenant_app_id [optional] Specifies CloudGuard_CGNS Azure application id - for CloudGuard_CGNS application managed"
2828
echo " --single_tenant_app_mode [optional] Specifies CloudGuard_CGNS Azure application - customer app registration handling"
29+
echo " --app_name [required for single tenant app mode] Specifies the name of the application to be created"
2930
echo " --dry_run [optional] Specifies whether to run the script in dry-run mode [default: 'false']"
3031
echo " --clean [optional] Specifies whether to delete all the resources that the script created [default: 'false']"
3132
echo " --quiet [optional] Specifies whether to quiet all the user interactions [default: 'false']"
@@ -451,7 +452,7 @@ validate_user_can_assign_role() {
451452

452453
if validate_user_role_assignment "Owner" "$user_role_assignments"; then
453454
return 0
454-
elif validate_user_role_assignment "Application Administrator" "$user_role_assignments"; then
455+
elif validate_user_role_assignment "User Access Administrator" "$user_role_assignments"; then
455456
return 0
456457
fi
457458

0 commit comments

Comments
 (0)