Powershell Error during Active Directory Application MainLogo picture upload - powershell

I can successfully create a new Azure Active Directory Application in powershell using the cmdlet New-AzureADApplication, however I am unable to add the application logo using powershell for my application.
Below is the code and the error:
Set-AzureADApplication -MainLogo (Get-Content "C:\Users\Test\Logo.png" -encoding BYTE)
Error:
Set-AzureADApplication : Error occurred while executing SetApplication
StatusCode: BadRequest
ErrorCode: Request_BadRequest
Message: A stream property 'mainLogo' has a value in the payload. In OData, stream property must not have a value, it must only use property annotations.
At line:1 char:1
+ Set-AzureADApplication -MainLogo (Get-Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-AzureADApplication], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.SetApplication
The documentation provided here only mentions the usage as
Set-AzureADApplication [-MainLogo ] however I could not find any examples on using this parameter with Set or New-AzureADApplication cmdlet.
Any help would be greatly appreciated!
Thanks,

I tried the command as below, and get the same error message. Based on the results, I recommend to submit a support request here.
[Byte[]]$logo=Get-Content "C:\Users\someuser\Desktop\test.png" -encoding BYTE
Set-AzureADApplication -ObjectId "46dcfdd9-e0c4-4623-8139-73936a716034" -MainLogo $logo
However, as an alternative, you still can upload the logo on Azure portal. Just logging in to the Azure portal, you can choose the Azure Active Directory extension from the left panel, and find the specific application from the Enterprise Applications. From the Properties, you can upload the logo.

-MainLogo accepts byte type only. It won't accept any file like that.
[-MainLogo ]
You can use this for conversion:
Param([String]$path)
[convert]::ToBase64String((get-content $path -encoding byte))
Hope it helps.

Related

How to fix "Object reference not set to an instance of an object" error when running Get-AzDataLakeStoreChildItem cmdlet?

I'm getting an error while running the Azure cmdlet in Powershell. How do I resolve this?
I'm trying to get details of folders and files present in Azure datalake through powershell. I'm able to access the data lake through portal and access all files.
Using Azure cmdlet I've tested the connection using "Test-AzDataLakeStoreAccount -Name $Server" and it works fine too. However, when I execute the below command, it throws null pointer exception. How to resolve that?
**Get-AzDataLakeStoreChildItem -Account "****.azuredatalakestore.net" -Path "/" **
Get-AzDataLakeStoreChildItem : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzDataLakeStoreChildItem -Account "entadls8cc9b872.azuredatalakes ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzDataLakeStoreChildItem], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem
I can reproduce your issue in both windows powershell and azure cloud shell. It looks like a bug about the powershell module Az.DataLakeStore.
I tried Get-AzDataLakeStoreChildItem -AccountName "AccountName" -Path "/test/" which is the same as the sample in the doc, also got the same error. I also tried the Get-AzDataLakeStoreItem -AccountName "AccountName" -Path "/test/123.txt" and Test-AzDataLakeStoreItem -AccountName "AccountName" -Path "/test/123.txt", both got an error like below.
I find a github issue related to this error: https://github.com/Azure/azure-powershell/issues/8352. I think the format of the commands I have tried should be correct. The comment in this issue said 'To use datalake az module you have to use it in netcore powershell (not windows powershell)', but as I know, the Az module is cross-platform, it is not a reason, according to the doc. Another comment said the 'we have fixed this issue. Apologize for the inconvenience. It will be released as part of next release.'

Deciphering error after runnning New-AzureRmDataLakeAnalyticsCatalogCredential

I am working on reading Azure SQL data from a U-SQL script into Data Lake. I am working on creating an external data source in U-SQL. A part of this effort involves the creation of a “credential” using PowerShell. I am following this guidance:
https://learn.microsoft.com/en-us/powershell/module/azurerm.datalakeanalytics/new-azurermdatalakeanalyticscatalogcredential
But, am stuck on an error, shown below. This part of it has me especially stumped: "The resource '' does not exist.". Due to this part of the command : "-Credential (Get-Credential)", I get prompted for login name and password. After that, I get presented with the error.
Please help me decipher this situation.
Thank you!
Eric
C:\WINDOWS\system32> New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "" `
-DatabaseName "<MYDBNAME>" `
-CredentialName "<MYCREDENTIALNAME>" `
-Credential (Get-Credential) `
-Uri "http://<MYSERVERNAME>.database.windows.net:1433"
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
WARNING: The output type defined for this cmdlet is incorrect and will be updated to reflect what is actually returned
(and defined in the help) in a future release.
New-AzureRmDataLakeAnalyticsCatalogCredential : The resource '' does not exist. Trace:
c3e04b2a-2690-4c5e-b61c-58a5ded93c6b Time: 2017-05-10T09:09:07.8971058-07:00
At line:1 char:1
+ New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "bladlalog ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmData...talogCredential], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeAnalytics.NewAzureDataLakeAnalyticsCatalogCredential
Solved by using a new ADL database name, that I created, and not the source Azure SQL database. I got the "az dla catalog credential create" to run cleanly. .... The online documentation I initially found was not clear for indicating the expected database name was an ADL database, and not the source Azure SQL database.

