Hi Expert,
I struggled to send data to an EventHub using Powershell. I hope someone can help me.
First: documentation here from MSbut i think I really did not understand ;(
Second: below the code I used
################################# # API method $method = "POST" # API header $headers = @{ "Authorization"="SharedAccessSignature sr={my namespace here}.servicebus.windows.net&sig={my key here}&se=1444603552&skn=RootManageSharedAccessKey";"Content-Type"="application/atom+xml;type=entry;charset=utf-8";"Host"="{my name space here}.servicebus.windows.net";"ContentLength" = "42" } # generate the API URI $URI = "https://{my namespace here}.servicebus.windows.net/{my event hub name here}/messages?timeout=60&api-version=2014-01 HTTP/1.1" # create Request Body - What i missed here ??? # $body = { "DeviceId":"dev-01", "Temperature":"37.0" } # execute the Azure REST API Invoke-RestMethod -Uri $URI -Method $method -Headers $headers -Body $body
On computer i added my azure account and already import azure published settings.
Problem: i always get error 401 Remote server not authorized.
Did you experience such error ? Maybe you will catch quickly what i missed or typed wrong.
Regards,
Terry