From 4719cc03837490ed4bf1b9725d75a686e56e5a6a Mon Sep 17 00:00:00 2001 From: claw0ry Date: Wed, 11 Dec 2024 13:56:52 +0100 Subject: fresh start --- ...shortner-with-powershell-and-azure-functions.md | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 content/posts/simple-url-shortner-with-powershell-and-azure-functions.md (limited to 'content/posts/simple-url-shortner-with-powershell-and-azure-functions.md') diff --git a/content/posts/simple-url-shortner-with-powershell-and-azure-functions.md b/content/posts/simple-url-shortner-with-powershell-and-azure-functions.md new file mode 100644 index 0000000..b2e9642 --- /dev/null +++ b/content/posts/simple-url-shortner-with-powershell-and-azure-functions.md @@ -0,0 +1,66 @@ +--- +title: 'Simple Url Shortner With Powershell and Azure Functions' +date: 2022-02-07T15:03:12+01:00 +draft: true +--- + +In this article we're going to setup a simple url shortner written in Powershell, hosted with Azure Functions and Azure Table Storage for persistence. + + + +## 1. Creating our resources in Azure + +### 1.1 Connect to Azure + +```pwsh +Connect-AzAccount +``` + +### 1.1 Resource Group + +```powershell +$resourceGroup = New-AzResourceGroup -Name "simple-url-shortner" -Location "westeurope" +``` + +### 1.2 Azure Storage Account + +```powershell +$storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup.ResourceGroupName ` + -Name "simpleurlshorner001" ` + -SkuName "Standard_LRS" ` + -Location "westeurope" +``` + +### 1.3 Azure Functions + +```powershell +$funcApp = New-AzFunctionApp -Name "simpleurlshortner001" ` + -ResourceGroupName $resourceGroup.ResourceGroupName ` + -StorageAccount $storageAccount.StorageAccountName ` + -Runtime "Powershell" ` + -FunctionsVersion 3 ` + -Location "westeurope" + +``` + +## 2. Building our function + +```bash +func init simpleurlshortner --powershell +cd simpleurlshortner +func new --name URLHandler --template "HTTP Trigger" --authlevel "anonymous" +``` + +### 2.1 Create short url + +### 2.2 Lookup short url + +## 3. Testing + +```bash +func start +``` + +## Resources + +- [https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-powershell?tabs=azure-powershell%2Cbrowser](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-powershell?tabs=azure-powershell%2Cbrowser) -- cgit v1.2.3