Exception exporting Azure ResourceGroup template

I'm trying to export an Azure ResourceGroup to a template-file using the following cmdlet (Windows 10 x64, module-version 2.0) but it throws an exception PS> Export-AzureRmResourceGroup -ResourceGroupName 'service-env-rg' -Path .\resourcegroup.json -ErrorAction SilentlyContinue Export-AzureRmResourceGroup : InternalServerError : Encountered internal server error. Diagnostic information: timestamp '20160809T072241Z', subscription id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', tracking id 'eed95646-d845-4852-8971-a353bab65db2', request correlation id 'eed95646-d845-4852-8971-a353bab65db2'. At line:1 char:1 + Export-AzureRmResourceGroup -ResourceGroupName 'service-e ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Export-AzureRmResourceGroup], ErrorResponseMessageException + FullyQualifiedErrorId : InternalServerError,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ExportAzureResourceGroupCmdlet
If I run it without -ErrorAction I get a secondary exception as well with the pipeline being stopped. Anyone else seen this ? I got the same error with the previous version of the cmdlet.
I wonder if this is related to the fact that it appears the 'template export' functionality in the Azure portal is not really working properly either ... see this very recent forum thread:
https://social.msdn.microsoft.com/Forums/en-US/3200b7a1-768c-4714-a474-ac02df22e729/problem-with-exporting-current-state-arm-template-for-a-resource-group?forum=windowsazuremanagement
After renaming my Microsoft-account it now works - both in Powershell and in the portal. Ie, it seems that an ARM update has introduced an authentication-change so that a login doesn't properly differentiate between accounts even though I select the type.

Exception creating client using AWS SDK

I am currently using the following sequence of commands in a Windows 7 PowerShell window.
Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll"
$secretKeyID="ABCDEFGHIJKLMNOPQRS"
$secretAccessKeyID="LONGKEYBLAHBLAHBLAHBLAHBLABLAH"
$AWSclient=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID,$secretAccessKeyID)
However, I get this exception below. Please let me know what Im doing wrong. This is what I see most people using successfully.
Exception calling "CreateAmazonS3Client" with "2" argument(s): "No RegionEndpoint or ServiceURL configured"
At line:1 char:1
+ $oAWSclient=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID,$secret ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : AmazonClientException
One thing that I think is a problem is that my bucket is not checked for 'enable website hosting'. Does this need to be set to true? I just want to upload a file to the bucked via powershell script.
Duh... I realized that I need to use the AWS Powershell because it has all the settings built into it. Im not exactly sure how to properly refer to this version of powershell, but it is available after installing the AWS SDK.
Since the error specifically states that you're missing the RegionEndpoint or ServiceURL, you could also just include one of them. Since you're connecting to S3, all you need is to include the RegionEndpoint.
Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll"
$secretKeyID="ABCDEFGHIJKLMNOPQRS"
$secretAccessKeyID="LONGKEYBLAHBLAHBLAHBLAHBLABLAH"
$client = [Amazon.AWSClientFactory]::CreateAmazonS3Client($secretKeyID, $secretAccessKeyID, [Amazon.RegionEndpoint]::USEast1)
(Replace USEast1 with the value configured with your S3 Bucket)

Windows Azure Powershell command Get-AzureWebsite results in error String was not recognized as a valid Boolean

I'm trying to manage some of my Azure Services via Powershell, using http://windowsazurewebsitescheatsheet.info/#powershell as a starting point. I was able to download and import my subscription settings just fine (Import-AzurePublishSettingsFile and Select-AzureSubscription)
After choosing my subscription, I'm attempting to run the Get-AzureWebsite command to view all of my websites, and continue onward from there. When I run that command, however, I get the following:
Import-AzurePublishSettingsFile "C:\AzureCredentials.publishsettings"
Select-AzureSubscription "My Azure Subscription"
Get-AzureWebsite
Get-AzureWebsite : String was not recognized as a valid Boolean.
At line:1 char:1
+ Get-AzureWebsite
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureWebsite], FormatException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand
Anyone have similar issues? I get this error if I run the command as stated above, or if I specify the name of my website. TIA for any help!
This might be related to a known issue enumerating a sites with SSL bindings
There was new release of Windows Azure Powershell released on 02/12. Please try with the new version.
Please run the command again with -Debug turned on, this will display request and response messages and make it easier to pinpoint the issue.