Modules

The best way of publishing your code to an internal or external gallery is to package it into modules. Modules should collect functions that belong to a specific product or workload. If you have developed functions for multiple different purposes, consider creating modules for each of those individual purposes if possible.

Of course, it is also possible to publish single scripts instead of modules. This might be useful if you, for example, have one or more deployment scripts for your different services. The script can be downloaded on the fly and can be used immediately:

Publishing anything to a gallery requires a NuGet API key. In an on-premises gallery, this wlll be a combination of username and password, unless the gallery will allow you to generate an API key. For the PowerShell Gallery, you can retrieve your API key in your personal settings. Treat your API keys as sensitive information and do not share them. Anyone in possession of your API key can publish code under your name.

Build systems usually have a way of adding secure parameters that are decrypted at build time. This is a great way to add secure information such as API keys if you can trust the system to handle those credentials for you. Just make sure not to make this information visible in your verbose build logs, which are potentially publicly visible.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.63.87