Skip to content
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
master
Go to file
Code

Latest commit

* getAzureAccessToken issue

* change in message

* revert

* gitignore

* name change
fa528ed

Git stats

Files

Permalink
Failed to load latest commit information.

README.md

Azure Kubernetes Service set context

This action can be used to set cluster context before other actions like azure/k8s-deploy, azure/k8s-create-secret or any kubectl commands (in script) can be run subsequently in the workflow.

Refer to starter templates to deploy to any Kubernetes cluster on-premise or any cloud including Azure Kubernetes service.

Action inputs

Action inputs Description
creds
Credentials
(Required) Credentials required to authenticate with Azure. Steps to obtain these credentials are provided below
resource-group
Resource group
(Required) Resource group containing the AKS cluster
cluster-name
Cluster name
(Required) Name of the AKS cluster

Example

uses: azure/aks-set-context@v1
    with:
        creds: '${{ secrets.AZURE_CREDENTIALS }}' # Azure credentials
        resource-group: '<resource group name>'
        cluster-name: '<cluster name>'
    id: login

To fetch the credentials required to authenticate with Azure, run the following command:

az ad sp create-for-rbac --sdk-auth

For more details on this command, refer to service principal documentation

This generates a service principal and the output of the above command will be in the following format:

{
  "clientId": "<client id>",
  "clientSecret": "<client secret>",
  "subscriptionId": "<subscription id>",
  "tenantId": "<tenant id>",
  "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/"
}

Add the json output as a secret (let's say with the name AZURE_CREDENTIALS) in the GitHub repository. The example YAML snippet given above showcases how this secret is referenced in the action for specifying the credentials as input to the action.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

About

GitHub Action for setting context before deploying to Kubernetes clusters

Resources

License

Packages

No packages published
You can’t perform that action at this time.