Skip to content

Commit 57c9318

Browse files
committed
change deploy certificate to use az nginx cli
move from using ARM deployment templates to `az nginx deployment certificate update`. This change prevents the need for contributor level permissions on the resource group of the NGINXaaS deployment.
1 parent 3d6ef3f commit 57c9318

File tree

2 files changed

+10
-81
lines changed

2 files changed

+10
-81
lines changed

github-action/src/deploy-certificate.sh

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ then
6262
exit 1
6363
fi
6464

65-
arm_template_file="nginx-for-azure-certificate-template.json"
66-
67-
#get the ARM template file
68-
wget -O "$arm_template_file" https://raw.githubusercontent.com/nginxinc/nginx-for-azure-deploy-action/a69d33feaa1a8a012ec44c138ca78c6ec4db9f29/src/nginx-for-azure-certificate-template.json
69-
echo "Downloaded the ARM template for synchronizing NGINX certificate."
70-
71-
cat "$arm_template_file"
72-
echo ""
73-
7465
az account set -s "$subscription_id" --verbose
7566

7667
count=$(echo "$certificates" | jq '. | length')
@@ -104,41 +95,34 @@ do
10495
do_nginx_arm_deployment=0
10596
fi
10697

107-
uuid="$(cat /proc/sys/kernel/random/uuid)"
108-
template_file="template-$uuid.json"
109-
template_deployment_name="${nginx_deployment_name:0:20}-$uuid"
110-
111-
cp "$arm_template_file" "$template_file"
112-
11398
echo "Synchronizing NGINX certificate"
11499
echo "Subscription ID: $subscription_id"
115100
echo "Resource group name: $resource_group_name"
116101
echo "NGINXaaS for Azure deployment name: $nginx_deployment_name"
117102
echo "NGINXaaS for Azure Location: $nginx_resource_location"
118-
echo "ARM template deployment name: $template_deployment_name"
119103
echo ""
120104
echo "NGINXaaS for Azure cert name: $nginx_cert_name"
121105
echo "NGINXaaS for Azure cert file location: $nginx_cert_file"
122106
echo "NGINXaaS for Azure key file location: $nginx_key_file"
123107
echo ""
124108

109+
echo "Installing the az nginx extension if not already installed."
110+
az extension add --name nginx --allow-preview true
111+
125112
if [ $do_nginx_arm_deployment -eq 1 ]
126113
then
127114
az_cmd=(
128115
"az"
116+
"nginx"
129117
"deployment"
130-
"group"
118+
"certificate"
131119
"create"
132-
"--name" "$template_deployment_name"
133120
"--resource-group" "$resource_group_name"
134-
"--template-file" "$template_file"
135-
"--parameters"
136-
"name=$nginx_cert_name"
137-
"location=$nginx_resource_location"
138-
"nginxDeploymentName=$nginx_deployment_name"
139-
"certificateVirtualPath=$nginx_cert_file"
140-
"keyVirtualPath=$nginx_key_file"
141-
"keyVaultSecretID=$keyvault_secret"
121+
"--certificate-name" "$nginx_cert_name"
122+
"--deployment-name" "$nginx_deployment_name"
123+
"--certificate-path" "$nginx_cert_file"
124+
"--key-path" "$nginx_key_file"
125+
"--key-vault-secret-id" "$keyvault_secret"
142126
"--verbose"
143127
)
144128
if [[ "$debug" == true ]]; then

github-action/src/nginx-for-azure-certificate-template.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)