SASE Private Access(PA)网络诊断技能:创建并查询网络诊断任务,以排查连接问题。
Diagnose whether the enterprise network path through the SASE cluster to office applications is connected, providing link-level visibility and problem localization.
Architecture: SASE Client → POP Entry Point → Connector/CEN/VPN → VPC → Origin Server
TypeDescriptionUse CaseFullLinkDiagnose the full path: Endpoint → POP → OriginTroubleshoot end-to-end connectivity issuesApplicationDiagnose POP → Origin path onlyTroubleshoot SASE cluster to origin network issues
The following features cannot be implemented via CLI or SDK and require the SASE Console:
FeatureReasonWorkaroundVisual link diagramConsole-only UI featureAnalyze NetworkLinkInfo JSON data from API responseDelete diagnosis taskNo public API availableOperate in Console: Private Access > Network DiagnosisRetry diagnosis taskNo public API availableRe-create a new task with the same parametersList diagnosis tasksNo list API availableRecord DiagnoseId and query individuallySASE App version checkClient-side capabilityEnsure SASE App >= 4.4.1Diagnosis task concurrency limitMax 5 concurrent running tasksWait and retry on DiagnosisTask.NumberExceedsLimit error
Pre-check: Aliyun CLI >= 3.3.3 required Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto install/update, or see references/cli-installation-guide.md for installation instructions.
Pre-check: Aliyun CLI plugin update required
- [MUST] run
aliyun configure set --auto-plugin-install trueto enable automatic plugin installation.- [MUST] run
aliyun plugin updateto ensure that any existing plugins are always up-to-date.bash
aliyun configure set --auto-plugin-install true aliyun plugin update
CLI invocation rule: Use Aliyun CLI plugin mode only. Commands MUST use lowercase kebab-case actions and parameters, for example
aliyun csas create-pa-diagnosis-task --diagnose-type FullLink .... Do NOT use PascalCase OpenAPI action names in CLI invocations, and do NOT use--forcegeneric mode for these diagnosis APIs.
No skill-specific environment variables are required. Use an existing Aliyun CLI credential profile and verify it with aliyun configure list.
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusbash
aliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
The following RAM permissions are required:
ActionDescriptioncsas:ListUserDevicesQuery user device list (to obtain DevTag)csas:CreatePADiagnosisTaskCreate Private Access diagnosis taskcsas:GetPADiagnosisTaskQuery Private Access diagnosis task details
See references/ram-policies.md for full policy details.
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
references/ram-policies.mdto get the full list of permissions required by this SKILL- Use
ram-permission-diagnoseskill to guide the user through requesting the necessary permissions- Pause and wait until the user confirms that the required permissions have been granted
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
Parameter NameRequired/OptionalDescriptionDefault Value--diagnose-typeRequiredDiagnosis type: FullLink / Application—--hostRequiredTarget address (IP or domain)—--portRequiredTarget port—--protocolRequiredProtocol: TCP / UDP—--usernameConditionalUsername (required for FullLink)—--dev-tagConditionalDevice ID (required for FullLink)—--user-group-idConditionalUser group ID (required for Application)—--pop-modeRequiredPOP selection mode: AutoSelect / ManualSelect—--pop-idConditionalPOP entry point ID (required when --pop-mode ManualSelect)—--udp-extra-configsOptionalUDP probe config object, for example RequestContent=<request_content> ExpectedResponse=<expected_response>—
[MUST] Enable AI-Mode at the start of Core Workflow (before any CLI invocation): AI-mode is required for Agent Skill execution. Run the following commands before any CLI invocation in this skill:
bash
aliyun configure ai-mode enable aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-sase-pa-network-diagnosis"[MUST] Disable AI-Mode at EVERY exit point: Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed. AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.
bash
aliyun configure ai-mode disable
CLI invocation rule: Use plugin mode commands only:
create-pa-diagnosis-task,get-pa-diagnosis-task, andlist-user-devices. Do not use PascalCase API names or--forcegeneric mode.
FullLink diagnosis requires
DevTag(device ID), but users typically only know the username or hostname. Uselist-user-devicesto query the device list and filter for eligible devices to obtainDeviceTag.
Device selection criteria (ALL must be satisfied):
CriteriaDescriptionParameter / FieldDevice onlineSASE App must be connected--app-statuses OnlineDevice typeOnly Windows or macOS supported--device-types Windows macOSApp versionSASE App >= 4.4.1Response field AppVersion, check client-side
Query eligible devices by username:
bash
aliyun csas list-user-devices \
--current-page 1 --page-size 50 \
--username <username> \
--app-statuses Online \
--device-types Windows macOS \
--cli-query 'Devices[].{DeviceTag: DeviceTag, Hostname: Hostname, DeviceType: DeviceType, AppVersion: AppVersion}'
Query eligible devices by hostname:
bash
aliyun csas list-user-devices \
--current-page 1 --page-size 50 \
--hostname <hostname> \
--app-statuses Online \
--device-types Windows macOS \
--cli-query 'Devices[].{DeviceTag: DeviceTag, Hostname: Hostname, DeviceType: DeviceType, AppVersion: AppVersion}'
Version check: The API does not support filtering by version. Check the
AppVersionfield in results to verify >= 4.4.1. If the version does not meet requirements, prompt the user to upgrade SASE App first.
Multiple devices handling: A user may have multiple devices; the result is a list.
- If only 1 device with a valid version, use its
DeviceTagdirectly- If multiple devices, display the list and ask the user to confirm which device to use
- If no eligible devices found, inform the user to check: device online status, device type support, and version compliance
bash
aliyun csas create-pa-diagnosis-task \
--diagnose-type FullLink \
--host <target_address> \
--port <port> \
--protocol TCP \
--username <username> \
--dev-tag <DeviceTag_from_Task0> \
--pop-mode AutoSelect
bash
aliyun csas create-pa-diagnosis-task \
--diagnose-type Application \
--host <target_address> \
--port <port> \
--protocol TCP \
--user-group-id <user_group_id> \
--pop-mode ManualSelect \
--pop-id <pop_id>
UDP protocol example (with probe config):
bash
aliyun csas create-pa-diagnosis-task \
--diagnose-type Application \
--host <target_address> \
--port <port> \
--protocol UDP \
--user-group-id <user_group_id> \
--pop-mode ManualSelect \
--pop-id <pop_id> \
--udp-extra-configs RequestContent=<request_content> ExpectedResponse=<expected_response>
[IMPORTANT] Diagnosis task concurrency limit is 5. When the number of running tasks reaches the limit,
create-pa-diagnosis-taskreturns the following error:text
ErrorCode: DiagnosisTask.NumberExceedsLimit Message: The number of running diagnosis tasks exceeds the limit of 5. Please wait for the tasks to complete.When this error occurs, use bounded incremental backoff and retry:
- Retry task creation up to 5 times.
- Wait longer before each retry: 30 seconds, 60 seconds, 90 seconds, 120 seconds, then 150 seconds.
- If any retry succeeds, extract
DiagnoseIdand continue to polling. Do not skip the polling and result analysis steps after a successful create.- If all 5 retries fail, clearly tell the user that the SASE diagnosis concurrency limit is still full. Ask the user to open the SASE Console and manually end idle diagnosis tasks, or confirm whether to retry with another
--diagnose-type(FullLink<->Application) after providing the parameters required by that diagnosis type.- If the user cannot clear tasks or switch diagnosis type, run
aliyun configure ai-mode disableand terminate the current workflow.Note: Do NOT expose the raw error message to the user. Instead, explain: "Other diagnosis tasks are currently running and the concurrency limit (5) has been reached. Waiting and retrying..."
Extract DiagnoseId from the successful response:
bash
# Extract DiagnoseId
aliyun csas create-pa-diagnosis-task \
--diagnose-type FullLink --host <target_address> --port <port> --protocol TCP \
--username <username> --dev-tag <DeviceTag_from_Task0> --pop-mode AutoSelect \
--cli-query 'DiagnosisTask.DiagnoseId' --quiet
bash
aliyun csas get-pa-diagnosis-task \
--diagnose-id <diagnose_id>
Poll manually with a bounded loop until Status contains Finished or Failed.
The CLI output may contain quotes, whitespace, or line breaks, so do not rely on exact string equality.
bash
MAX_POLLS=20
POLL_INTERVAL=10
POLL_COUNT=0
STATUS=""
while [ "$POLL_COUNT" -lt "$MAX_POLLS" ]; do
sleep "$POLL_INTERVAL"
POLL_COUNT=$((POLL_COUNT + 1))
STATUS=$(aliyun csas get-pa-diagnosis-task \
--diagnose-id <diagnose_id> \
--cli-query 'DiagnosisTask.Status' --quiet 2>/dev/null | tr -d '[:space:]"')
echo "Current status: $STATUS"
if echo "$STATUS" | grep -qE 'Finished|Failed'; then
break
fi
done
if ! echo "$STATUS" | grep -qE 'Finished|Failed'; then
echo "Polling timed out after $((MAX_POLLS * POLL_INTERVAL)) seconds; retrieve the full task result once and explain that the task may still be running or status parsing failed."
fi
Polling safety: Never poll more than
MAX_POLLStimes in one workflow. If polling times out, retrieve the full task result once withget-pa-diagnosis-task, summarize the current status, then stop or ask the user whether to continue waiting.
[IMPORTANT] Must retrieve the complete result before performing comprehensive analysis. The
Successfield only indicates whether the diagnosis task itself completed normally — it does NOT indicate whether the network link is healthy. Actual network issue information is distributed acrossNetworkLinkInfo.Nodes,NetworkLinkInfo.Links,PolicyInfo, and other fields. Example:Success=truebut a Node hasSuccess=falsewithErrorcontaining zero-trust policy block info means the diagnosis process ran fine but the network is actually blocked.
Step 1: Retrieve the full diagnosis result (single call to get all fields):
bash
aliyun csas get-pa-diagnosis-task \
--diagnose-id <diagnose_id>
Step 2: Comprehensively analyze the following fields from the full result:
Field PathMeaningAnalysis PointsDiagnosisTask.StatusTask statusMust be Finished; Failed means diagnosis itself erroredDiagnosisTask.Result.SuccessWhether diagnosis flow completedtrue only means the diagnosis process executed normallyDiagnosisTask.Result.ErrorMessageDiagnosis-level errorNon-empty indicates diagnosis process errorDiagnosisTask.Result.NetworkLinkInfo.NodesStatus of each network nodeCheck each Node's Success and Error fields to locate which link segment has issuesDiagnosisTask.Result.NetworkLinkInfo.LinksInter-node link connectivityCheck each Link's statusDiagnosisTask.Result.NetworkLinkInfo.DnsDNS resolution resultVerify domain resolves correctlyDiagnosisTask.Result.PolicyInfoZero-trust policy matchCheck if policy allows access, block reason
Analysis principle: Even when
Success=true, you MUST iterate through every Node'sSuccessandErrorfields inNodes. When a node-levelSuccess=falsewith non-emptyError, explain the specific issue for that link segment to the user (e.g., policy block, connection timeout, etc.).
See references/verification-method.md
Note: There is no public API to delete diagnosis tasks. To delete, go to SASE Console > Private Access > Network Diagnosis.
See references/related-commands.md
PopMode=AutoSelect); Application requires manual POP selectionget-pa-diagnosis-task until Status becomes Finished or FailedErrorMessage and each Node's Success/Error in NetworkLinkInfo to locate the problematic segmentDocumentDescriptionreferences/ram-policies.mdRAM permission policiesreferences/related-commands.mdRelated API command listreferences/verification-method.mdVerification methodreferences/cli-installation-guide.mdCLI installation guideOfficial Docs: Network DiagnosisAlibaba Cloud official guideCreatePADiagnosisTask APICreate diagnosis task API docGetPADiagnosisTask APIQuery diagnosis task API doc