azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

generic error when trying to enable flow logs

Open j-rat opened this issue 8 years ago • 11 comments

Enabling the flow logs via the gui works just fine. I am using azure-cli (2.0.43) on a RHEL7.5 box $ az network watcher flow-log configure --resource-group test-group --enabled true --retention 365 --storage-account flwea000000000000001 --nsg test-sg --debug

end of the debug file msrest.http_logger : 'x-ms-routing-request-id': 'SOUTHCENTRALUS:20180810T060856Z:' msrest.http_logger : 'X-Content-Type-Options': 'nosniff' msrest.http_logger : 'Date': 'Fri, 10 Aug 2018 06:08:56 GMT' msrest.http_logger : 'Cache-Control': 'no-cache, proxy-revalidate' msrest.http_logger : 'Connection': 'Keep-Alive' msrest.http_logger : 'Age': '0' msrest.http_logger : Response content: msrest.http_logger : { "error": { "code": "InternalServerError", "message": "An error occurred.", "details": [] } } msrest.exceptions : An error occurred. An error occurred.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

j-rat avatar Aug 10 '18 06:08 j-rat

Hi @j-rat I just tried the command using the same parameters as you and ran into no issues. "InternalServerError" might be the result of some intermittent service issue. Is it still occurring? If so, some questions:

  1. Are your NSG and storage account all in the same resource group? What about location?
  2. Do you have network watcher enabled for the location your resources are in? When you enabled network watcher, did you use the same resource group as your resources?

tjprescott avatar Aug 10 '18 15:08 tjprescott

@tjprescott hello and thank you for your response.

I have tried from my corporate environment and from an AWS EC2 instance and get the same error.

  1. The NSG and the Storage Account are both in the "East US" but are in different Resource Groups.
  2. I validated that I have Network Watcher enabled in the "East US" location. When enabling the Network Watcher, I had it use the default Resource Group "NetworkWatcherRG"

The other interesting thing is that, I can enable flow logs via the GUI with no problem.

j-rat avatar Aug 13 '18 20:08 j-rat

The problem is that you have the NSG and storage account in different resource groups but are specifying both by name. Thus the CLI is assuming that both resources are in test-group which isn't the case. If you specify the full ARM ID of the storage account, your command will succeed.

I will keep this issue open because the error from the service should indicate that the storage account referenced does not exist, rather than giving an Internal Server Error.

tjprescott avatar Aug 13 '18 20:08 tjprescott

@tjprescott thank you so much! That solved the problem perfectly. we greatly appreciate the help!

j-rat avatar Aug 13 '18 20:08 j-rat

No problem, @j-rat. Glad I was able to help. :)

tjprescott avatar Aug 13 '18 22:08 tjprescott

Hi @tjprescott I'm running into a similar issue, where I'm using the full id for both the NSG and the storage account:

az network watcher flow-log configure --nsg /subscriptions/<sub_id>/resourceGroups/test-rg/providers/Microsoft.Network/networkSecurityGroups/testnsg --enabled true --storage-account /subscriptions/<sub_id>/resourceGroups/testLogging-rg/providers/Microsoft.Storage/storageAccounts/testflowlogsa

erickgalinkin avatar Oct 23 '18 17:10 erickgalinkin

@erickgalinkin Hi could you provide the following information:

  • CorrelationRequestID
  • region
  • subscriptionid, in your request, you request id is "<sub_id"

zwswim avatar Nov 26 '18 18:11 zwswim

Apologies - this is no longer an issue for me. I discovered that some of the automation created the storage accounts in a different region, even though they were in the same resource group. A less generic error message would be really helpful.

erickgalinkin avatar Nov 26 '18 18:11 erickgalinkin

@erickgalinkin Thanks for let know. NetworkWatcher team already checked in a fix to return better error information. The fix should be deployed in 1 or 2 months.

zwswim avatar Nov 26 '18 19:11 zwswim

@zwswim thanks for the update. Since this fix has been checked in to the service, I will close this issue.

tjprescott avatar Nov 26 '18 21:11 tjprescott

The problem is that you have the NSG and storage account in different resource groups but are specifying both by name. Thus the CLI is assuming that both resources are in test-group which isn't the case. If you specify the full ARM ID of the storage account, your command will succeed.

I will keep this issue open because the error from the service should indicate that the storage account referenced does not exist, rather than giving an Internal Server Error.

I was able to get around this by specifying the full resource ID for the storage account as recommended. I assume this is only a workaround though and look forward to a full solution.

rem-aj avatar Oct 03 '19 14:10 rem-aj