Skip to content
Tools required to send logs to Azure Logs
PowerShell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
ALTools
Tests
build
docs
.gitignore
LICENSE
README.md
RELEASE.md
requirements.psd1

README.md

Build Status

Build Status Branch
Build status master
Build status dev

Index

What is ALTools

ALTools is a simple micro-module to interact with Azure Logs.

It is based on official Microsoft documentation.

In it's current state it is used to send custom PSObjects to Azure Logs.

Installation

ALTools module is available on PowerShell Gallery so installation is quite easy:

Install-Module ALTools

Examples

To send PowerShell Objects to Azure Logs you will first need to get WorkspaceID and PrimaryKey. Use this to get it.

Here are some examples of how to use this to send custom logs to Azure Logs

Current running processes

Send all files from given path Azure Logs:

Import-Module ALTools -Force

$invocationStartTime = [DateTime]::UtcNow
$object = Get-Process
$invocationEndTime = [DateTime]::UtcNow

$writeToLogAnalyticsSplat = @{
    ALWorkspaceID       = 'e2920363-xxxx-xxxx-xxxx-740exxxx801'
    invocationStartTime = $invocationStartTime
    PSObject            = $object
    ALTableIdentifier   = 'ALTools' #Your name for Azure Logs
    invocationEndTime   = $invocationEndTime
    WorkspacePrimaryKey = 'I5ZBxxxxxxxxxxxRkiy8uZ77rfTKKvzeI+g=='
}
Write-ToLogAnalytics @writeToLogAnalyticsSplat -Verbose

Files from disk

Send all current running processes to Azure Logs:

$invocationStartTime = [DateTime]::UtcNow
$object = Get-ChildItem -Path 'C:\AdminTools'
$invocationEndTime = [DateTime]::UtcNow
$writeToLogAnalyticsSplat = @{
    ALWorkspaceID       = 'e2920363-xxxx-xxxx-xxxx-740exxxx801'
    invocationStartTime = $invocationStartTime
    PSObject            = $object
    ALTableIdentifier   = 'ALTools' #Your name for Azure Logs
    invocationEndTime   = $invocationEndTime
    WorkspacePrimaryKey = 'I5ZBxxxxxxxxxxxRkiy8uZ77rfTKKvzeI+g=='
}
Write-ToLogAnalytics @writeToLogAnalyticsSplat -Verbose
You can’t perform that action at this time.