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" +} diff --git a/AutoTagger/run.ps1 b/AutoTagger/run.ps1 index 44f44f4..6bf03a2 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 'Created TimeStamp' -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 } diff --git a/host.json b/host.json index f12852a..c19b0de 100644 --- a/host.json +++ b/host.json @@ -3,8 +3,9 @@ "managedDependency": { "Enabled": true }, + "functionTimeout": "00:10:00", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[3.3.0, 4.0.0)" } -} \ No newline at end of file +}