This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Authentication must be handled by the app, due to GitHub limitations (#9
- Loading branch information
Stefan Kürzeder
authored
Sep 6, 2021
1 parent
35d831f
commit 9bae2e9
Showing
14 changed files
with
89 additions
and
220 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,11 @@ A GitHub Action to deploy ARM templates. | |
## Dependencies | ||
|
||
* [Checkout](https://github.com/actions/checkout) To checks-out your repository so the workflow can access any specified ARM template. | ||
* [Azure/Login](https://github.com/Azure/login) To authenticate with Azure. | ||
|
||
## Inputs | ||
* `creds` **Required** | ||
[Create Service Principal for Authentication](#Create-Service-Principal-for-Authentication) | ||
|
||
* `templateLocation` **Required** | ||
Specify the path to the Azure Resource Manager template. | ||
(See [assets/json/template.json](test/template.json)) | ||
|
@@ -45,15 +47,34 @@ Additionally are the following outputs available: | |
## Usage | ||
|
||
```yml | ||
- uses: whiteducksoftware/azure-arm-action@v3.3 | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: <YourResourceGroup> | ||
templateLocation: <path/to/azuredeploy.json> | ||
deploymentName: <Deployment base name> | ||
``` | ||
## Example | ||
## Create Service Principal for Authentication | ||
The Service Principal can be easily generated using the Azure CLI. Using the following command will create the SP in the supported structure. | ||
At Subscription Scope: `az ad sp create-for-rbac --name "azure-arm-action" --role contributor --scopes=/subscriptions/********-****-****-****-************/ --sdk-auth -o json` | ||
The JSON, which shall be used for authentication, should be in the following format: | ||
```json | ||
{ | ||
"clientId": "********-****-****-****-************", | ||
"clientSecret": "[*]", | ||
"subscriptionId": "********-****-****-****-************", | ||
"tenantId": "********-****-****-****-************", | ||
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com", | ||
"resourceManagerEndpointUrl": "https://management.azure.com/", | ||
"activeDirectoryGraphResourceId": "https://graph.windows.net/", | ||
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", | ||
"galleryEndpointUrl": "https://gallery.azure.com/", | ||
"managementEndpointUrl": "https://management.core.windows.net/" | ||
} | ||
``` | ||
|
||
## Example | ||
```yml | ||
on: [push] | ||
name: ARMActionSample | ||
|
@@ -63,14 +84,9 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Login to Azure | ||
uses: Azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- uses: whiteducksoftware/[email protected] | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: <YourResourceGroup> | ||
templateLocation: <path/to/azuredeploy.json> | ||
parameters: <path/to/parameters.json> OR <KEY=VALUE> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,10 @@ Our template has two outputs `location` and `containerName`. But we are only int | |
|
||
## Steps | ||
```yaml | ||
- name: Login to Azure | ||
uses: Azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
``` | ||
As first step we need to authenticate with Azure. | ||
```yaml | ||
- uses: whiteducksoftware/[email protected] | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
id: deploy | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: azurearmaction | ||
templateLocation: examples/template/template.json | ||
parameters: examples/template/parameters.json | ||
|
@@ -42,9 +36,10 @@ we can see that on the console will be `github-action` printed. | |
|
||
Now we add our second deployment which relies on that value and modfies the `containerName` parameter, | ||
```yaml | ||
- uses: whiteducksoftware/azure-arm-action@v3.3 | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
id: deploy2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: azurearmaction | ||
templateLocation: examples/template/template.json | ||
parameters: examples/template/parameters.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,21 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Login to Azure | ||
uses: Azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- uses: whiteducksoftware/[email protected] | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
id: deploy | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: azurearmaction | ||
templateLocation: examples/template/template.json | ||
parameters: examples/template/parameters.json | ||
deploymentName: github-advanced-test | ||
|
||
- run: echo ${{ steps.deploy.outputs.containerName }} | ||
|
||
- uses: whiteducksoftware/azure-arm-action@v3.3 | ||
- uses: whiteducksoftware/azure-arm-action@master | ||
id: deploy2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
resourceGroupName: azurearmaction | ||
templateLocation: examples/template/template.json | ||
parameters: examples/template/parameters.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.