Skip to content

Commit

Permalink
Merge pull request #18 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
kris6673 authored Mar 20, 2024
2 parents cbd1b16 + 3577edf commit b053060
Show file tree
Hide file tree
Showing 48 changed files with 201 additions and 140 deletions.
2 changes: 1 addition & 1 deletion BestPracticeAnalyser_Orchestration/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ param($Context)

$DurableRetryOptions = @{
FirstRetryInterval = (New-TimeSpan -Seconds 5)
MaxNumberOfAttempts = 3
MaxNumberOfAttempts = 1
BackoffCoefficient = 2
}
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions
Expand Down
70 changes: 33 additions & 37 deletions DomainAnalyser_Orchestration/run.ps1
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
param($Context)

try {
try {

$DurableRetryOptions = @{
FirstRetryInterval = (New-TimeSpan -Seconds 5)
MaxNumberOfAttempts = 3
BackoffCoefficient = 2
}
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions
$DurableRetryOptions = @{
FirstRetryInterval = (New-TimeSpan -Seconds 5)
MaxNumberOfAttempts = 1
BackoffCoefficient = 2
}
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions

# Sync tenants
try {
Invoke-ActivityFunction -FunctionName 'DomainAnalyser_GetTenantDomains' -Input 'Tenants'
}
catch { Write-Host "EXCEPTION: TenantDomains $($_.Exception.Message)" }
# Sync tenants
try {
Invoke-ActivityFunction -FunctionName 'DomainAnalyser_GetTenantDomains' -Input 'Tenants'
} catch { Write-Host "EXCEPTION: TenantDomains $($_.Exception.Message)" }

# Get list of all domains to process
$Batch = Invoke-ActivityFunction -FunctionName 'Activity_GetAllTableRows' -Input 'Domains'

$ParallelTasks = foreach ($Item in $Batch) {
Invoke-DurableActivity -FunctionName 'DomainAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions
}

# Collect activity function results and send to database
$TableParams = Get-CippTable -tablename 'Domains'
$TableParams.Entity = Wait-ActivityFunction -Task $ParallelTasks
$TableParams.Force = $true
$TableParams = $TableParams | ConvertTo-Json -Compress
# Get list of all domains to process
$Batch = Invoke-ActivityFunction -FunctionName 'Activity_GetAllTableRows' -Input 'Domains'

try {
Invoke-ActivityFunction -FunctionName 'Activity_AddOrUpdateTableRows' -Input $TableParams
}
catch {
Write-Host "Orchestrator exception UpdateDomains $($_.Exception.Message)"
}
}
catch {
Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser Orchestrator Error $($_.Exception.Message)" -sev info
#Write-Host $_.Exception | ConvertTo-Json
}
finally {
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser has Finished' -sev Info
$ParallelTasks = foreach ($Item in $Batch) {
Invoke-DurableActivity -FunctionName 'DomainAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions
}

# Collect activity function results and send to database
$TableParams = Get-CippTable -tablename 'Domains'
$TableParams.Entity = Wait-ActivityFunction -Task $ParallelTasks
$TableParams.Force = $true
$TableParams = $TableParams | ConvertTo-Json -Compress

try {
Invoke-ActivityFunction -FunctionName 'Activity_AddOrUpdateTableRows' -Input $TableParams
} catch {
Write-Host "Orchestrator exception UpdateDomains $($_.Exception.Message)"
}
} catch {
Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser Orchestrator Error $($_.Exception.Message)" -sev info
#Write-Host $_.Exception | ConvertTo-Json
} finally {
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser has Finished' -sev Info
}
Binary file removed Modules/AzBobbyTables/3.1.0/AzBobbyTables.PS.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Modules/AzBobbyTables/3.1.3/AzBobbyTables.PS.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'AzBobbyTables.PS.dll'

# Version number of this module.
ModuleVersion = '3.1.0'
ModuleVersion = '3.1.3'

# Supported PSEditions
CompatiblePSEditions = @('Core')
Expand Down Expand Up @@ -108,7 +108,14 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
# ReleaseNotes = ''
ReleaseNotes = '## [3.1.3] - 2024-01-20
### Added
- Added Sampler ([#48](https://github.com/PalmEmanuel/AzBobbyTables/issues/48)).
- Added support for user-assigned managed identities ([#54](https://github.com/PalmEmanuel/AzBobbyTables/issues/54)).
'

# Prerelease string of this module
# Prerelease = ''
Expand All @@ -130,4 +137,3 @@ PrivateData = @{
# DefaultCommandPrefix = ''

}

28 changes: 28 additions & 0 deletions Modules/AzBobbyTables/3.1.3/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog for the module

The format is based on and uses the types of changes according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added Sampler ([#48](https://github.com/PalmEmanuel/AzBobbyTables/issues/48)).
- Added support for user-assigned managed identities ([#54](https://github.com/PalmEmanuel/AzBobbyTables/issues/54)).

## [3.1.2] - 2024-01-05

### Added

- Help documentation for a DateTime problem caused by the SDK (#43).

### Fixed

### Changed

### Removed

## 3.1.1 - 2023-05-03

[Unreleased]: https://github.com/PalmEmanuel/AzBobbyTables/compare/v3.1.2...HEAD

[3.1.2]: https://github.com/PalmEmanuel/AzBobbyTables/compare/d854153aca6c5cce35a123deb86653a0d3289b07...v3.1.2
21 changes: 21 additions & 0 deletions Modules/AzBobbyTables/3.1.3/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Emanuel Palm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</TN>
<MS>
<S N="Name">AzBobbyTables</S>
<S N="Version">3.1.0</S>
<S N="Version">3.1.3</S>
<S N="Type">Module</S>
<S N="Description">A module for handling Azure Table Storage operations by wrapping the Azure Data Tables SDK.</S>
<S N="Author">Emanuel Palm</S>
<S N="CompanyName">PalmEmanuel</S>
<S N="Copyright">(c) Emanuel Palm. All rights reserved.</S>
<DT N="PublishedDate">2023-03-24T21:51:21-04:00</DT>
<DT N="PublishedDate">2024-01-20T16:49:22-05:00</DT>
<Nil N="InstalledDate" />
<Nil N="UpdatedDate" />
<URI N="LicenseUri">https://github.com/PalmEmanuel/AzBobbyTables/blob/main/LICENSE</URI>
Expand Down Expand Up @@ -43,8 +43,23 @@
</TN>
<DCT>
<En>
<S N="Key">Command</S>
<S N="Key">RoleCapability</S>
<Obj N="Value" RefId="3">
<TNRef RefId="1" />
<LST />
</Obj>
</En>
<En>
<S N="Key">Function</S>
<Ref N="Value" RefId="3" />
</En>
<En>
<S N="Key">DscResource</S>
<Ref N="Value" RefId="3" />
</En>
<En>
<S N="Key">Command</S>
<Obj N="Value" RefId="4">
<TNRef RefId="1" />
<LST>
<S>Add-AzDataTableEntity</S>
Expand All @@ -58,13 +73,6 @@
</LST>
</Obj>
</En>
<En>
<S N="Key">Function</S>
<Obj N="Value" RefId="4">
<TNRef RefId="1" />
<LST />
</Obj>
</En>
<En>
<S N="Key">Cmdlet</S>
<Obj N="Value" RefId="5">
Expand All @@ -83,20 +91,12 @@
</En>
<En>
<S N="Key">Workflow</S>
<Ref N="Value" RefId="4" />
</En>
<En>
<S N="Key">DscResource</S>
<Ref N="Value" RefId="4" />
</En>
<En>
<S N="Key">RoleCapability</S>
<Ref N="Value" RefId="4" />
<Ref N="Value" RefId="3" />
</En>
</DCT>
</Obj>
<Nil N="PowerShellGetFormatVersion" />
<Nil N="ReleaseNotes" />
<S N="ReleaseNotes">## [3.1.3] - 2024-01-20_x000A__x000A_### Added_x000A__x000A_- Added Sampler ([#48](https://github.com/PalmEmanuel/AzBobbyTables/issues/48))._x000A_- Added support for user-assigned managed identities ([#54](https://github.com/PalmEmanuel/AzBobbyTables/issues/54)).</S>
<Obj N="Dependencies" RefId="6">
<TNRef RefId="1" />
<LST />
Expand All @@ -113,28 +113,29 @@
<S N="copyright">(c) Emanuel Palm. All rights reserved.</S>
<S N="description">A module for handling Azure Table Storage operations by wrapping the Azure Data Tables SDK.</S>
<S N="requireLicenseAcceptance">False</S>
<S N="releaseNotes">## [3.1.3] - 2024-01-20_x000A__x000A_### Added_x000A__x000A_- Added Sampler ([#48](https://github.com/PalmEmanuel/AzBobbyTables/issues/48))._x000A_- Added support for user-assigned managed identities ([#54](https://github.com/PalmEmanuel/AzBobbyTables/issues/54)).</S>
<S N="isLatestVersion">True</S>
<S N="isAbsoluteLatestVersion">True</S>
<S N="versionDownloadCount">2</S>
<S N="downloadCount">2005</S>
<S N="packageSize">1261744</S>
<S N="published">3/24/2023 9:51:21 PM -04:00</S>
<S N="created">3/24/2023 9:51:21 PM -04:00</S>
<S N="lastUpdated">3/25/2023 4:22:25 PM -04:00</S>
<S N="versionDownloadCount">3242</S>
<S N="downloadCount">12058</S>
<S N="packageSize">1356423</S>
<S N="published">1/20/2024 4:49:22 PM -05:00</S>
<S N="created">1/20/2024 4:49:22 PM -05:00</S>
<S N="lastUpdated">3/18/2024 2:41:34 PM -04:00</S>
<S N="tags">azure storage table cosmos cosmosdb data PSModule PSEdition_Core PSCmdlet_Add-AzDataTableEntity PSCommand_Add-AzDataTableEntity PSCmdlet_Clear-AzDataTable PSCommand_Clear-AzDataTable PSCmdlet_Get-AzDataTableEntity PSCommand_Get-AzDataTableEntity PSCmdlet_Remove-AzDataTableEntity PSCommand_Remove-AzDataTableEntity PSCmdlet_Update-AzDataTableEntity PSCommand_Update-AzDataTableEntity PSCmdlet_New-AzDataTableContext PSCommand_New-AzDataTableContext PSCmdlet_Remove-AzDataTable PSCommand_Remove-AzDataTable PSCmdlet_New-AzDataTable PSCommand_New-AzDataTable PSIncludes_Cmdlet</S>
<S N="developmentDependency">False</S>
<S N="updated">2023-03-25T16:22:25Z</S>
<S N="NormalizedVersion">3.1.0</S>
<S N="updated">2024-03-18T14:41:34Z</S>
<S N="NormalizedVersion">3.1.3</S>
<S N="Authors">Emanuel Palm</S>
<S N="IsPrerelease">false</S>
<S N="ItemType">Module</S>
<S N="FileList">AzBobbyTables.nuspec|dependencies\System.Numerics.Vectors.dll|dependencies\System.Security.Principal.Windows.dll|dependencies\System.Threading.Tasks.Extensions.dll|dependencies\AzBobbyTables.Core.dll|dependencies\Microsoft.Bcl.AsyncInterfaces.dll|dependencies\Microsoft.Win32.Registry.dll|dependencies\System.Linq.Async.dll|dependencies\System.Runtime.CompilerServices.Unsafe.dll|dependencies\System.Text.Encodings.Web.dll|en-US\AzBobbyTables.PS.dll-Help.xml|AzBobbyTables.PS.dll|dependencies\Azure.Core.dll|dependencies\Microsoft.VisualStudio.Threading.dll|dependencies\System.Buffers.dll|dependencies\System.Memory.Data.dll|dependencies\System.Security.AccessControl.dll|dependencies\System.Text.Json.dll|AzBobbyTables.psd1|dependencies\Azure.Data.Tables.dll|dependencies\Microsoft.VisualStudio.Validation.dll|dependencies\System.Diagnostics.DiagnosticSource.dll|dependencies\System.Memory.dll</S>
<S N="FileList">AzBobbyTables.nuspec|CHANGELOG.md|dependencies\AzBobbyTables.Core.pdb|dependencies\Microsoft.VisualStudio.Validation.dll|dependencies\System.Memory.Data.dll|dependencies\System.Runtime.CompilerServices.Unsafe.dll|dependencies\System.Numerics.Vectors.dll|dependencies\System.Text.Json.dll|LICENSE|dependencies\AzBobbyTables.Core.dll|dependencies\System.Threading.Tasks.Extensions.dll|dependencies\Microsoft.VisualStudio.Threading.dll|AzBobbyTables.PS.pdb|dependencies\System.Security.AccessControl.dll|dependencies\Microsoft.Win32.Registry.dll|dependencies\System.Text.Encodings.Web.dll|AzBobbyTables.psd1|dependencies\System.Buffers.dll|dependencies\Azure.Data.Tables.dll|dependencies\System.Memory.dll|AzBobbyTables.PS.dll|dependencies\System.Diagnostics.DiagnosticSource.dll|dependencies\Microsoft.Bcl.AsyncInterfaces.dll|dependencies\System.Security.Principal.Windows.dll|en-US\AzBobbyTables.PS.dll-Help.xml|dependencies\System.Linq.Async.dll|dependencies\Azure.Core.dll</S>
<S N="GUID">eead4f42-5080-4f83-8901-340c529a5a11</S>
<S N="PowerShellVersion">7.0</S>
<S N="CompanyName">pipe.how</S>
</MS>
</Obj>
<S N="InstalledLocation">C:\Users\jduprey.CNS\Documents\GitHub\CIPP-API\Modules\AzBobbyTables\3.1.0</S>
<S N="InstalledLocation">C:\GitHub\CIPP Workspace\CIPP-API\Modules\AzBobbyTables\3.1.3</S>
</MS>
</Obj>
</Objs>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@
</command:returnValues>
<maml:alertSet>
<maml:alert>
<maml:para></maml:para>
<maml:para>Regarding Dates, DateTime, and DateTimeOffset:</maml:para>
<maml:para>The underlying Azure.Data.Tables SDK expects to work with DateTime fields in UTC format for conversion to DateTimeOffset objects. When submitting a DateTimeOffset object to the SDK, it will be converted to UTC timezone rather than preserving the existing timezone/offset info. Similarly, if a `DateTime` object is submitted in the entity with its Kind set to "local" or "unspecified", the SDK will return an error and state that `Azure SDK requires it to be UTC`. While there isn't any change needed to get `DateTimeOffset` objects to work with AzBobbyTables, the workaround for `DateTime` objects is to set the property to a new `DateTime` object with its `Kind` property set to `Utc`. e.g. `$obj.Time = $obj.Time.ToUniversalFormat()`. Related issue (https://github.com/Azure/azure-sdk-for-net/issues/30644).</maml:para>
<maml:para>It is possible via the Azure Storage Explorer to set DateTime fields with offsets other than UTC/+00:00. Note that searches with queries set to type `DateTime` do properly calculate to a specific moment, and find equivilent moments. e.g. a `-Filter` set to `Time eq datetime'2023-12-26T18:05:40.5345634+00:00'` will match an entry where the Time property is set to `2023-12-26T17:05:40.5345634-01:00`.</maml:para>
</maml:alert>
</maml:alertSet>
<command:examples>
Expand Down Expand Up @@ -610,10 +612,10 @@ PS C:\&gt; New-AzDataTable -Context $Context</dev:code>
<command:syntax>
<command:syntaxItem>
<maml:name>New-AzDataTableContext</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>ConnectionString</maml:name>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>ClientId</maml:name>
<maml:description>
<maml:para>The connection string to the storage account.</maml:para>
<maml:para>Specifies the client id when using a user-assigned managed identity.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand All @@ -623,9 +625,20 @@ PS C:\&gt; New-AzDataTable -Context $Context</dev:code>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>TableName</maml:name>
<maml:name>ManagedIdentity</maml:name>
<maml:description>
<maml:para>The name of the table.</maml:para>
<maml:para>Specifies that the command is run by a managed identity (such as in an Azure Function), and authorization will be handled using that identity.</maml:para>
</maml:description>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>StorageAccountName</maml:name>
<maml:description>
<maml:para>The name of the storage account.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand All @@ -634,24 +647,25 @@ PS C:\&gt; New-AzDataTable -Context $Context</dev:code>
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
<command:syntaxItem>
<maml:name>New-AzDataTableContext</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>ManagedIdentity</maml:name>
<maml:name>TableName</maml:name>
<maml:description>
<maml:para>Specifies that the command is run by a managed identity (such as in an Azure Function), and authorization will be handled using that identity.</maml:para>
<maml:para>The name of the table.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
<command:syntaxItem>
<maml:name>New-AzDataTableContext</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>StorageAccountName</maml:name>
<maml:name>ConnectionString</maml:name>
<maml:description>
<maml:para>The name of the storage account.</maml:para>
<maml:para>The connection string to the storage account.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -780,6 +794,18 @@ PS C:\&gt; New-AzDataTable -Context $Context</dev:code>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>ClientId</maml:name>
<maml:description>
<maml:para>Specifies the client id when using a user-assigned managed identity.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>ConnectionString</maml:name>
<maml:description>
Expand Down
Loading

0 comments on commit b053060

Please sign in to comment.