Skip to content

Commit

Permalink
Upgrade to dotnet6 0 (#32)
Browse files Browse the repository at this point in the history
* upgrade to .NET 6 and dev container

* clean up readme
  • Loading branch information
FBoucher authored Feb 3, 2023
1 parent 147b896 commit 5eca9f4
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 53 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions AzUnzipEverything.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.9" />
<PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.0.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down
47 changes: 22 additions & 25 deletions AzUnzipEverything.sln
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions AzUnzipEverything.sln.DotSettings

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a href="https://portal.azure.com/?WT.mc_id=dotnet-0000-frbouche#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FFBoucher%2FAzUnzipEverything%2Fmain%2Fdeployment%2FdeployAzure.json?WT.mc_id=cloud5mins-github-frbouche" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a>
<a href="https://portal.azure.com/?WT.mc_id=dotnet-0000-frbouche#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FFBoucher%2FAzUnzipEverything%2Fmain%2Fdeployment%2FdeployAzure.json?WT.mc_id=cloud5mins-github-frbouche" target="_blank"><img src="https://aka.ms/deploytoazurebutton"/></a>

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)
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions deployment/debugTools.azcli
Original file line number Diff line number Diff line change
@@ -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
# az deployment create -n cloud5mins -r c5mAzUnzip -l eastus --template-file "deployment/deployAzure.json" --parameters "deployment/deployAzure.parameters.json" --verbose
4 changes: 2 additions & 2 deletions deployment/deployAzure.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
"value": "~4"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
Expand Down
12 changes: 12 additions & 0 deletions local.settings.example.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 5eca9f4

Please sign in to comment.