gpt4 book ai didi

azure - "' New-AzureStorageContext ' is not recognized,"模块已安装

转载 作者:行者123 更新时间:2023-12-02 06:27:26 25 4
gpt4 key购买 nike

我已按照 https://learn.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-1.0.0 中的说明安装了 Az PowerShell 模块和 .NET Framework 4.7.2但客户端仍然找不到该模块!

PS C:\Scripts> get-module Az

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.1 Az


PS C:\Scripts> get-module

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.1 Az
Script 1.0.0 Az.Accounts {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Conn...
Script 1.0.0 Az.Aks {Get-AzAks, Import-AzAksCredential, New-AzAks, Remove-AzAk...
Script 1.0.0 Az.AnalysisServices {Add-AzAnalysisServicesAccount, Export-AzAnalysisServicesI...
Script 1.0.0 Az.ApiManagement {Add-AzApiManagementApiToProduct, Add-AzApiManagementProdu...
Script 1.0.0 Az.ApplicationInsights {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKe...
Script 1.0.0 Az.Automation {Export-AzAutomationDscConfiguration, Export-AzAutomationD...
Script 1.0.0 Az.Batch {Disable-AzBatchAutoScale, Disable-AzBatchComputeNodeSched...
Script 1.0.0 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzConsumpt...
Script 1.0.0 Az.Cdn {Confirm-AzCdnEndpointProbeURL, Disable-AzCdnCustomDomain,...
Script 1.0.0 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAc...
Script 1.0.0 Az.Compute {Add-AzContainerServiceAgentPoolProfile, Add-AzImageDataDi...
Script 1.0.0 Az.ContainerInstance {Get-AzContainerGroup, Get-AzContainerInstanceLog, New-AzC...
Script 1.0.0 Az.ContainerRegistry {Get-AzContainerRegistry, Get-AzContainerRegistryCredentia...
Script 1.0.0 Az.DataFactory {Get-AzDataFactory, Get-AzDataFactoryActivityWindow, Get-A...
Script 1.0.0 Az.DataLakeAnalytics {Add-AzDataLakeAnalyticsDataSource, Add-AzDataLakeAnalytic...
Script 1.0.0 Az.DataLakeStore {Add-AzDataLakeStoreFirewallRule, Add-AzDataLakeStoreItemC...
Script 1.0.0 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolic...
Script 1.0.0 Az.Dns {Add-AzDnsRecordConfig, Get-AzDnsRecordSet, Get-AzDnsZone,...
Script 1.0.0 Az.EventGrid {Get-AzEventGridSubscription, Get-AzEventGridTopic, Get-Az...
Script 1.0.0 Az.EventHub {Get-AzEventHub, Get-AzEventHubAuthorizationRule, Get-AzEv...
Script 1.0.0 Az.HDInsight {Add-AzHDInsightClusterIdentity, Add-AzHDInsightComponentV...
Script 1.0.0 Az.IotHub {Add-AzIotHubCertificate, Add-AzIotHubEventHubConsumerGrou...
Script 1.0.0 Az.KeyVault {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateConta...
Script 1.0.0 Az.LogicApp {Get-AzIntegrationAccount, Get-AzIntegrationAccountAgreeme...
Script 1.0.0 Az.MachineLearning {Add-AzMlWebServiceRegionalProperty, Export-AzMlWebService...
Script 1.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.0.0 Az.Media {Get-AzMediaService, Get-AzMediaServiceKeys, Get-AzMediaSe...
Script 1.0.0 Az.Monitor {Add-AzAutoscaleSetting, Add-AzLogProfile, Add-AzMetricAle...
Script 1.0.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-Az...
Script 1.0.0 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorization...
Script 1.0.0 Az.OperationalInsights {Disable-AzOperationalInsightsIISLogCollection, Disable-Az...
Script 1.0.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyRemediation, Get-AzPolicyS...
Script 1.0.0 Az.PowerBIEmbedded {Get-AzPowerBIEmbeddedCapacity, Get-AzPowerBIWorkspace, Ge...
Script 1.0.0 Az.RecoveryServices {Backup-AzRecoveryServicesBackupItem, Disable-AzRecoverySe...
Script 1.0.0 Az.RedisCache {Export-AzRedisCache, Get-AzRedisCache, Get-AzRedisCacheFi...
Script 1.0.0 Az.Relay {Get-AzRelayAuthorizationRule, Get-AzRelayHybridConnection...
Script 1.0.0 Az.Resources {Add-AzADGroupMember, Export-AzResourceGroup, Get-AzADAppC...
Script 1.0.0 Az.ServiceBus {Complete-AzServiceBusMigration, Get-AzServiceBusAuthoriza...
Script 1.0.0 Az.ServiceFabric {Add-AzServiceFabricApplicationCertificate, Add-AzServiceF...
Script 1.0.0 Az.SignalR {Get-AzSignalR, Get-AzSignalRKey, New-AzSignalR, New-AzSig...
Script 1.0.0 Az.Sql {Add-AzSqlDatabaseToFailoverGroup, Add-AzSqlManagedInstanc...
Script 1.0.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountNe...
Script 1.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsDefaultFunctionDefinition, Get-AzStr...
Script 1.0.0 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Add-AzTraffic...
Script 1.0.0 Az.Websites {Edit-AzWebAppBackupConfiguration, Enter-AzWebAppContainer...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, En...
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...


PS C:\Scripts> $context = New-AzureStorageContext -StorageAccountName "...my storage account name..." -StorageAccountKey "...my sas key..."
New-AzureStorageContext : The term 'New-AzureStorageContext' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:12
+ $context = New-AzureStorageContext -StorageAccountName "...my storage acc...
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-AzureStorageContext:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

错误(如上面的输出所示)是:

New-AzureStorageContext : The term 'New-AzureStorageContext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我在这里遗漏了什么吗?

最佳答案

命令New-AzureStorageContext您使用的属于AzureRM powershell模块,它与新模块不同Az ,您还没有安装它,导致了这个问题。

要解决该问题,您可以引用以下解决方案。

1.安装AzureRM模块。

2.如果要使用 Az 运行为 AzureRM 开发的脚本,请使用 Enable/Disable-AzureRmAlias cmdlet 添加或删除从 AzureRM cmdlet 到 Az cmdlet 的别名。

将给定模块(如果未指定模块则为所有模块)的 AzureRM cmdlet 别名添加到当前 session (默认)、当前用户的所有 session 或计算机上的所有 session 。

Enable-AzureRmAlias [-Module <string>] [-Scope Process | CurrentUser | LocalMachine]

Disable-AzureRmAlias [-Module <string[]>] [-Scope Process | CurrentUser | LocalMachine]

3.使用New-AzStorageContext推荐使用 New-AzureStorageContextAzureRM 模块基本上已弃用,本质上它们调用相同的 api,并且都是针对 ARM 的,您可以尝试一下。

更多详情,请参阅:Azure PowerShell – Cross-platform “Az” module replacing “AzureRM” .

关于azure - "' New-AzureStorageContext ' is not recognized,"模块已安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54080159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com