|
| 1 | +# Publish and share on Azure |
| 2 | + |
| 3 | +This page describes how to publish Kedro-Viz on Azure to share it with others. It uses the spaceflights tutorial as an example. |
| 4 | + |
| 5 | +## Setup your kedro project |
| 6 | + |
| 7 | +If you haven't installed Kedro {doc}`follow the documentation to get set up<kedro:get_started/install>`. |
| 8 | + |
| 9 | +```{important} |
| 10 | +We recommend that you use the same version of Kedro that was most recently used to test this tutorial (0.19.1). To check the version installed, type `kedro -V` in your terminal window. |
| 11 | +``` |
| 12 | + |
| 13 | +In your terminal window, navigate to the folder you want to store the project. Generate the spaceflights tutorial project with all the code in place by using the [Kedro starter for the spaceflights tutorial](https://github.com/kedro-org/kedro-starters/tree/main/spaceflights-pandas): |
| 14 | + |
| 15 | + |
| 16 | +```bash |
| 17 | +kedro new --starter=spaceflights-pandas |
| 18 | +``` |
| 19 | + |
| 20 | +When prompted for a project name, you can enter anything, but we will assume `Spaceflights` throughout. |
| 21 | + |
| 22 | +When your project is ready, navigate to the root directory of the project. Install the dependencies from the project root directory by typing the following in your terminal: |
| 23 | + |
| 24 | +```bash |
| 25 | +pip install -r requirements.txt |
| 26 | +``` |
| 27 | + |
| 28 | +Kedro-Viz requires specific minimum versions of `fsspec`, and `kedro` to publish your project. Ensure you have these correct versions by updating the `requirements.txt` file of the Kedro project to add the following: |
| 29 | + |
| 30 | +```text |
| 31 | +fsspec>=2023.9.0 |
| 32 | +kedro>=0.18.2 |
| 33 | +``` |
| 34 | + |
| 35 | +## Install cloud dependencies |
| 36 | + |
| 37 | + Step 1: |
| 38 | + |
| 39 | +```bash |
| 40 | +pip install 'kedro-viz[azure]' |
| 41 | +``` |
| 42 | + |
| 43 | +## Configure your Azure Blob Storage |
| 44 | + |
| 45 | +You can host your Kedro-Viz project on Azure Blob Storage. |
| 46 | + |
| 47 | +1. Enable static website hosting - Follow the [Azure tutorial](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to?tabs=azure-portal) to configure static website hosting on Azure Blob Storage. |
| 48 | + |
| 49 | +```{note} |
| 50 | +The process of uploading your site's files will be done through Kedro-Viz. |
| 51 | +``` |
| 52 | + |
| 53 | +2. Register an app: Sign in to the Azure Portal and create an [App Registration](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app). |
| 54 | + |
| 55 | +3. Obtain parameters: In the app registration's overview pane, note down the Application (Client) ID and Directory (Tenant) ID. |
| 56 | + |
| 57 | +4. Add client secret: Create a [client secret](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app#add-a-client-secret) |
| 58 | +for the app registration. |
| 59 | + |
| 60 | +5. Assign IAM role: Assign an [Access Control (IAM) role](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal?tabs=delegate-condition) to the storage account. |
| 61 | + |
| 62 | + |
| 63 | +```{note} |
| 64 | +Kedro-Viz uses Gen2 filesystem protocol `abfs` to write files on AzureBlobStorage. |
| 65 | +``` |
| 66 | + |
| 67 | +```{important} |
| 68 | +Having a `$web` container in your AzureBlobStorage is mandatory to use Kedro-Viz publish and share feature on Azure. For more information, see the official Azure documentation about |
| 69 | +[Setting up a static website](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website#setting-up-a-static-website). |
| 70 | +``` |
| 71 | + |
| 72 | +## Set credentials |
| 73 | + |
| 74 | +Once that's completed, you'll need to set your Azure credentials as environment variables in your terminal window, as shown below: |
| 75 | + |
| 76 | +```bash |
| 77 | +export AZURE_STORAGE_TENANT_ID="your-app-tenant-id" |
| 78 | +export AZURE_STORAGE_CLIENT_ID="your-app-client-id" |
| 79 | +export AZURE_STORAGE_CLIENT_SECRET="your-app-client-secret-value" |
| 80 | +``` |
| 81 | + |
| 82 | +For more information, see the official Azure documentation about [how to work with environmental credentials](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet). |
| 83 | + |
| 84 | + |
| 85 | +## Publish and share the project |
| 86 | + |
| 87 | +Once your cloud storage is configured and the credentials are set, you are now ready to publish and share your Kedro-Viz project. |
| 88 | + |
| 89 | +### Publish and share via Kedro-Viz UI |
| 90 | + |
| 91 | +Start Kedro-Viz by running the following command in your terminal: |
| 92 | + |
| 93 | +```bash |
| 94 | +kedro viz run |
| 95 | +``` |
| 96 | + |
| 97 | +Navigate to the **Publish and share** icon located in the lower-left corner of the application interface. A modal dialog will appear, prompting you to select your hosting platform and provide your bucket name and endpoint link. |
| 98 | + |
| 99 | +Set up endpoint |
| 100 | +--------------- |
| 101 | + |
| 102 | +```{important} |
| 103 | +The endpoint link can be found under **Storage account -> Capabilities -> Static website -> Primary endpoint**. |
| 104 | +``` |
| 105 | + |
| 106 | +Once those details are complete, click **Publish**. A hosted, shareable URL will be returned to you after the process completes. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +### Publish and share via CLI |
| 111 | + |
| 112 | +Use the `kedro viz deploy` command to publish Kedro-Viz on Azure. You can execute the following command from your project's root folder: |
| 113 | + |
| 114 | +```bash |
| 115 | +kedro viz deploy --platform=azure --endpoint=[azure-endpoint] --bucket-name=[azure-bucket-name] |
| 116 | +``` |
| 117 | + |
| 118 | +## Permissions and access control |
| 119 | + |
| 120 | +Kedro-Viz does not manage permissions or access control. Azure manages all permissions and access control. As a user, you have the choice to allow anyone to view your project or restrict access to specific IP addresses, users, or groups. |
| 121 | + |
| 122 | +You can control who can view your visualisation using [attribute-based access control](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-auth-abac). See the official Azure documentation for more information. |
| 123 | + |
| 124 | +## Billing |
| 125 | + |
| 126 | +Kedro-Viz does not handle billing. You pay for storing objects on your AzureBlobStorage. The amount you pay depends on the volume of data stored per month, quantity and types of operations performed, along with any data transfer costs, data redundancy option selected. |
| 127 | + |
| 128 | +See the official [Azure documentation](https://azure.microsoft.com/en-us/pricing/details/storage/blobs/) for more information. |
0 commit comments