{"id":26547091,"url":"https://github.com/samlopezdev/skills-deploy-to-azure","last_synced_at":"2026-04-06T08:02:08.927Z","repository":{"id":268999880,"uuid":"906116757","full_name":"samlopezdev/skills-deploy-to-azure","owner":"samlopezdev","description":"My clone repository","archived":false,"fork":false,"pushed_at":"2024-12-22T00:45:48.000Z","size":228,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T05:29:08.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samlopezdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-20T07:45:53.000Z","updated_at":"2024-12-22T00:45:51.000Z","dependencies_parsed_at":"2024-12-20T08:41:14.542Z","dependency_job_id":null,"html_url":"https://github.com/samlopezdev/skills-deploy-to-azure","commit_stats":null,"previous_names":["samlopezdev/skills-deploy-to-azure"],"tags_count":0,"template":false,"template_full_name":"skills/deploy-to-azure","purl":"pkg:github/samlopezdev/skills-deploy-to-azure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlopezdev%2Fskills-deploy-to-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlopezdev%2Fskills-deploy-to-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlopezdev%2Fskills-deploy-to-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlopezdev%2Fskills-deploy-to-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samlopezdev","download_url":"https://codeload.github.com/samlopezdev/skills-deploy-to-azure/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlopezdev%2Fskills-deploy-to-azure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31464115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T05:29:11.937Z","updated_at":"2026-04-06T08:02:08.912Z","avatar_url":"https://github.com/samlopezdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cheader\u003e\n\n\u003c!--\n  \u003c\u003c\u003c Author notes: Course header \u003e\u003e\u003e\n  Include a 1280x640 image, course title in sentence case, and a concise description in emphasis.\n  In your repository settings: enable template repository, add your 1280x640 social image, auto delete head branches.\n  Add your open source license, GitHub uses MIT license.\n--\u003e\n\n# Deploy to Azure\n\n_Create two deployment workflows using GitHub Actions and Microsoft Azure._\n\n\u003c/header\u003e\n\n\u003c!--\n  \u003c\u003c\u003c Author notes: Step 2 \u003e\u003e\u003e\n  Start this step by acknowledging the previous step.\n  Define terms and link to docs.github.com.\n--\u003e\n\n## Step 2: Set up an Azure environment\n\n_Good job getting started :gear:_\n\n### Nice work triggering a job on specific labels\n\nWe won't be going into detail on the steps of this workflow, but it would be a good idea to become familiar with the actions we're using. They are:\n\n- [`actions/checkout`](https://github.com/actions/checkout)\n- [`actions/upload-artifact`](https://github.com/actions/upload-artifact)\n- [`actions/download-artifact`](https://github.com/actions/download-artifact)\n- [`docker/login-action`](https://github.com/docker/login-action)\n- [`docker/build-push-action`](https://github.com/docker/build-push-action)\n- [`azure/login`](https://github.com/Azure/login)\n- [`azure/webapps-deploy`](https://github.com/Azure/webapps-deploy)\n\n### :keyboard: Activity 1: Store your credentials in GitHub secrets and finish setting up your workflow\n\n1.  In a new tab, [create an Azure account](https://azure.microsoft.com/en-us/free/) if you don't already have one. If your Azure account is created through work, you may encounter issues accessing the necessary resources -- we recommend creating a new account for personal use and for this course.\n    \u003e **Note**: You may need a credit card to create an Azure account. If you're a student, you may also be able to take advantage of the [Student Developer Pack](https://education.github.com/pack) for access to Azure. If you'd like to continue with the course without an Azure account, Skills will still respond, but none of the deployments will work.\n1.  Create a [new subscription](https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/create-subscription) in the Azure Portal.\n    \u003e **Note**: your subscription must be configured \"Pay as you go\" which will require you to enter billing information. This course will only use a few minutes from your free plan, but Azure requires the billing information.\n1.  Install [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) on your machine.\n1.  In your terminal, run:\n    ```shell\n    az login\n    ```\n1.  Select the subscription you just selected from the interactive authentication prompt. Copy the value of the subscription ID to a safe place. We'll call this `AZURE_SUBSCRIPTION_ID`. Here's an example of what it looks like:\n    ```shell\n    No     Subscription name    Subscription ID                       Tenant\n    -----  -------------------  ------------------------------------  -----------------\n    [1] *  some-subscription    f****a09-****-4d1c-98**-f**********c  Default Directory\n    ```\n1.  In your terminal, run the command below.\n\n    ```shell\n    az ad sp create-for-rbac --name \"GitHub-Actions\" --role contributor \\\n     --scopes /subscriptions/{subscription-id} \\\n     --sdk-auth\n\n        # Replace {subscription-id} with the same id stored in AZURE_SUBSCRIPTION_ID.\n    ```\n\n    \u003e **Note**: The `\\` character works as a line break on Unix based systems. If you are on a Windows based system the `\\` character will cause this command to fail. Place this command on a single line if you are using Windows.\n\n1.  Copy the entire contents of the command's response, we'll call this `AZURE_CREDENTIALS`. Here's an example of what it looks like:\n    ```shell\n    {\n      \"clientId\": \"\u003cGUID\u003e\",\n      \"clientSecret\": \"\u003cGUID\u003e\",\n      \"subscriptionId\": \"\u003cGUID\u003e\",\n      \"tenantId\": \"\u003cGUID\u003e\",\n      (...)\n    }\n    ```\n1.  Back on GitHub, click on this repository's **Secrets and variables \u003e Actions** in the Settings tab.\n1.  Click **New repository secret**\n1.  Name your new secret **AZURE_SUBSCRIPTION_ID** and paste the value from the `id:` field in the first command.\n1.  Click **Add secret**.\n1.  Click **New repository secret** again.\n1.  Name the second secret **AZURE_CREDENTIALS** and paste the entire contents from the second terminal command you entered.\n1.  Click **Add secret**\n1.  Go back to the Pull requests tab and in your pull request go to the **Files Changed** tab. Find and then edit the `.github/workflows/deploy-staging.yml` file to use some new actions. The full workflow file, should look like this:\n    ```yaml\n    name: Deploy to staging\n\n    on:\n      pull_request:\n        types: [labeled]\n\n    env:\n      IMAGE_REGISTRY_URL: ghcr.io\n      ###############################################\n      ### Replace \u003cusername\u003e with GitHub username ###\n      ###############################################\n      DOCKER_IMAGE_NAME: \u003cusername\u003e-azure-ttt\n      AZURE_WEBAPP_NAME: \u003cusername\u003e-ttt-app\n      ###############################################\n\n    jobs:\n      build:\n        if: contains(github.event.pull_request.labels.*.name, 'stage')\n\n        runs-on: ubuntu-latest\n\n        steps:\n          - uses: actions/checkout@v4\n          - uses: actions/setup-node@v4\n            with:\n              node-version: 16\n          - name: npm install and build webpack\n            run: |\n              npm install\n              npm run build\n          - uses: actions/upload-artifact@v4\n            with:\n              name: webpack artifacts\n              path: public/\n\n      Build-Docker-Image:\n        runs-on: ubuntu-latest\n        needs: build\n        name: Build image and store in GitHub Container Registry\n        steps:\n          - name: Checkout\n            uses: actions/checkout@v4\n\n          - name: Download built artifact\n            uses: actions/download-artifact@v4\n            with:\n              name: webpack artifacts\n              path: public\n\n          - name: Log in to GHCR\n            uses: docker/login-action@v3\n            with:\n              registry: ${{ env.IMAGE_REGISTRY_URL }}\n              username: ${{ github.actor }}\n              password: ${{ secrets.CR_PAT }}\n\n          - name: Extract metadata (tags, labels) for Docker\n            id: meta\n            uses: docker/metadata-action@v5\n            with:\n              images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}\n              tags: |\n                type=sha,format=long,prefix=\n\n          - name: Build and push Docker image\n            uses: docker/build-push-action@v5\n            with:\n              context: .\n              push: true\n              tags: ${{ steps.meta.outputs.tags }}\n              labels: ${{ steps.meta.outputs.labels }}\n\n      Deploy-to-Azure:\n        runs-on: ubuntu-latest\n        needs: Build-Docker-Image\n        name: Deploy app container to Azure\n        steps:\n          - name: \"Login via Azure CLI\"\n            uses: azure/login@v2\n            with:\n              creds: ${{ secrets.AZURE_CREDENTIALS }}\n\n          - uses: azure/docker-login@v1\n            with:\n              login-server: ${{env.IMAGE_REGISTRY_URL}}\n              username: ${{ github.actor }}\n              password: ${{ secrets.CR_PAT }}\n\n          - name: Deploy web app container\n            uses: azure/webapps-deploy@v3\n            with:\n              app-name: ${{env.AZURE_WEBAPP_NAME}}\n              images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}:${{ github.sha }}\n\n          - name: Azure logout via Azure CLI\n            uses: azure/CLI@v2\n            with:\n              inlineScript: |\n                az logout\n                az cache purge\n                az account clear\n    ```\n1. After you've edited the file, click **Commit changes...** and commit to the `staging-workflow` branch.\n1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.\n\n\u003cfooter\u003e\n\n\u003c!--\n  \u003c\u003c\u003c Author notes: Footer \u003e\u003e\u003e\n  Add a link to get support, GitHub status page, code of conduct, license link.\n--\u003e\n\n---\n\nGet help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/deploy-to-azure) \u0026bull; [Review the GitHub status page](https://www.githubstatus.com/)\n\n\u0026copy; 2023 GitHub \u0026bull; [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) \u0026bull; [MIT License](https://gh.io/mit)\n\n\u003c/footer\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamlopezdev%2Fskills-deploy-to-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamlopezdev%2Fskills-deploy-to-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamlopezdev%2Fskills-deploy-to-azure/lists"}