From 4eb7be2b97721a4e13cf671d7bc5d849d74c677c Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Thu, 28 Apr 2022 11:10:05 -0400 Subject: [PATCH 1/6] Update run.ps1 added created by tag and created timestamp tag if resource was just created --- AutoTagger/run.ps1 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/AutoTagger/run.ps1 b/AutoTagger/run.ps1 index 44f44f4..fc4ab85 100644 --- a/AutoTagger/run.ps1 +++ b/AutoTagger/run.ps1 @@ -35,11 +35,23 @@ try { } else { $lastModifiedBy = $appid } - - $tags = @{ - "LastModifiedBy" = $lastModifiedBy - "LastModifiedTimeStamp" = $time + + # Check if resource was already tagged so we know if this is the creation of the resource + $alreadyTagged = Get-AzResource -TagName 'LastModifiedBy' -Name $resource.Name -ResourceGroupName $resource.ResourceGroupName + if ($alreadyTagged) { + $tags = @{ + "LastModifiedBy" = $lastModifiedBy + "LastModifiedTimeStamp" = $time + } + }else { + $tags = @{ + "LastModifiedBy" = $lastModifiedBy + "LastModifiedTimeStamp" = $time + "Created By" = $lastModifiedBy + "Created TimeStamp" = $time + } } + try { Update-AzTag -ResourceId $uri -Tag $tags -Operation Merge } From 1aa6ca8fe4731cbe490b7b6da1e35df68fd27987 Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Thu, 28 Apr 2022 14:42:19 -0400 Subject: [PATCH 2/6] Update run.ps1 fixed logic for created timestamp tag --- AutoTagger/run.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoTagger/run.ps1 b/AutoTagger/run.ps1 index fc4ab85..6bf03a2 100644 --- a/AutoTagger/run.ps1 +++ b/AutoTagger/run.ps1 @@ -37,7 +37,7 @@ try { } # Check if resource was already tagged so we know if this is the creation of the resource - $alreadyTagged = Get-AzResource -TagName 'LastModifiedBy' -Name $resource.Name -ResourceGroupName $resource.ResourceGroupName + $alreadyTagged = Get-AzResource -TagName 'Created TimeStamp' -Name $resource.Name -ResourceGroupName $resource.ResourceGroupName if ($alreadyTagged) { $tags = @{ "LastModifiedBy" = $lastModifiedBy From 9e32a28c64c8b72256975105aae0b05932b32706 Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Thu, 28 Apr 2022 15:16:09 -0400 Subject: [PATCH 3/6] Update host.json updated timeout period to 10 min --- host.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/host.json b/host.json index f12852a..ae41670 100644 --- a/host.json +++ b/host.json @@ -6,5 +6,8 @@ "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[1.*, 2.0.0)" + }, + { + "functionTimeout": "00:10:00" } -} \ No newline at end of file +} From 72d8f1d2f563d4563ab103d69ca187e06c42102c Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Thu, 28 Apr 2022 15:28:39 -0400 Subject: [PATCH 4/6] Update host.json fixed timeout json --- host.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/host.json b/host.json index ae41670..1be0eea 100644 --- a/host.json +++ b/host.json @@ -3,11 +3,9 @@ "managedDependency": { "Enabled": true }, + "functionTimeout": "00:10:00", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[1.*, 2.0.0)" - }, - { - "functionTimeout": "00:10:00" } } From 596e426bebee3f52aebaf9569e1850444e7c2979 Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Fri, 2 Dec 2022 14:37:24 -0500 Subject: [PATCH 5/6] Update host.json updating runtime to latest version to stay supported by Azure Functions 4.0 --- host.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host.json b/host.json index 1be0eea..c19b0de 100644 --- a/host.json +++ b/host.json @@ -6,6 +6,6 @@ "functionTimeout": "00:10:00", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[3.3.0, 4.0.0)" } } From 2b9dc36ecef23b3c4b05025b4be34f0411773978 Mon Sep 17 00:00:00 2001 From: Matt Blessing Date: Fri, 2 Dec 2022 14:38:41 -0500 Subject: [PATCH 6/6] updating settings project runtime version to 4 --- .vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 84eed89..a30da4b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "azureFunctions.deploySubpath": ".", "azureFunctions.projectLanguage": "PowerShell", - "azureFunctions.projectRuntime": "~3" -} \ No newline at end of file + "azureFunctions.projectRuntime": "~4" +}