Utiliser les runbooks et les modules de PowerShell GalleryUse runbooks and modules in PowerShell Gallery
Au lieu de créer vos propres runbooks et modules dans Azure Automation, vous pouvez accéder à des scénarios déjà générés par Microsoft et la communauté.Rather than creating your own runbooks and modules in Azure Automation, you can access scenarios that have already been built by Microsoft and the community. Vous pouvez obtenir des runbooks PowerShell et des modules à partir de PowerShell Gallery, et à partir des runbooks Python de l’organisation Azure Automation GitHub.You can get PowerShell runbooks and modules from the PowerShell Gallery and Python runbooks from the Azure Automation GitHub organization. Vous pouvez également contribuer à la communauté en partageant les scénarios que vous développez.You can also contribute to the community by sharing scenarios that you develop.
Notes
Le centre de scripts TechNet est en retrait.The TechNet Script Center is retiring. Tous les runbooks du Centre de scripts de la Galerie de runbooks ont été déplacés vers notre organisation GitHub Automation. Pour plus d'informations, cliquez ici.All of the runbooks from Script Center in the Runbook gallery have been moved to our Automation GitHub organization For more information, see here.
Runbooks dans PowerShell GalleryRunbooks in PowerShell Gallery
PowerShell Gallery fournit un éventail de runbooks provenant de Microsoft et de la communauté, et que vous pouvez importer dans Azure Automation.The PowerShell Gallery provides a variety of runbooks from Microsoft and the community that you can import into Azure Automation. Pour utiliser l’un de ces runbooks, vous pouvez en télécharger un à partir de la galerie, ou importer directement des runbooks à partir de la galerie, ou à partir de votre compte Automation sur le portail Azure.To use one, download a runbook from the gallery, or you can directly import runbooks from the gallery, or from your Automation account in the Azure portal.
Notes
Les runbooks graphiques ne sont pas pris en charge dans PowerShell Gallery.Graphical runbooks are not supported in PowerShell Gallery.
Seul le portail Azure permet d’importer des runbooks directement à partir de PowerShell Gallery.You can only import directly from the PowerShell Gallery using the Azure portal. Vous ne pouvez pas exécuter cette fonction à l’aide de PowerShell.You cannot perform this function using PowerShell.
Notes
Vous devez valider le contenu de tous les runbooks que vous obtenez de PowerShell Gallery et vous montrer très vigilant lors de leur installation et de leur exécution dans un environnement de production.You should validate the contents of any runbooks that you get from the PowerShell Gallery and use extreme caution in installing and running them in a production environment.
Modules dans PowerShell GalleryModules in PowerShell Gallery
Les modules PowerShell contiennent des cmdlets que vous pouvez utiliser dans vos runbooks.PowerShell modules contain cmdlets that you can use in your runbooks. Des modules existants qui peuvent être installés dans Azure Automation sont disponibles dans PowerShell Gallery.Existing modules that you can install in Azure Automation are available in the PowerShell Gallery. Vous pouvez lancer cette galerie sur le Portail Azure et installer les modules directement dans Azure Automation, ou bien les télécharger et les installer manuellement.You can launch this gallery from the Azure portal and install the modules directly into Azure Automation, or you can manually download and install them.
Scénarios courants disponibles dans PowerShell GalleryCommon scenarios available in PowerShell Gallery
La liste ci-dessous contient quelques runbooks qui fournissent des scénarios courants.The list below contains a few runbooks that support common scenarios. Pour obtenir la liste complète des runbooks créés par l’équipe Azure Automation, consultez Profil AzureAutomationTeam.For a full list of runbooks created by the Azure Automation team, see AzureAutomationTeam profile.
- Update-ModulesInAutomationToLatestVersion : importe la version la plus récente de tous les modules dans un compte Automation à partir de PowerShell Gallery.Update-ModulesInAutomationToLatestVersion - Imports the latest version of all modules in an Automation account from PowerShell Gallery.
- Enable-AzureDiagnostics : configure Diagnostics Azure et Log Analytics pour recevoir les journaux Azure Automation contenant l’état des travaux et les flux des travaux.Enable-AzureDiagnostics - Configures Azure Diagnostics and Log Analytics to receive Azure Automation logs containing job status and job streams.
- Copy-ItemFromAzureVM : copie un fichier distant à partir d’une machine virtuelle Microsoft Azure.Copy-ItemFromAzureVM - Copies a remote file from a Windows Azure virtual machine.
- Copy-ItemToAzureVM : copie un fichier local vers une machine virtuelle Azure.Copy-ItemToAzureVM - Copies a local file to an Azure virtual machine.
Importer un runbook PowerShell à partir Runbook Gallery avec le portail AzureImport a PowerShell runbook from the runbook gallery with the Azure portal
Dans le portail Azure, ouvrez votre compte Automation.In the Azure portal, open your Automation account.
Sélectionnez Runbook Gallery sous Automatisation des processus.Select Runbooks gallery under Process Automation.
Sélectionnez Source : PowerShell Gallery.Select Source: PowerShell Gallery. La liste des runbooks disponibles que vous pouvez parcourir s’affiche.This shows a list of available runbooks that you can browse.
Vous pouvez utiliser la zone de recherche située au-dessus de la liste pour affiner la liste et les filtres pour affiner l’affichage par éditeur, par type et par ordre de tri.You can use the search box above the list to narrow the list, or you can use the filters to narrow the display by publisher, type, and sort. Recherchez l’élément de la galerie qui vous intéresse et sélectionnez-le pour afficher les informations le concernant.Locate the gallery item you want and select it to view its details.
Pour importer un élément, cliquez sur Importer dans le panneau de détails.To import an item, click Import on the details blade.
Vous pouvez également modifier le nom du runbook, puis cliquer sur OK pour importer le runbook.Optionally, change the name of the runbook and then click OK to import the runbook.
Ce runbook apparaît sur l’onglet Runbooks du compte Automation.The runbook appears on the Runbooks tab for the Automation account.
Importation d’un runbook PowerShell à partir de GitHub avec le Portail AzureImport a PowerShell runbook from GitHub with the Azure portal
Dans le portail Azure, ouvrez votre compte Automation.In the Azure portal, open your Automation account.
Sélectionnez Runbook Gallery sous Automatisation des processus.Select Runbooks gallery under Process Automation.
Sélectionnez Source : GitHub.Select Source: GitHub.
Vous pouvez utiliser les filtres situés au-dessus de la liste pour affiner l’affichage par éditeur, par type et par ordre de tri.You can use the filters above the list to narrow the display by publisher, type, and sort. Recherchez l’élément de la galerie qui vous intéresse et sélectionnez-le pour afficher les informations le concernant.Locate the gallery item you want and select it to view its details.
Pour importer un élément, cliquez sur Importer dans le panneau de détails.To import an item, click Import on the details blade.
Vous pouvez également modifier le nom du runbook, puis cliquer sur OK pour importer le runbook.Optionally, change the name of the runbook and then click OK to import the runbook.
Ce runbook apparaît sur l’onglet Runbooks du compte Automation.The runbook appears on the Runbooks tab for the Automation account.
Ajouter un runbook PowerShell à la galerieAdd a PowerShell runbook to the gallery
Microsoft vous invite à ajouter à PowerShell Gallery des runbooks dont vous pensez qu’ils pourraient être utiles à d’autres utilisateurs.Microsoft encourages you to add runbooks to the PowerShell Gallery that you think would be useful to other customers. PowerShell Gallery accepte les modules PowerShell et les scripts PowerShell.The PowerShell Gallery accepts PowerShell modules and PowerShell scripts. Vous pouvez ajouter un runbook en le chargeant dans PowerShell Gallery.You can add a runbook by uploading it to the PowerShell Gallery.
Importer un module à partir de la galerie des modules avec le portail AzureImport a module from the module gallery with the Azure portal
Dans le portail Azure, ouvrez votre compte Automation.In the Azure portal, open your Automation account.
Sélectionnez Modules sous Ressources partagées pour ouvrir la liste des modules.Select Modules under Shared Resources to open the list of modules.
Cliquez sur Parcourir la galerie, en haut de la page.Click Browse gallery from the top of the page.
Sur la page Parcourir la galerie, vous pouvez utiliser la zone de recherche pour rechercher des correspondances dans l’un des champs suivants :On the Browse gallery page, you can use the search box to find matches in any of the following fields:
- Nom du moduleModule Name
- BalisesTags
- AuteurAuthor
- Nom Applet de commande/Ressource DSCCmdlet/DSC resource name
Recherchez un module qui vous intéresse et sélectionnez-le pour en afficher les détails.Locate a module that you're interested in and select it to view its details.
Lorsque vous explorez un module spécifique, vous pouvez afficher plus d’informations.When you drill into a specific module, you can view more information. Ces informations incluent un lien vers PowerShell Gallery, toutes les dépendances nécessaires et toutes les applets de commande ou ressources DSC que contient le module.This information includes a link back to the PowerShell Gallery, any required dependencies, and all of the cmdlets or DSC resources that the module contains.
Pour installer le module directement dans Azure Automation, cliquez sur Importer.To install the module directly into Azure Automation, click Import.
Dans le volet Importer, vous pouvez voir le nom du module à importer.On the Import pane, you can see the name of the module to import. Si toutes les dépendances sont installées, le bouton OK est activé.If all the dependencies are installed, the OK button is activated. S'il manque des dépendances, vous devez les importer avant de pouvoir importer ce module.If you're missing dependencies, you need to import those dependencies before you can import this module.
Dans le volet Importer, cliquez sur OK pour importer le module.On the Import pane, click OK to import the module. Quand il importe un module dans votre compte, le logiciel Azure Automation extrait les métadonnées sur le module et les cmdlets.While Azure Automation imports a module to your account, it extracts metadata about the module and the cmdlets. Cette action peut prendre quelques minutes, car chaque activité doit être extraite.This action might take a couple of minutes since each activity needs to be extracted.
Vous recevez une première notification indiquant que le module est en cours de déploiement, puis une autre, signalant que le processus est terminé.You receive an initial notification that the module is being deployed and another notification when it has completed.
Après avoir importé le module, vous pouvez voir les activités disponibles.After the module is imported, you can see the available activities. Vous pouvez utiliser les ressources du module dans vos runbooks et ressources DSC.You can use module resources in your runbooks and DSC resources.
Notes
Les modules qui prennent uniquement en charge PowerShell Core ne sont pas gérés dans Azure Automation et ne sont pas importables dans le Portail Azure, ni déployables directement à partir de PowerShell Gallery.Modules that only support PowerShell core are not supported in Azure Automation and are unable to be imported in the Azure portal, or deployed directly from the PowerShell Gallery.
Utiliser des runbooks PythonUse Python runbooks
Les Runbooks Python sont disponibles dans l’organisation Azure Automation GitHub.Python Runbooks are available in the Azure Automation GitHub organization. Lorsque vous contribuez à notre référentiel GitHub, ajoutez la balise (rubrique GitHub) : Python3 lorsque vous chargez votre contribution.When you contribute to our GitHub repo, add the tag (GitHub Topic) : Python3 when you upload your contribution.
Demander un runbook ou un moduleRequest a runbook or module
Vous pouvez envoyer des demandes à User Voice.You can send requests to User Voice. Si vous avez besoin d’aide pour écrire un runbook ou si vous avez une question à propos de PowerShell, publiez une question sur notre page de questions Microsoft Q&A.If you need help with writing a runbook or have a question about PowerShell, post a question to our Microsoft Q&A question page.
Étapes suivantesNext steps
- Pour commencer à utiliser un runbook PowerShell, voir Tutoriel : Créer un runbook PowerShell.To get started with a PowerShell runbook, see Tutorial: Create a PowerShell runbook.
- Pour savoir comment utiliser des runbooks, voir Gérer les runbooks dans Azure Automation.To work with runbooks, see Manage runbooks in Azure Automation.
- Pour plus d’informations sur PowerShell, consultez la documentation PowerShell.For details of PowerShell, see PowerShell Docs.
- Pour obtenir des informations de référence sur les applets de commande PowerShell, consultez Az.Automation.For a PowerShell cmdlet reference, see Az.Automation.