This error is actually documented on the [Error: 000824][1] page.

The solution is to 

> Add the following code snippet to check-out the extension containing
> the tool before calling the tool for use:
>    
>        import arcpy
>        …
>        arcpy.CheckOutExtension("[Extension name]")

The extension names are documented in the [`arcpy.CheckOutExtension`][2] help. For Network Analyst use:

    arcpy.CheckOutExtension("Network")



  [1]: https://support.esri.com/en/technical-article/000013100
  [2]: https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/checkoutextension.htm