{"id":2176,"date":"2018-07-29T22:05:53","date_gmt":"2018-07-29T20:05:53","guid":{"rendered":"http:\/\/miroslaw.borodziuk.eu\/?p=2176"},"modified":"2018-08-14T00:15:24","modified_gmt":"2018-08-13T22:15:24","slug":"azure-powershell","status":"publish","type":"post","link":"http:\/\/miro.borodziuk.eu\/index.php\/2018\/07\/29\/azure-powershell\/","title":{"rendered":"Instalacja Azure PowerShell na lokalnym systemie"},"content":{"rendered":"<p><span data-ttu-id=\"2968c-104\">Z Azure PowerShell korzysta\u0107 mo\u017cna bezpo\u015brednia na portalu <code>http:\/\/portal.azure.com<\/code>\u00a0 (tzw. Azure Cloud Shell) jak r\u00f3wnie\u017c zdalnie przy u\u017cyciu lokalnego systemowego PowerShella. Artyku\u0142 opisuje instalacj\u0119 modu\u0142\u00f3w programu Azure PowerShell w \u015brodowisku systemu Windows przy u\u017cyciu modu\u0142u PowerShellGet.<\/span><\/p>\n<p><!--more--><\/p>\n<p><span data-ttu-id=\"2968c-110\">Aby zainstalowa\u0107 Azure PowerShell w wersji 6.0 niezb\u0119dny jest PowerShell w wersji 5.0.<\/span> <span data-ttu-id=\"2968c-111\">Sprawdzenie wersji PowerShella w naszym systemie:<\/span><\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\ $PSVersionTable.PSVersion<\/pre>\n<p><span data-ttu-id=\"2968c-117\">Instalacja\u00a0 modu\u0142\u00f3w PowerShella wymaga uprawnie\u0144 administratora a wi\u0119c z takimi uprawnieniami uruchamiamy lini\u0119 komend PowerShella i wydajemy komend\u0119 jn.<\/span><\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\ Install-Module -Name AzureRM<\/pre>\n<p>Je\u017celi w syatemie zainstalowana jest wersja pakietu NuGet starsza ni\u017c 2.8.5.201, zostanie wy\u015bwietlony monit o pobranie i zainstalowanie najnowszej wersji pakietu NuGet.<\/p>\n<pre class=\"lang:ps decode:true \">NuGet provider is required to continue\r\nPowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet\r\n provider must be available in 'C:\\Program Files\\PackageManagement\\ProviderAssemblies' or\r\n'C:\\Users\\Admin\\AppData\\Local\\PackageManagement\\ProviderAssemblies'. You can also install the NuGet provider by running\r\n 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and\r\nimport the NuGet provider now?\r\n[Y] Yes  [N] No  [S] Suspend  [?] Help (default is \"Y\"): Y<\/pre>\n<p>Wyskoczy tak\u017ce komunikat o niezaufanym repozytorium, na kt\u00f3ry nale\u017cy odpowiedzie\u0107: &#8220;Y&#8221;.<\/p>\n<pre class=\"lang:ps decode:true\">Untrusted repository\r\nYou are installing the modules from an untrusted repository. If you trust this repository, change its\r\nInstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from\r\n'PSGallery'?\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"N\"): Y<\/pre>\n<p>Teraz \u0142adujemy modu\u0142\u00a0 AzureRM przy u\u017cyciu polecenia cmdlet Import-Module, a nast\u0119pnie zaloguj si\u0119 przy u\u017cyciu swoich po\u015bwiadcze\u0144 platformy Azure.<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\ Import-Module AzureRM<\/pre>\n<p>Je\u017celi pojawi si\u0119 komunikat:<\/p>\n<pre class=\"lang:ps decode:true \">Import-Module : File C:\\Program Files\\WindowsPowerShell\\Modules\\AzureRM\\6.6.0\\AzureRM.psm1 cannot be loaded because run\r\nning scripts is disabled on this system. For more information, see about_Execution_Policies at http:\/\/go.microsoft.com\/\r\nfwlink\/?LinkID=135170.\r\nAt line:1 char:1\r\n+ Import-Module AzureRM\r\n+ ~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException\r\n+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand<\/pre>\n<p>to musimy zezwoli\u0107 na wykonywanie skrypt\u00f3w:<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\ Set-ExecutionPolicy Unrestricted\r\n\r\nExecution Policy Change\r\nThe execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose\r\nyou to the security risks described in the about_Execution_Policies help topic at\r\nhttp:\/\/go.microsoft.com\/fwlink\/?LinkID=135170. Do you want to change the execution policy?\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"N\"): y<\/pre>\n<p>Teraz mo\u017cemy pod\u0142\u0105czy\u0107 si\u0119 do konta Azure.<\/p>\n<pre class=\"lang:ps decode:true \">PS C:\\ Connect-AzureRmAccount<\/pre>\n<p>Wpisujemy adres e-mail i has\u0142o.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2182 aligncenter\" src=\"http:\/\/miroslaw.borodziuk.eu\/wp-content\/uploads\/Azure-logowanie-300x271.jpg\" alt=\"\" width=\"300\" height=\"271\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/Azure-logowanie-300x271.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/Azure-logowanie.jpg 465w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Mo\u017cliwa jest tak\u017ce aktualizacja Azure PowerShell je\u017celi jest taka potrzeba. Stara wersja nie zostanie odinstalowana.<\/p>\n<pre class=\"lang:ps decode:true\">PS C:\\ Update-Module -Name AzureRM<\/pre>\n<p>Mo\u017cna tak\u017ce samemu wybra\u0107 wersj\u0119 Azure PowerShell.<\/p>\n<pre class=\"lang:ps decode:true \">PS C:\\ Install-Module -Name AzureRM -RequiredVersion 1.2.9<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Z Azure PowerShell korzysta\u0107 mo\u017cna bezpo\u015brednia na portalu http:\/\/portal.azure.com\u00a0 (tzw. Azure Cloud Shell) jak r\u00f3wnie\u017c zdalnie przy u\u017cyciu lokalnego systemowego PowerShella. Artyku\u0142 opisuje instalacj\u0119 modu\u0142\u00f3w programu Azure PowerShell w \u015brodowisku systemu Windows przy u\u017cyciu modu\u0142u PowerShellGet.<\/p>\n","protected":false},"author":1,"featured_media":2177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"_links":{"self":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/2176"}],"collection":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/comments?post=2176"}],"version-history":[{"count":11,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/2176\/revisions"}],"predecessor-version":[{"id":2189,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/2176\/revisions\/2189"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media\/2177"}],"wp:attachment":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media?parent=2176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/categories?post=2176"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/tags?post=2176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}