Automation Data / Storage PowerShell

ANFHealthCheck: Customizable Reports in your Inbox

ANFHealthCheck is a Azure PowerShell Runbook that inventories your Azure NetApp Files (ANF) resources, highlights potential issues, and presents this information in an easy-to-read HTML report – straight to your inbox. The Runbook can be automated to run on your schedule via your Azure Automation account. Just set it and forget it.

ANFHealthCheck was designed to be customizable to fit your needs via a modular architecture. Each table within the report is created by a PowerShell function. You can fully customize the content and output to present the data in a way that works for your application or environment.

By default, the report looks like this, but I strongly encourage you to customize it!

The following modules are included as part of this ‘1.0’ release:

  • NetApp Account Summary
  • Capacity Pool Utilization
  • Volume Utilization Above x%
  • Volume Utilization (all volumes)
  • Volume Utilization Growth (x days)
  • Volume Snapshot Status
  • Volume Replication Status

Let’s walk through how to get things set up within an Azure Automation account:

Note: You’ll need an SMTP server to send the reports via email. Azure offers SMTP as a service via an offering called SendGrid.

  1. Within the Azure portal, create an Automation Account and ensure ‘Create Azure Run As account‘ is set to Yes.
    • If you do not have permissions to ‘Create Azure Run As Account’, there are other ways to authenticate.
  2. Navigate to the Automation Account and browse to the ‘Modules gallery’ under Shared Resources. Import the following modules into your account:
    • Az.Accounts
    • Az.NetAppFiles
    • Az.Resources
    • Az.Monitor
  3. Navigate to ‘Runbooks gallery’ under Process Automation and search for ‘ANFHealthCheck’. Select the Runbook, click on ‘Import’, and give the Runbook a name unique to your environment.
  4. Navigate to Runbooks and find your new imported ANFHealthCheck Runbook. Click ‘Edit’.
  5. Within the code editor, scroll down and find the ‘Send-Email’ function. You’ll need to customize this with the following details:
    1. $Username – your SMTP server username
    2. $Password – your SMTP server password
    3. $SMTPServer – your SMTP server IP address or hostname
    4. $EmailFrom – the email address that the report will come from
    5. $EmailTo – the email address that you would like the report to go to
    6. $Subject – the email subject for the ANFHealthCheck report
  6. Click the ‘Save’ button.
  7. Click the ‘Publish’ button.
  8. Click the ‘Start’ button to test the script. Optionally, you can specify a SUBID to limit the scope to a specific subscription. If everything is working correctly, you should get an email within a few minutes (this will vary depending on the size of your environment) with information about your Azure NetApp Files resources.
  9. If everything is working as expected, browse back to the Runbook and click on ‘Link to schedule’
  10. Click ‘Link a schedule to your runbook’ and create a schedule that works for you.

Hints and Tips!

  • If you do not have permissions to ‘Create Azure Run As Account’, there are other ways to authenticate.
  • Run on Local Workstation: You can run the script locally on your workstation. Clone the repo from GitHub and use the ‘-OutFile myreport.html’ parameter. Doing so will send the output to ‘myreport.html’ in the same directory you are running the script from. When running locally, you’ll need to run ‘Connect-AzAccount’ first.
  • User Modifiable Parameters: Near the top of the script is a section called ‘User Modifiable Parameters’. Feel free to modify these values to customize the report for your needs.\
  • Customize Output: Edit the Runbook. Under ## Generate Module Output, comment out the modules that are no longer required.

I found a bug!

Questions, comments, suggestions for new modules? Please open an issue on GitHub and I’ll take a look as soon as I can.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: