Azure-sdk-for-net: Update Network Security Group Flow log to version 2

Created on 5 May 2020  路  3Comments  路  Source: Azure/azure-sdk-for-net

Microsoft.Azure.Management.Fluent (1.33.0)

Is there any way to update flow logs for a network security group to version 2 using .net sdk?

IFlowLogSettings.Update().WithLogging();
IFlowLogSettings.Update().WithRetentionPolicyEnabled();
IFlowLogSettings.Update().WithRetentionPolicyDays();
IFlowLogSettings.Update().WithStorageAccount();

I've been able to update using the methods listed above, but i also need to update the flow logs to version 2 , this can be done in powershell, but in this case i need to do this using C#. However i wasn't able to find how to do it, it would be useful to have this option on the IFlowLogSettings

Mgmt Network customer-reported needs-team-attention question

Most helpful comment

@mihymel

You can try this code (cast settings to IFlowLogSettings if necessary), after IFlowLogSettings.Update().WithStorageAccount();

            settings.Inner.Format = new FlowLogFormatParameters()
            {
                Type = FlowLogFormatType.JSON,
                Version = 2
            };

and before IFlowLogSettings.Update().Apply();

All 3 comments

Hello Weidong @weidongxu-microsoft could you share your thoughts, thanks?

@mihymel

You can try this code (cast settings to IFlowLogSettings if necessary), after IFlowLogSettings.Update().WithStorageAccount();

            settings.Inner.Format = new FlowLogFormatParameters()
            {
                Type = FlowLogFormatType.JSON,
                Version = 2
            };

and before IFlowLogSettings.Update().Apply();

I apologize for the late response , i was able to test this code and it works! thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings