logo
down
shadow

'New-AzureStorageContext' is not recognized


'New-AzureStorageContext' is not recognized

Content Index :

'New-AzureStorageContext' is not recognized
Tag : powershell , By : Carlos Galdino
Date : November 24 2020, 01:01 AM

Does that help You haven't loaded the Azure PowerShell module (hence it is missing from the list you have). When you install the Cmdlets you will also get a new shortcut "Microsoft Azure Powershell" which will automatically load the module for you (and make the Cmdlets available).
If you don't want to do it that way you can import the module into an existing PowerShell session using this command (note that the path to the Azure module may differ depending on the version you have installed).
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1"

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Using AzureStorageContext inside of powershell workflow


Tag : powershell , By : Ed.
Date : March 29 2020, 07:55 AM
seems to work fine You should be able to put the InlineScript block within the foreach -parallel, that will run all the InlineScripts in parallel:
$destinationContext = (New-AzureStorageContext -StorageAccountName $destinationAccountName -StorageAccountKey $destinationAccountKey)
$sourceContext = (New-AzureStorageContext -StorageAccountName $prodAccountName -StorageAccountKey $prodAccountKey)

$allContainers = Get-AzureStorageContainer -Context $sourceContext

$startTime = Get-Date -Format "yyyyMMddhhmmss"
foreach ($container in $allContainers.Name)
{
    $allBlobs = (Get-AzureStorageBlob -Container $container -Context $sourceContext).Name

    foreach -Parallel ($blob in $allBlobs)
    {
        InlineScript {
            $destinationContext = (New-AzureStorageContext -StorageAccountName $using:destinationAccountName -StorageAccountKey $using:destinationAccountKey)
            $sourceContext = (New-AzureStorageContext -StorageAccountName $using:prodAccountName -StorageAccountKey $using:prodAccountKey)

            $fileName = $using:startTime + "/" + $using:container + "/" + $using:blob
            Write-Information "Copying $fileName"
            Start-AzureStorageBlobCopy -SrcBlob $using:blob -DestBlob $fileName -SrcContainer $using:container -Context $sourceContext -DestContext $destinationContext -DestContainer $using:destinationContainer
       }
    }
} 

How can I call New-AzureStorageContext using -SasToken instead of -StorageAccountKey


Tag : powershell , By : user185144
Date : March 29 2020, 07:55 AM
hope this fix your issue I think you've discovered a bug in Storage Client Library. I traced the code from PowerShell to Storage Client Library and here's what I found. PowerShell Cmdlet code tries to create a StorageCredentials object by passing this SAS Token.
    public StorageCredentials(string sasToken)
    {
        CommonUtility.AssertNotNullOrEmpty("sasToken", sasToken);

        this.SASToken = sasToken;
        this.UpdateQueryBuilder();
    }

    private void UpdateQueryBuilder()
    {
        SasQueryBuilder newQueryBuilder = new SasQueryBuilder(this.SASToken);

        newQueryBuilder.Add(Constants.QueryConstants.ApiVersion, Constants.HeaderConstants.TargetStorageVersion);

        this.queryBuilder = newQueryBuilder;
    }

Mocked class recognized as 'static member' is being called but it is not being recognized in the test as the mock?


Tag : java , By : tangsty
Date : March 29 2020, 07:55 AM
To fix this issue For mocking static classes we need to use PowerMockito.
Use the following call to prepare you static class methods for mocking
PowerMockito.mockStatic(TRDIUtils.class)
PowerMockito.when(TRDIUtilsstrToInteger(newValueIn)).thenReturn(0);

New-AzureStorageContext: Endpoint vs Environment


Tag : azure , By : Kuer
Date : March 29 2020, 07:55 AM
Hope this helps
what are the differences between the Endpoint and Environment parameters?

"'New-AzureStorageContext' is not recognized," Yet the Module is Installed


Tag : azure , By : alexandruz
Date : March 29 2020, 07:55 AM
may help you . The command New-AzureStorageContext you used belongs to the AzureRM powershell module, it is different from the new module Az , you have not installed it, that caused the issue.
To fix the issue, you could refer to the solutions below.
Enable-AzureRmAlias [-Module <string>] [-Scope Process | CurrentUser | LocalMachine]

Disable-AzureRmAlias [-Module <string[]>] [-Scope Process | CurrentUser | LocalMachine]
Related Posts Related QUESTIONS :
  • Powershell: How to stop start-job?
  • Formatting output from PowerShell to a csv file
  • How to check if a PowerShell switch parameter is absent or false
  • How do I force a function to return a single element array instead of the contained object?
  • compressed file syntax can be supported across all powershell version
  • Is there a way in Powershell for a boolean parameter to automatically be true if not specified when the function is call
  • New-Partition -DriveLetter Option
  • How to add SAMAccountName to output?
  • How to do looping to rename and read a file using PowerShell?
  • Read CSV file then split the values and create a global variable
  • (Get-Date).ToUniversalTime() convert to string but not change format
  • Adding Extra Headers in CSV
  • New-Mailbox command does not accept the -Equipment argument
  • How do I remove IIS 'server' header from http response using Powershell?
  • Creating Subdirectory With Date As Today(mm-dd-yyyy) in Network Drive
  • My first parameter is not being passed to my function
  • How can I overwrite an existing zip file?
  • How to use double if statement using powershell?
  • Command using either or both -Path parameter and $input?
  • How can I return multiple values from a powershell script to the batch file that is calling it?
  • Sensitive word search with powershell
  • Copy files located in multiple subfolder, using a mildmatch search
  • Replace the text for all files in a Directory
  • How to write a PowerShell script which auto increments a number by 1 every time it's run?
  • new user powershell get-service
  • Removing Parts of a File Name based on a Delimiter
  • How can we transform Date in CSV file using PowerShell scripts
  • How to replace multiple characters (<3) of all the filenames in a folder (and subfolder) using PowerShell
  • Powershell environment variable
  • Removing spaces from a string using Powershell
  • List Filename and current date of all files in a directory
  • PowerShell calling environment variable with another variable
  • Uninstall all software starting with a specific string
  • Set-ADUser does not handle empty or null variables
  • How do I get the data results from Invoke-RestMethod into CSV file?
  • ConvertFrom-String returns symbol not text
  • Get-WinEvent Select time and field within data item of 1
  • Create multiple files with Powershell?
  • I have a folder that contains multiple folders which contain images. I want to filter the images based on dimensions
  • Function not working even though variable looks fine
  • How to specify multiple files in $sourcePath
  • Deleting a specific tag in xml file
  • Suppressing called function/cmdlet's WhatIf output, when that function has no WhatIf parameter
  • Import CSV File to a new Excel Worksheet within an existing Excel Workbook
  • Start-Service cmdlet: get underlying error in case of failure
  • What would the opposite if this office 365 powershell command?
  • How to install the WASP in powershell?
  • change powershell command color
  • How to list all installed, runnable cmdlets in powershell?
  • PowerShell index value of PSObject
  • Powershell Foreach-Object behaves abnormaly on null values
  • My code will not write "No files to process"
  • Get certificates information using powershell
  • How to uninstall dell support assist with powershell?
  • EF6 Add-Migration in PowerShell, outside Visual Studio
  • Not able to rename button base on value
  • Description property dont give back result
  • Using powershell script with different parameters
  • How to get the current script to read off computer names off a txt file located on c:\
  • Powershell check if drive letter exists and if so remove
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com