diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..b665022 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +# Find the Dockerfile at this URL +# https://github.com/Azure/azure-functions-docker/blob/dev/host/4/bullseye/amd64/dotnet/dotnet-inproc/dotnet-core-tools.Dockerfile +FROM mcr.microsoft.com/azure-functions/dotnet:4-dotnet6-core-tools + +# Uncomment following lines If you want to enable Development Container Script +# For more details https://github.com/microsoft/vscode-dev-containers/tree/main/script-library + +# Avoid warnings by switching to noninteractive +# ENV DEBIAN_FRONTEND=noninteractive + +# # Comment out these lines if you want to use zsh. + +# ARG INSTALL_ZSH=true +# ARG USERNAME=vscode +# ARG USER_UID=1000 +# ARG USER_GID=$USER_UID + +# RUN apt-get update && curl -ssL https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh -o /tmp/common-script.sh \ +# && /bin/bash /tmp/common-script.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID" \ +# && rm /tmp/common-script.sh \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ff614b4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "Azure Functions & C# - .NET 6 (In-Process)", + "dockerFile": "Dockerfile", + "forwardPorts": [ 7071 ], + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-azuretools.vscode-azurefunctions", + "ms-dotnettools.csharp", + "msazurermtools.azurerm-vscode-tools", + "ms-vscode.azurecli" + ] + } + }, + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "dotnet restore", + + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2d9b43b..86df0e1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -35,7 +35,7 @@ "type": "func", "dependsOn": "build", "options": { - "cwd": "${workspaceFolder}/bin/Debug/netcoreapp3.1" + "cwd": "${workspaceFolder}/bin/Debug/net6.0" }, "command": "host start", "isBackground": true, diff --git a/AzUnzipEverything.csproj b/AzUnzipEverything.csproj index ab9f671..cc881b4 100644 --- a/AzUnzipEverything.csproj +++ b/AzUnzipEverything.csproj @@ -1,14 +1,14 @@ - + - netcoreapp3.1 - v3 + net6.0 + v4 - - - - + + + + diff --git a/AzUnzipEverything.sln b/AzUnzipEverything.sln index e033d57..0afeafc 100644 --- a/AzUnzipEverything.sln +++ b/AzUnzipEverything.sln @@ -1,25 +1,22 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30204.135 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzUnzipEverything", "AzUnzipEverything.csproj", "{88137D1E-E332-4073-A07C-27692C4F5749}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {88137D1E-E332-4073-A07C-27692C4F5749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88137D1E-E332-4073-A07C-27692C4F5749}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88137D1E-E332-4073-A07C-27692C4F5749}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88137D1E-E332-4073-A07C-27692C4F5749}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C3E177E5-CCEA-492B-B663-CF7DB1E7CC4D} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzUnzipEverything", "AzUnzipEverything.csproj", "{0ECE792A-7052-4599-8823-9306BC0860A4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0ECE792A-7052-4599-8823-9306BC0860A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0ECE792A-7052-4599-8823-9306BC0860A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0ECE792A-7052-4599-8823-9306BC0860A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0ECE792A-7052-4599-8823-9306BC0860A4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/AzUnzipEverything.sln.DotSettings b/AzUnzipEverything.sln.DotSettings deleted file mode 100644 index 91c941d..0000000 --- a/AzUnzipEverything.sln.DotSettings +++ /dev/null @@ -1,3 +0,0 @@ - - True - True \ No newline at end of file diff --git a/README.md b/README.md index 0e0113a..9d5d515 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The following features are supported in this current version: To deploy all the resources in your Azure subscription, just click on the **Deploy to Azure** button - + Fill-up the form and voila! It will be automatically deployed in your Azure subscription. If you don't own an Azure subscription already, you can create your **free** account today. It comes with 200$ credit, so you can experience almost everything without spending a dime. [Create your free Azure account today](https://azure.microsoft.com/free?WT.mc_id=dotnet-0000-frbouche) @@ -48,6 +48,15 @@ Once [deployed](https://github.com/FBoucher/AzUnzipEverything#how-to-deploy), op 1. After a few second the files you uploaded will be Unzipped into the blob storage container **output-files**. +## Run Locally & DevContainer + +You can run the Azure Function locally or in a dev Container (files provided in folder .devcontainer). +You will need: +- a `local.settings.json` file at the root. You can renamed and update local.settings.example.json or use it as template. +- a storage account in Azure or using the emulator +- a KeyVault with a secret `ZipPassword`. + + ## Continuous Integration (CI) As you can see by the status badge [![Build Status](https://dev.azure.com/cloud5mins/AzUnzipEverything/_apis/build/status/FBoucher.AzUnzipEverything?branchName=main)](https://dev.azure.com/cloud5mins/AzUnzipEverything/_build/latest?definitionId=23&branchName=main) at the top of the page this project is automatically build at every push. @@ -65,15 +74,6 @@ In this video, I show you how to write an Azure Resource Manager (#ARM) template There is also a **written version** if you prefer reading: http://www.frankysnotes.com/2019/07/four-ways-to-deploy-your-azure-function.html - -## TODOs - -A GitKraken [Glo board](https://app.gitkraken.com/glo/board/XRYx_9FgZwAVbri7) is also available. - -- [X] Add Support for .rar (Thank you @mreyeros) -- [X] Add ARM template -- [X] Add a Deploy to Azure button - ## More details I have a [blog post](https://www.frankysnotes.com/2019/02/how-to-unzip-automatically-your-files.html) about this Azure Function. diff --git a/deployment/debugTools.azcli b/deployment/debugTools.azcli index e3a0fc4..d10ab6d 100644 --- a/deployment/debugTools.azcli +++ b/deployment/debugTools.azcli @@ -1,14 +1,14 @@ -az group create -n cloud5minsAz -l eastus +az group create -n c5mAzUnzip -l eastus # validate command -az group deployment validate -g cloud5minsAz --template-file "deployment/deployAzure.json" --verbose +az deployment group validate -g c5mAzUnzip --template-file "deployment/deployAzure.json" --verbose # validate with Parameter file -az group deployment validate -g cloud5minsAz --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose +az deployment group validate -g c5mAzUnzip --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose # deploy it -az group deployment create -n cloud5mins -g cloud5minsAz --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose +az deployment group create -n cloud5mins -g c5mAzUnzip --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose -az deployment create -n cloud5mins -r cloud5minsAz -l eastus --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose \ No newline at end of file +# az deployment create -n cloud5mins -r c5mAzUnzip -l eastus --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose \ No newline at end of file diff --git a/deployment/deployAzure.json b/deployment/deployAzure.json index 655abe5..3f080fc 100644 --- a/deployment/deployAzure.json +++ b/deployment/deployAzure.json @@ -1,5 +1,5 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "baseName": { @@ -86,7 +86,7 @@ }, { "name": "FUNCTIONS_EXTENSION_VERSION", - "value": "~3" + "value": "~4" }, { "name": "FUNCTIONS_WORKER_RUNTIME", diff --git a/local.settings.example.json b/local.settings.example.json new file mode 100644 index 0000000..8a7d1d6 --- /dev/null +++ b/local.settings.example.json @@ -0,0 +1,12 @@ +{ + "IsEncrypted": false, + "Values": { + "AzureWebJobsStorage": "AzureWebJobsStorageConnectionStringValue", + "FUNCTIONS_WORKER_RUNTIME": "dotnet", + "cloud5mins_storage":"STORAGE_CONNECTION_STRING", + "destinationStorage":"STORAGE_CONNECTION_STRING", + "destinationContainer":"output-files", + "KeyVaultUri":"https://", + "ZipPassword":"A_PASSWORD" + } +} \ No newline at end of file