azure - Save-AzureWebSiteLog Invoke-WebRequest error -
i close finish job started cause error.
when execute this
save-azurewebsitelog -name $websitename -output "c:\logs\error.zip" save-azurewebsitelog : maximum message size quota incoming messages (65536) has been exceeded. increase quota, use maxreceivedmessagesize property on appropriate binding element.
so, searched solution, seems many people have exact same problem.
https://azure.microsoft.com/en-us/blog/windows-azure-websites-online-tools-you-should-know-about/
thanks @parth sehgal, have tried solve problem using powershell
$username = "maiemai" $password = "password" $base64authinfo = [convert]::tobase64string([text.encoding]::ascii.getbytes(("{0}:{1}" -f $username,$password))) $apiurl = "https://wngphase2it.scm.azurewebsites.net/api/zip/logfiles/" $response = invoke-webrequest -uri $apiurl -headers @{authorization=("basic {0}" -f $base64authinfo)} -method try { $filename = [system.io.path]::getfilename($response.baseresponse.responseuri.originalstring) $filepath = [system.io.path]::combine("c:\asdf\", "http1.zip") $filestream = [system.io.file]::create($filepath) $response.rawcontentstream.writeto($filestream) } { $filestream.close() } but stuck error
invoke-webrequest : server error 401 - unauthorized: access denied due invalid credentials. not have permission view directory or page using credentials supplied. @ line:5 char:13 + $response = invoke-webrequest -uri $apiurl -headers @{authorization=("basic {0}" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (system.net.httpwebrequest:httpwebrequest) [invoke-webrequest], webexception + fullyqualifiederrorid : webcmdletwebresponseexception,microsoft.powershell.commands.invokewebrequestcommand cannot call method on null-valued expression. @ line:11 char:1 + $response.rawcontentstream.writeto($filestream) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [], runtimeexception + fullyqualifiederrorid : invokemethodonnull
username , password correct, still causing error.
how should change line?
$response = invoke-webrequest -uri $apiurl -headers @{authorization=("basic {0}" -f $base64authinfo)} -method
first of all, username incorrect in case.
in order use azure kudu rest api retrieve zipped log files azure web app, need use web app's msdeploy credential in publish profile file.
the correct form of azure web app's msdeploy username should ${yoursitename}.
you can web app's publish profile new azure portal or via azure powershell command: get-azurermwebapppublishingprofile
i have fixed issue in powershell script tested own web app.
$username = "`$wngphase2it" $password = "yourmsdeployuserpwd" $base64authinfo = [convert]::tobase64string([text.encoding]::ascii.getbytes(("{0}:{1}" -f $username,$password))) $apiurl = "https://wngphase2it.scm.azurewebsites.net/api/zip/logfiles/" $response = invoke-webrequest -uri $apiurl -headers @{authorization=("basic {0}" -f $base64authinfo)} -method try { $filename = [system.io.path]::getfilename($response.baseresponse.responseuri.originalstring) $filepath = [system.io.path]::combine("c:\asdf\", "http1.zip") $filestream = [system.io.file]::create($filepath) $response.rawcontentstream.writeto($filestream) } { $filestream.close() } reference: sample of using kudu rest api powershell
let me know whether helps resolve issue.
Comments
Post a Comment