Archive
Resolving Unauthorized Error When Deploying an #Azure Function via #ZipDeploy

Deploying an Azure Function to an App Service can sometimes result in an authentication error, preventing successful publishing. One common error developers encounter is:
Error: The attempt to publish the ZIP file through https://<function-name>.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code Unauthorized.
This error typically occurs when the deployment process lacks the necessary authentication permissions to publish to Azure. Below, we outline the steps to resolve this issue by enabling SCM Basic Auth Publishing in the Azure Portal.
Understanding the Issue
The error indicates that Azure is rejecting the deployment request due to authentication failure. This often happens when the SCM (Kudu) deployment service does not have the correct permissions enabled, preventing the publishing process from proceeding.
Solution: Enable SCM Basic Auth Publishing
To resolve this issue, follow these steps:
- Open the Azure Portal and navigate to your Function App.
- In the left-hand menu, select Configuration.
- Under the General settings tab, locate SCM Basic Auth Publishing.
- Toggle the setting to On.
- Click Save and restart the Function App if necessary.
Once this setting is enabled, retry the deployment from Visual Studio or your chosen deployment method. The unauthorized error should now be resolved.
Additional Considerations
- Use Deployment Credentials: If you prefer not to enable SCM Basic Auth, consider setting up deployment credentials under Deployment Center → FTP/Credentials.
- Check Azure Authentication in Visual Studio: Ensure that you are logged into the correct Azure account in Visual Studio under Tools → Options → Azure Service Authentication.
- Use Azure CLI for Deployment: If problems persist, try deploying with the Azure CLI:
az functionapp deployment source config-zip \ --resource-group <resource-group> \ --name <function-app-name> \ --src <zip-file-path>
By enabling SCM Basic Auth Publishing, you ensure that Azure’s deployment service can authenticate and process your function’s updates smoothly. This quick fix saves time and prevents unnecessary troubleshooting steps.
Using an #API to Retrieve User Details from a #QQ Account ID

QQ, one of China’s largest instant messaging platforms, assigns each user a unique account ID. If you need to retrieve user details from a QQ account ID programmatically, you can use an API such as AvatarAPI. This guide will walk you through making an API request and interpreting the returned JSON response.
API Endpoint
The API request is made to the following URL:
https://avatarapi.com/v2/api.aspx
Request Format
The API expects a POST request with a JSON body containing authentication details (username and password) along with the QQ email ID of the user you want to retrieve information for.
Example Request Body
{
"username": "demo",
"password": "demo___",
"email": "16532096@qq.com"
}
Sending the Request
You can send this request using cURL, Postman, or a programming language like Python. Here’s an example using Python’s requests library:
import requests
import json
url = "https://avatarapi.com/v2/api.aspx"
headers = {"Content-Type": "application/json"}
payload = {
"username": "demo",
"password": "demo___",
"email": "16532096@qq.com"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
API Response
The API returns a JSON object with the user’s details. Below is a sample response:
{
"Name": "邱亮",
"Image": "https://q.qlogo.cn/g?b=qq&nk=16532096&s=640",
"Valid": true,
"City": "",
"Country": "China",
"IsDefault": true,
"Success": true,
"RawData": "",
"Source": {
"Name": "QQ"
}
}
Explanation of Response Fields
- Name: The user’s name associated with the QQ account.
- Image: A URL to the user’s QQ avatar image.
- Valid: Boolean flag indicating if the QQ account is valid.
- City: The user’s city (if available).
- Country: The user’s country.
- IsDefault: Indicates whether the profile is using the default avatar.
- Success: Boolean flag indicating whether the API request was successful.
- RawData: Any additional raw data returned from the source.
- Source: The data provider (in this case, QQ).
Use Cases
This API can be useful for:
- Enhancing user profiles by fetching their QQ avatar and details.
- Verifying the validity of QQ accounts before allowing user actions.
- Personalizing content based on user identity from QQ.
Conclusion
Using an API to retrieve QQ user details is a straightforward process. By sending a POST request with the QQ email ID, you can obtain the user’s name, avatar, and other details. Ensure that you handle user data responsibly and comply with any relevant privacy regulations.
For production use, replace the demo credentials with your own API key and ensure secure storage of authentication details.