Tag: Azure

  • Azure: deploy multiple websites from a single solution

    Azure: deploy multiple websites from a single solution

    A typically used scenario is to have a solution with two or more web apps. This might be a website project followed by one or more Web API projects.

    1. Create a Resource Group.
    2. Add a Web App for each website being deployed.
    3. For each web app –
      1. Within Application Settings for each web-app add a new setting:
        1. Name: PROJECT
        2. Value: [foldername]/[projectname].csproj
      2. Configure a deployment strategy, for example; using Github

    When you commit your code (or your chosen deployment strategy is triggered) all the Azure web apps will deploy their respective projects.

  • Azure DevOps – Move a Git repo between projects

    Azure DevOps – Move a Git repo between projects

    There are many situations where you want to make a copy of a repository…

    • You’ve been working on a personal repo and want to share it with work
    • You’re contributing to an open source project and need to fork
    • You’ve been working on a repo that you want to hand-over to a customer

    It’s the last situation that I need to fulfill and the steps are as follows.

    In the source repo;

    1. Create a personal access token (don’t forget to copy it)
    2. Copy the source repo URL

    In the destination repo;

    1. Select Repos
    2. Select the drop down the repo list
    3. Select Import repository
    1. Clone URL = source repo URL
    2. Select the Requires authorization check-box
    3. Username = username of the personal access token created above
    4. Password = generated password of the personal access token created above
    5. Name = name of the destination repo (if different)
    6. Click import

    Once the process is complete you’ll receive an on-screen and email notification.

  • Azure DevOps – Multiple repos in a single project

    Azure DevOps – Multiple repos in a single project

    When you create a new DevOps project, you only get one Git repo. It is possible to create more repos within the project, but not immediately obvious how. There are a couple of options;

    Navigate to Repos, hit the drop down and select Manage repositories

    Or…

    Open the project and go to Project settings| Repositories | New Repository

    Permissions

    You will need CreateRepository permissions to complete this.

  • Free website hosting #2 – Azure Web Apps

    Free website hosting #2 – Azure Web Apps

    In the second part of this series we take a look at the first free web hosting option in Azure – Wep Apps.

    Azure comes with a free hosting tier. This is limited to 1GB and on shared infrastructure, so won’t suit a website needing high performance, however for free hosting this is to be expected.

    In this example we’re going to use the same GitHub repo and webpage created in part-1.

    Step 1: Create an account or login

    If you have an Azure account you can login to the Azure portal using your Microsoft login credentials.

    TIP: Learn more about accounts, subscriptions and logins.

    To create a free account navigate to https://azure.microsoft.com/en-gb/free/ click the Start for free button, and follow the instructions.

    Step 2: Create a web app

    Once you have logged into the portal;

    1. Select Create a resource | Web | Web App
    2. Complete the fields
      1. App name must be unique within the AzureWebsites domain, not just your account. A red message will appear if this is not correct.
      2. Choose the subscription where you want the resource saved.
      3. You are going to host a static website, so you can use Windows or Linux
      4. Publish should be set to Code

    Step 2b: Create a free service plan

    This is the important bit: the App service plan must be F1 (free).

    1. Select App Service plan | Create new
    2. Enter an App Service plan name and select a suitable location.
    3. Click Pricing tier, then under the Dev/Test tab select F1 then click Apply
    4. Click OK to create the new App Service plan.
    5. Click Create to create the web app

    To find your new website, click on Home. The website should be at the top of your recent resources list.

    Step 3: Add auto-deployment from Git

    This step will work from any Git repository, not just GitHub. However GitHub and Azure are both managed by Microsoft, so this feels like a sensible choice.

    • Open the website blade then select Deployment Center
    • On the first page (1 – Source Control) a list of available source options are available. Subsequent steps will reflect the choice made here. We’ll use the same source code from part 1, so select GitHub. You will need to authorise your subscription to access GitHub if you have not already done so.
    • Click Continue
    • Step 2 (Build Provider), select App Service Kudu build server
    • Step 3 (Configure) select the suitable Organisation, Repository and Branch names.
    • Step 4 (Summary), click Continue and the deployment will start.
    Toast notifications during deployment
    • Once complete a message will be displayed.
    Status update after deployment
    • The website can be access by typing the URL, or from the resource home page Browse button.

    Browse with the URL or the link

    Done!

    Hello free world!

    Summary

    In summary this approach is no-where near as easy as the steps in part-1. It’s not to say that this is difficult, just that GitHub pages is so simple. Most of the complexity for this site is in the creation of resource groups – and this can be confusing for beginners.

    Also, the evolution of the Azure Cloud is moving at such an incredibly fast pace, it can be intimidating or daunting for developers to step in. Fears of features being here-today and gone-tomorrow are quite real – although websites feel pretty safe.

    That said, free sites within an Azure website offer far more than just static website hosting. Within this same application you can also host an application with server-side code support (ASP.NET, PHP etc).

    Next up – Part 3 – Firebase