def set_service_properties(self, table_service): print('1. Get Table service properties') props = table_service.get_table_service_properties() retention = RetentionPolicy(enabled=True, days=5) logging = Logging(delete=True, read=False, write=True, retention_policy=retention) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=retention) minute_metrics = Metrics(enabled=False) try: print('2. Ovewrite Table service properties') table_service.set_table_service_properties(logging=logging, hour_metrics=hour_metrics, minute_metrics=minute_metrics) finally: print('3. Revert Table service properties back to the original ones') table_service.set_table_service_properties(logging=props.logging, hour_metrics=props.hour_metrics, minute_metrics=props.minute_metrics) print('4. Set Table service properties completed')