summaryrefslogtreecommitdiff
path: root/content/posts/simple-url-shortner-with-powershell-and-azure-functions.md
diff options
context:
space:
mode:
authorclaw0ry <me@claw0ry.net>2024-12-11 13:56:52 +0100
committerclaw0ry <me@claw0ry.net>2024-12-11 13:56:52 +0100
commit4719cc03837490ed4bf1b9725d75a686e56e5a6a (patch)
tree769dd3a3a87153df049b3043196bd131495b10ad /content/posts/simple-url-shortner-with-powershell-and-azure-functions.md
fresh start
Diffstat (limited to 'content/posts/simple-url-shortner-with-powershell-and-azure-functions.md')
-rw-r--r--content/posts/simple-url-shortner-with-powershell-and-azure-functions.md66
1 files changed, 66 insertions, 0 deletions
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.
+
+<!--more-->
+
+## 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)